Commit af1ec44f authored by Prike Liang's avatar Prike Liang Committed by Alex Deucher

drm/amd/powerplay: bypass dpm_context null pointer check guard for some smu series

For now APU has no smu_dpm_context structure for containing default/current related dpm tables,
thus will needn't initialize smu_dpm_context to aviod APU null pointer issue.
Signed-off-by: default avatarPrike Liang <Prike.Liang@amd.com>
Reviewed-by: default avatarKevin Wang <kevin1.wang@amd.com>
Reviewed-by: default avatarEvan Quan <evan.quan@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 227f7d58
...@@ -1559,7 +1559,8 @@ static int smu_enable_umd_pstate(void *handle, ...@@ -1559,7 +1559,8 @@ static int smu_enable_umd_pstate(void *handle,
struct smu_context *smu = (struct smu_context*)(handle); struct smu_context *smu = (struct smu_context*)(handle);
struct smu_dpm_context *smu_dpm_ctx = &(smu->smu_dpm); struct smu_dpm_context *smu_dpm_ctx = &(smu->smu_dpm);
if (!smu->pm_enabled || !smu_dpm_ctx->dpm_context)
if (!smu->is_apu && (!smu->pm_enabled || !smu_dpm_ctx->dpm_context))
return -EINVAL; return -EINVAL;
if (!(smu_dpm_ctx->dpm_level & profile_mode_mask)) { if (!(smu_dpm_ctx->dpm_level & profile_mode_mask)) {
...@@ -1757,7 +1758,7 @@ enum amd_dpm_forced_level smu_get_performance_level(struct smu_context *smu) ...@@ -1757,7 +1758,7 @@ enum amd_dpm_forced_level smu_get_performance_level(struct smu_context *smu)
struct smu_dpm_context *smu_dpm_ctx = &(smu->smu_dpm); struct smu_dpm_context *smu_dpm_ctx = &(smu->smu_dpm);
enum amd_dpm_forced_level level; enum amd_dpm_forced_level level;
if (!smu_dpm_ctx->dpm_context) if (!smu->is_apu && !smu_dpm_ctx->dpm_context)
return -EINVAL; return -EINVAL;
mutex_lock(&(smu->mutex)); mutex_lock(&(smu->mutex));
...@@ -1772,7 +1773,7 @@ int smu_force_performance_level(struct smu_context *smu, enum amd_dpm_forced_lev ...@@ -1772,7 +1773,7 @@ int smu_force_performance_level(struct smu_context *smu, enum amd_dpm_forced_lev
struct smu_dpm_context *smu_dpm_ctx = &(smu->smu_dpm); struct smu_dpm_context *smu_dpm_ctx = &(smu->smu_dpm);
int ret = 0; int ret = 0;
if (!smu_dpm_ctx->dpm_context) if (!smu->is_apu && !smu_dpm_ctx->dpm_context)
return -EINVAL; return -EINVAL;
ret = smu_enable_umd_pstate(smu, &level); ret = smu_enable_umd_pstate(smu, &level);
......
...@@ -388,6 +388,7 @@ struct smu_context ...@@ -388,6 +388,7 @@ struct smu_context
uint32_t power_profile_mode; uint32_t power_profile_mode;
uint32_t default_power_profile_mode; uint32_t default_power_profile_mode;
bool pm_enabled; bool pm_enabled;
bool is_apu;
uint32_t smc_if_version; uint32_t smc_if_version;
......
...@@ -319,4 +319,5 @@ void renoir_set_ppt_funcs(struct smu_context *smu) ...@@ -319,4 +319,5 @@ void renoir_set_ppt_funcs(struct smu_context *smu)
{ {
smu->ppt_funcs = &renoir_ppt_funcs; smu->ppt_funcs = &renoir_ppt_funcs;
smu->smc_if_version = SMU12_DRIVER_IF_VERSION; smu->smc_if_version = SMU12_DRIVER_IF_VERSION;
smu->is_apu = true;
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment