|
52 | 52 | #define mmMP1_SMN_C2PMSG_90 0x029a |
53 | 53 | #define mmMP1_SMN_C2PMSG_90_BASE_IDX 0 |
54 | 54 |
|
| 55 | +/* MALLPowerController message arguments (Defines for the Cache mode control) */ |
| 56 | +#define SMU_MALL_PMFW_CONTROL 0 |
| 57 | +#define SMU_MALL_DRIVER_CONTROL 1 |
| 58 | + |
| 59 | +/* |
| 60 | + * MALLPowerState message arguments |
| 61 | + * (Defines for the Allocate/Release Cache mode if in driver mode) |
| 62 | + */ |
| 63 | +#define SMU_MALL_EXIT_PG 0 |
| 64 | +#define SMU_MALL_ENTER_PG 1 |
| 65 | + |
| 66 | +#define SMU_MALL_PG_CONFIG_DEFAULT SMU_MALL_PG_CONFIG_DRIVER_CONTROL_ALWAYS_ON |
| 67 | + |
55 | 68 | #define FEATURE_MASK(feature) (1ULL << feature) |
56 | 69 | #define SMC_DPM_FEATURE ( \ |
57 | 70 | FEATURE_MASK(FEATURE_CCLK_DPM_BIT) | \ |
|
66 | 79 | FEATURE_MASK(FEATURE_GFX_DPM_BIT) | \ |
67 | 80 | FEATURE_MASK(FEATURE_VPE_DPM_BIT)) |
68 | 81 |
|
| 82 | +enum smu_mall_pg_config { |
| 83 | + SMU_MALL_PG_CONFIG_PMFW_CONTROL = 0, |
| 84 | + SMU_MALL_PG_CONFIG_DRIVER_CONTROL_ALWAYS_ON = 1, |
| 85 | + SMU_MALL_PG_CONFIG_DRIVER_CONTROL_ALWAYS_OFF = 2, |
| 86 | +}; |
| 87 | + |
69 | 88 | static struct cmn2asic_msg_mapping smu_v14_0_0_message_map[SMU_MSG_MAX_COUNT] = { |
70 | 89 | MSG_MAP(TestMessage, PPSMC_MSG_TestMessage, 1), |
71 | 90 | MSG_MAP(GetSmuVersion, PPSMC_MSG_GetPmfwVersion, 1), |
@@ -113,6 +132,8 @@ static struct cmn2asic_msg_mapping smu_v14_0_0_message_map[SMU_MSG_MAX_COUNT] = |
113 | 132 | MSG_MAP(PowerDownUmsch, PPSMC_MSG_PowerDownUmsch, 1), |
114 | 133 | MSG_MAP(SetSoftMaxVpe, PPSMC_MSG_SetSoftMaxVpe, 1), |
115 | 134 | MSG_MAP(SetSoftMinVpe, PPSMC_MSG_SetSoftMinVpe, 1), |
| 135 | + MSG_MAP(MALLPowerController, PPSMC_MSG_MALLPowerController, 1), |
| 136 | + MSG_MAP(MALLPowerState, PPSMC_MSG_MALLPowerState, 1), |
116 | 137 | }; |
117 | 138 |
|
118 | 139 | static struct cmn2asic_mapping smu_v14_0_0_feature_mask_map[SMU_FEATURE_COUNT] = { |
@@ -1423,6 +1444,57 @@ static int smu_v14_0_common_get_dpm_table(struct smu_context *smu, struct dpm_cl |
1423 | 1444 | return 0; |
1424 | 1445 | } |
1425 | 1446 |
|
| 1447 | +static int smu_v14_0_1_init_mall_power_gating(struct smu_context *smu, enum smu_mall_pg_config pg_config) |
| 1448 | +{ |
| 1449 | + struct amdgpu_device *adev = smu->adev; |
| 1450 | + int ret = 0; |
| 1451 | + |
| 1452 | + if (pg_config == SMU_MALL_PG_CONFIG_PMFW_CONTROL) { |
| 1453 | + ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_MALLPowerController, |
| 1454 | + SMU_MALL_PMFW_CONTROL, NULL); |
| 1455 | + if (ret) { |
| 1456 | + dev_err(adev->dev, "Init MALL PMFW CONTROL Failure\n"); |
| 1457 | + return ret; |
| 1458 | + } |
| 1459 | + } else { |
| 1460 | + ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_MALLPowerController, |
| 1461 | + SMU_MALL_DRIVER_CONTROL, NULL); |
| 1462 | + if (ret) { |
| 1463 | + dev_err(adev->dev, "Init MALL Driver CONTROL Failure\n"); |
| 1464 | + return ret; |
| 1465 | + } |
| 1466 | + |
| 1467 | + if (pg_config == SMU_MALL_PG_CONFIG_DRIVER_CONTROL_ALWAYS_ON) { |
| 1468 | + ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_MALLPowerState, |
| 1469 | + SMU_MALL_EXIT_PG, NULL); |
| 1470 | + if (ret) { |
| 1471 | + dev_err(adev->dev, "EXIT MALL PG Failure\n"); |
| 1472 | + return ret; |
| 1473 | + } |
| 1474 | + } else if (pg_config == SMU_MALL_PG_CONFIG_DRIVER_CONTROL_ALWAYS_OFF) { |
| 1475 | + ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_MALLPowerState, |
| 1476 | + SMU_MALL_ENTER_PG, NULL); |
| 1477 | + if (ret) { |
| 1478 | + dev_err(adev->dev, "Enter MALL PG Failure\n"); |
| 1479 | + return ret; |
| 1480 | + } |
| 1481 | + } |
| 1482 | + } |
| 1483 | + |
| 1484 | + return ret; |
| 1485 | +} |
| 1486 | + |
| 1487 | +static int smu_v14_0_common_set_mall_enable(struct smu_context *smu) |
| 1488 | +{ |
| 1489 | + enum smu_mall_pg_config pg_config = SMU_MALL_PG_CONFIG_DEFAULT; |
| 1490 | + int ret = 0; |
| 1491 | + |
| 1492 | + if (amdgpu_ip_version(smu->adev, MP1_HWIP, 0) == IP_VERSION(14, 0, 1)) |
| 1493 | + ret = smu_v14_0_1_init_mall_power_gating(smu, pg_config); |
| 1494 | + |
| 1495 | + return ret; |
| 1496 | +} |
| 1497 | + |
1426 | 1498 | static const struct pptable_funcs smu_v14_0_0_ppt_funcs = { |
1427 | 1499 | .check_fw_status = smu_v14_0_check_fw_status, |
1428 | 1500 | .check_fw_version = smu_v14_0_check_fw_version, |
@@ -1454,6 +1526,7 @@ static const struct pptable_funcs smu_v14_0_0_ppt_funcs = { |
1454 | 1526 | .dpm_set_vpe_enable = smu_v14_0_0_set_vpe_enable, |
1455 | 1527 | .dpm_set_umsch_mm_enable = smu_v14_0_0_set_umsch_mm_enable, |
1456 | 1528 | .get_dpm_clock_table = smu_v14_0_common_get_dpm_table, |
| 1529 | + .set_mall_enable = smu_v14_0_common_set_mall_enable, |
1457 | 1530 | }; |
1458 | 1531 |
|
1459 | 1532 | static void smu_v14_0_0_set_smu_mailbox_registers(struct smu_context *smu) |
|
0 commit comments