[PATCH 1/8] drm/amd/powerplay: bypass dpm_context null pointer check guard for some smu series

Wang, Kevin(Yang) Kevin1.Wang at amd.com
Thu Sep 26 05:15:16 UTC 2019


comment inline.
________________________________
From: amd-gfx <amd-gfx-bounces at lists.freedesktop.org> on behalf of Liang, Prike <Prike.Liang at amd.com>
Sent: Thursday, September 26, 2019 11:50 AM
To: amd-gfx at lists.freedesktop.org <amd-gfx at lists.freedesktop.org>
Cc: Liang, Prike <Prike.Liang at amd.com>; Quan, Evan <Evan.Quan at amd.com>; Huang, Ray <Ray.Huang at amd.com>; keneth.feng at amd.com <keneth.feng at amd.com>
Subject: [PATCH 1/8] 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: Prike Liang <Prike.Liang at amd.com>
---
 drivers/gpu/drm/amd/powerplay/amdgpu_smu.c     | 7 ++++---
 drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h | 1 +
 drivers/gpu/drm/amd/powerplay/renoir_ppt.c     | 1 +
 3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
index 23293e1..ae4a82e 100644
--- a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
+++ b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
@@ -1557,7 +1557,8 @@ static int smu_enable_umd_pstate(void *handle,

         struct smu_context *smu = (struct smu_context*)(handle);
         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;

         if (!(smu_dpm_ctx->dpm_level & profile_mode_mask)) {
@@ -1755,7 +1756,7 @@ enum amd_dpm_forced_level smu_get_performance_level(struct smu_context *smu)
         struct smu_dpm_context *smu_dpm_ctx = &(smu->smu_dpm);
         enum amd_dpm_forced_level level;

-       if (!smu_dpm_ctx->dpm_context)
+       if (!smu->is_apu && !smu_dpm_ctx->dpm_context)
                 return -EINVAL;

         mutex_lock(&(smu->mutex));
@@ -1770,7 +1771,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);
         int ret = 0;

-       if (!smu_dpm_ctx->dpm_context)
+       if (!smu->is_apu && !smu_dpm_ctx->dpm_context)
                 return -EINVAL;

         ret = smu_enable_umd_pstate(smu, &level);
diff --git a/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h b/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h
index 5c89844..bd1e621 100644
--- a/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h
+++ b/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h
@@ -387,6 +387,7 @@ struct smu_context
         uint32_t power_profile_mode;
         uint32_t default_power_profile_mode;
         bool pm_enabled;
+       bool is_apu;

         uint32_t smc_if_version;

diff --git a/drivers/gpu/drm/amd/powerplay/renoir_ppt.c b/drivers/gpu/drm/amd/powerplay/renoir_ppt.c
index 9311b6a..a4e44d3 100644
--- a/drivers/gpu/drm/amd/powerplay/renoir_ppt.c
+++ b/drivers/gpu/drm/amd/powerplay/renoir_ppt.c
@@ -141,6 +141,7 @@ static int renoir_get_smu_table_index(struct smu_context *smc, uint32_t index)
 static int renoir_tables_init(struct smu_context *smu, struct smu_table *tables)
 {
         struct smu_table_context *smu_table = &smu->smu_table;
+       smu->is_apu = true;
[keivn]:
i'd like move this into function of "renoir_set_ppt_funcs".
and this member should be set default value in amdgpu_smu.c

after fixed:
Reviewed-by: Kevin Wang <kevin1.wang at amd.com>

         SMU_TABLE_INIT(tables, SMU_TABLE_WATERMARKS, sizeof(Watermarks_t),
                 PAGE_SIZE, AMDGPU_GEM_DOMAIN_VRAM);
--
2.7.4

_______________________________________________
amd-gfx mailing list
amd-gfx at lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/amd-gfx/attachments/20190926/531edb19/attachment.html>


More information about the amd-gfx mailing list