<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p style="margin-top:0;margin-bottom:0">Reviewed-by: Alex Deucher <alexander.deucher@amd.com><br>
</p>
</div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> amd-gfx <amd-gfx-bounces@lists.freedesktop.org> on behalf of Evan Quan <evan.quan@amd.com><br>
<b>Sent:</b> Thursday, January 3, 2019 1:06:56 AM<br>
<b>To:</b> amd-gfx@lists.freedesktop.org<br>
<b>Cc:</b> Quan, Evan<br>
<b>Subject:</b> [PATCH] drm/amd/powerplay: hint and error out when prerequisite not meet</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">Do not ignore the error silently. Otherwise user may thought it<br>
was executed successfully.<br>
<br>
Change-Id: I4ac0cff5918d53d1d737f1c2fb1a4f81917dbf56<br>
Signed-off-by: Evan Quan <evan.quan@amd.com><br>
---<br>
 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c        | 14 ++++++++++----<br>
 drivers/gpu/drm/amd/powerplay/amd_powerplay.c |  4 +++-<br>
 2 files changed, 13 insertions(+), 5 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c<br>
index 5e071917594f..e0a9f02d68d1 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c<br>
@@ -756,8 +756,11 @@ static ssize_t amdgpu_set_pp_dpm_sclk(struct device *dev,<br>
         if (ret)<br>
                 return ret;<br>
 <br>
-       if (adev->powerplay.pp_funcs->force_clock_level)<br>
-               amdgpu_dpm_force_clock_level(adev, PP_SCLK, mask);<br>
+       if (adev->powerplay.pp_funcs->force_clock_level) {<br>
+               ret = amdgpu_dpm_force_clock_level(adev, PP_SCLK, mask);<br>
+               if (ret)<br>
+                       return ret;<br>
+       }<br>
 <br>
         return count;<br>
 }<br>
@@ -789,8 +792,11 @@ static ssize_t amdgpu_set_pp_dpm_mclk(struct device *dev,<br>
         if (ret)<br>
                 return ret;<br>
 <br>
-       if (adev->powerplay.pp_funcs->force_clock_level)<br>
-               amdgpu_dpm_force_clock_level(adev, PP_MCLK, mask);<br>
+       if (adev->powerplay.pp_funcs->force_clock_level) {<br>
+               ret = amdgpu_dpm_force_clock_level(adev, PP_MCLK, mask);<br>
+               if (ret)<br>
+                       return ret;<br>
+       }<br>
 <br>
         return count;<br>
 }<br>
diff --git a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c<br>
index 27215e4b488b..285375b96ea4 100644<br>
--- a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c<br>
+++ b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c<br>
@@ -727,8 +727,10 @@ static int pp_dpm_force_clock_level(void *handle,<br>
         mutex_lock(&hwmgr->smu_lock);<br>
         if (hwmgr->dpm_level == AMD_DPM_FORCED_LEVEL_MANUAL)<br>
                 ret = hwmgr->hwmgr_func->force_clock_level(hwmgr, type, mask);<br>
-       else<br>
+       else {<br>
+               pr_info_ratelimited("Force clock level setting is for manual dpm mode only.\n");<br>
                 ret = -EINVAL;<br>
+       }<br>
         mutex_unlock(&hwmgr->smu_lock);<br>
         return ret;<br>
 }<br>
-- <br>
2.20.1<br>
<br>
_______________________________________________<br>
amd-gfx mailing list<br>
amd-gfx@lists.freedesktop.org<br>
<a href="https://lists.freedesktop.org/mailman/listinfo/amd-gfx">https://lists.freedesktop.org/mailman/listinfo/amd-gfx</a><br>
</div>
</span></font></div>
</body>
</html>