[PATCH] drm/amd/powerplay: hint and error out when prerequisite not meet

Deucher, Alexander Alexander.Deucher at amd.com
Thu Jan 3 14:20:55 UTC 2019


Reviewed-by: Alex Deucher <alexander.deucher at amd.com>

________________________________
From: amd-gfx <amd-gfx-bounces at lists.freedesktop.org> on behalf of Evan Quan <evan.quan at amd.com>
Sent: Thursday, January 3, 2019 1:06:56 AM
To: amd-gfx at lists.freedesktop.org
Cc: Quan, Evan
Subject: [PATCH] drm/amd/powerplay: hint and error out when prerequisite not meet

Do not ignore the error silently. Otherwise user may thought it
was executed successfully.

Change-Id: I4ac0cff5918d53d1d737f1c2fb1a4f81917dbf56
Signed-off-by: Evan Quan <evan.quan at amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c        | 14 ++++++++++----
 drivers/gpu/drm/amd/powerplay/amd_powerplay.c |  4 +++-
 2 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
index 5e071917594f..e0a9f02d68d1 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
@@ -756,8 +756,11 @@ static ssize_t amdgpu_set_pp_dpm_sclk(struct device *dev,
         if (ret)
                 return ret;

-       if (adev->powerplay.pp_funcs->force_clock_level)
-               amdgpu_dpm_force_clock_level(adev, PP_SCLK, mask);
+       if (adev->powerplay.pp_funcs->force_clock_level) {
+               ret = amdgpu_dpm_force_clock_level(adev, PP_SCLK, mask);
+               if (ret)
+                       return ret;
+       }

         return count;
 }
@@ -789,8 +792,11 @@ static ssize_t amdgpu_set_pp_dpm_mclk(struct device *dev,
         if (ret)
                 return ret;

-       if (adev->powerplay.pp_funcs->force_clock_level)
-               amdgpu_dpm_force_clock_level(adev, PP_MCLK, mask);
+       if (adev->powerplay.pp_funcs->force_clock_level) {
+               ret = amdgpu_dpm_force_clock_level(adev, PP_MCLK, mask);
+               if (ret)
+                       return ret;
+       }

         return count;
 }
diff --git a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
index 27215e4b488b..285375b96ea4 100644
--- a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
+++ b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
@@ -727,8 +727,10 @@ static int pp_dpm_force_clock_level(void *handle,
         mutex_lock(&hwmgr->smu_lock);
         if (hwmgr->dpm_level == AMD_DPM_FORCED_LEVEL_MANUAL)
                 ret = hwmgr->hwmgr_func->force_clock_level(hwmgr, type, mask);
-       else
+       else {
+               pr_info_ratelimited("Force clock level setting is for manual dpm mode only.\n");
                 ret = -EINVAL;
+       }
         mutex_unlock(&hwmgr->smu_lock);
         return ret;
 }
--
2.20.1

_______________________________________________
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/20190103/35de6854/attachment-0001.html>


More information about the amd-gfx mailing list