aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c')
-rw-r--r--drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c63
1 files changed, 38 insertions, 25 deletions
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c
index ce941fbb9cfb..825786fc849e 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c
@@ -266,9 +266,31 @@ static int aldebaran_tables_init(struct smu_context *smu)
return 0;
}
+static int aldebaran_select_plpd_policy(struct smu_context *smu, int level)
+{
+ struct amdgpu_device *adev = smu->adev;
+
+ /* The message only works on master die and NACK will be sent
+ * back for other dies, only send it on master die.
+ */
+ if (adev->smuio.funcs->get_socket_id(adev) ||
+ adev->smuio.funcs->get_die_id(adev))
+ return 0;
+
+ if (level == XGMI_PLPD_DEFAULT)
+ return smu_cmn_send_smc_msg_with_param(
+ smu, SMU_MSG_GmiPwrDnControl, 0, NULL);
+ else if (level == XGMI_PLPD_DISALLOW)
+ return smu_cmn_send_smc_msg_with_param(
+ smu, SMU_MSG_GmiPwrDnControl, 1, NULL);
+ else
+ return -EINVAL;
+}
+
static int aldebaran_allocate_dpm_context(struct smu_context *smu)
{
struct smu_dpm_context *smu_dpm = &smu->smu_dpm;
+ struct smu_dpm_policy *policy;
smu_dpm->dpm_context = kzalloc(sizeof(struct smu_13_0_dpm_context),
GFP_KERNEL);
@@ -276,6 +298,20 @@ static int aldebaran_allocate_dpm_context(struct smu_context *smu)
return -ENOMEM;
smu_dpm->dpm_context_size = sizeof(struct smu_13_0_dpm_context);
+ smu_dpm->dpm_policies =
+ kzalloc(sizeof(struct smu_dpm_policy_ctxt), GFP_KERNEL);
+
+ if (!smu_dpm->dpm_policies)
+ return -ENOMEM;
+
+ policy = &(smu_dpm->dpm_policies->policies[0]);
+ policy->policy_type = PP_PM_POLICY_XGMI_PLPD;
+ policy->level_mask = BIT(XGMI_PLPD_DISALLOW) | BIT(XGMI_PLPD_DEFAULT);
+ policy->current_level = XGMI_PLPD_DEFAULT;
+ policy->set_policy = aldebaran_select_plpd_policy;
+ smu_cmn_generic_plpd_policy_desc(policy);
+ smu_dpm->dpm_policies->policy_mask |= BIT(PP_PM_POLICY_XGMI_PLPD);
+
return 0;
}
@@ -1607,29 +1643,6 @@ static int aldebaran_set_df_cstate(struct smu_context *smu,
return smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_DFCstateControl, state, NULL);
}
-static int aldebaran_select_xgmi_plpd_policy(struct smu_context *smu,
- enum pp_xgmi_plpd_mode mode)
-{
- struct amdgpu_device *adev = smu->adev;
-
- /* The message only works on master die and NACK will be sent
- back for other dies, only send it on master die */
- if (adev->smuio.funcs->get_socket_id(adev) ||
- adev->smuio.funcs->get_die_id(adev))
- return 0;
-
- if (mode == XGMI_PLPD_DEFAULT)
- return smu_cmn_send_smc_msg_with_param(smu,
- SMU_MSG_GmiPwrDnControl,
- 0, NULL);
- else if (mode == XGMI_PLPD_DISALLOW)
- return smu_cmn_send_smc_msg_with_param(smu,
- SMU_MSG_GmiPwrDnControl,
- 1, NULL);
- else
- return -EINVAL;
-}
-
static const struct throttling_logging_label {
uint32_t feature_mask;
const char *label;
@@ -1886,7 +1899,8 @@ static int aldebaran_mode2_reset(struct smu_context *smu)
index = smu_cmn_to_asic_specific_index(smu, CMN2ASIC_MAPPING_MSG,
SMU_MSG_GfxDeviceDriverReset);
-
+ if (index < 0 )
+ return -EINVAL;
mutex_lock(&smu->message_lock);
if (smu->smc_fw_version >= 0x00441400) {
ret = smu_cmn_send_msg_without_waiting(smu, (uint16_t)index, SMU_RESET_MODE_2);
@@ -2068,7 +2082,6 @@ static const struct pptable_funcs aldebaran_ppt_funcs = {
.set_soft_freq_limited_range = aldebaran_set_soft_freq_limited_range,
.od_edit_dpm_table = aldebaran_usr_edit_dpm_table,
.set_df_cstate = aldebaran_set_df_cstate,
- .select_xgmi_plpd_policy = aldebaran_select_xgmi_plpd_policy,
.log_thermal_throttling_event = aldebaran_log_thermal_throttling_event,
.get_pp_feature_mask = smu_cmn_get_pp_feature_mask,
.set_pp_feature_mask = smu_cmn_set_pp_feature_mask,