|
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] = { |
@@ -1417,6 +1438,57 @@ static int smu_v14_0_common_get_dpm_table(struct smu_context *smu, struct dpm_cl |
1417 | 1438 | return 0; |
1418 | 1439 | } |
1419 | 1440 |
|
| 1441 | +static int smu_v14_0_1_init_mall_power_gating(struct smu_context *smu, enum smu_mall_pg_config pg_config) |
| 1442 | +{ |
| 1443 | + struct amdgpu_device *adev = smu->adev; |
| 1444 | + int ret = 0; |
| 1445 | + |
| 1446 | + if (pg_config == SMU_MALL_PG_CONFIG_PMFW_CONTROL) { |
| 1447 | + ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_MALLPowerController, |
| 1448 | + SMU_MALL_PMFW_CONTROL, NULL); |
| 1449 | + if (ret) { |
| 1450 | + dev_err(adev->dev, "Init MALL PMFW CONTROL Failure\n"); |
| 1451 | + return ret; |
| 1452 | + } |
| 1453 | + } else { |
| 1454 | + ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_MALLPowerController, |
| 1455 | + SMU_MALL_DRIVER_CONTROL, NULL); |
| 1456 | + if (ret) { |
| 1457 | + dev_err(adev->dev, "Init MALL Driver CONTROL Failure\n"); |
| 1458 | + return ret; |
| 1459 | + } |
| 1460 | + |
| 1461 | + if (pg_config == SMU_MALL_PG_CONFIG_DRIVER_CONTROL_ALWAYS_ON) { |
| 1462 | + ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_MALLPowerState, |
| 1463 | + SMU_MALL_EXIT_PG, NULL); |
| 1464 | + if (ret) { |
| 1465 | + dev_err(adev->dev, "EXIT MALL PG Failure\n"); |
| 1466 | + return ret; |
| 1467 | + } |
| 1468 | + } else if (pg_config == SMU_MALL_PG_CONFIG_DRIVER_CONTROL_ALWAYS_OFF) { |
| 1469 | + ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_MALLPowerState, |
| 1470 | + SMU_MALL_ENTER_PG, NULL); |
| 1471 | + if (ret) { |
| 1472 | + dev_err(adev->dev, "Enter MALL PG Failure\n"); |
| 1473 | + return ret; |
| 1474 | + } |
| 1475 | + } |
| 1476 | + } |
| 1477 | + |
| 1478 | + return ret; |
| 1479 | +} |
| 1480 | + |
| 1481 | +static int smu_v14_0_common_set_mall_enable(struct smu_context *smu) |
| 1482 | +{ |
| 1483 | + enum smu_mall_pg_config pg_config = SMU_MALL_PG_CONFIG_DEFAULT; |
| 1484 | + int ret = 0; |
| 1485 | + |
| 1486 | + if (amdgpu_ip_version(smu->adev, MP1_HWIP, 0) == IP_VERSION(14, 0, 1)) |
| 1487 | + ret = smu_v14_0_1_init_mall_power_gating(smu, pg_config); |
| 1488 | + |
| 1489 | + return ret; |
| 1490 | +} |
| 1491 | + |
1420 | 1492 | static const struct pptable_funcs smu_v14_0_0_ppt_funcs = { |
1421 | 1493 | .check_fw_status = smu_v14_0_check_fw_status, |
1422 | 1494 | .check_fw_version = smu_v14_0_check_fw_version, |
@@ -1448,6 +1520,7 @@ static const struct pptable_funcs smu_v14_0_0_ppt_funcs = { |
1448 | 1520 | .dpm_set_vpe_enable = smu_v14_0_0_set_vpe_enable, |
1449 | 1521 | .dpm_set_umsch_mm_enable = smu_v14_0_0_set_umsch_mm_enable, |
1450 | 1522 | .get_dpm_clock_table = smu_v14_0_common_get_dpm_table, |
| 1523 | + .set_mall_enable = smu_v14_0_common_set_mall_enable, |
1451 | 1524 | }; |
1452 | 1525 |
|
1453 | 1526 | static void smu_v14_0_0_set_smu_mailbox_registers(struct smu_context *smu) |
|
0 commit comments