[PATCH] drm/amdgpu/pm: look up current_level for asics without pm callback

Wang, Yang(Kevin) KevinYang.Wang at amd.com
Tue Oct 26 14:58:26 UTC 2021


[AMD Official Use Only]

Reviewed-by: Kevin Wang <kevinyang.wang at amd.com>

Best Regards,
Keivn
________________________________
From: amd-gfx <amd-gfx-bounces at lists.freedesktop.org> on behalf of Alex Deucher <alexander.deucher at amd.com>
Sent: Tuesday, October 26, 2021 10:46 PM
To: amd-gfx at lists.freedesktop.org <amd-gfx at lists.freedesktop.org>
Cc: Deucher, Alexander <Alexander.Deucher at amd.com>
Subject: [PATCH] drm/amdgpu/pm: look up current_level for asics without pm callback

For asics without a callback, use the current level rather than 0xff.
This can avoid an unnecesary forced level set on older asics when
set by the user.

Signed-off-by: Alex Deucher <alexander.deucher at amd.com>
---
 drivers/gpu/drm/amd/pm/amdgpu_pm.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/pm/amdgpu_pm.c b/drivers/gpu/drm/amd/pm/amdgpu_pm.c
index 01cca08a774f..49fe4155c374 100644
--- a/drivers/gpu/drm/amd/pm/amdgpu_pm.c
+++ b/drivers/gpu/drm/amd/pm/amdgpu_pm.c
@@ -310,7 +310,7 @@ static ssize_t amdgpu_set_power_dpm_force_performance_level(struct device *dev,
         struct amdgpu_device *adev = drm_to_adev(ddev);
         const struct amd_pm_funcs *pp_funcs = adev->powerplay.pp_funcs;
         enum amd_dpm_forced_level level;
-       enum amd_dpm_forced_level current_level = 0xff;
+       enum amd_dpm_forced_level current_level;
         int ret = 0;

         if (amdgpu_in_reset(adev))
@@ -350,6 +350,8 @@ static ssize_t amdgpu_set_power_dpm_force_performance_level(struct device *dev,

         if (pp_funcs->get_performance_level)
                 current_level = amdgpu_dpm_get_performance_level(adev);
+       else
+               current_level = adev->pm.dpm.forced_level;

         if (current_level == level) {
                 pm_runtime_mark_last_busy(ddev->dev);
--
2.31.1

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/amd-gfx/attachments/20211026/d170d410/attachment-0001.htm>


More information about the amd-gfx mailing list