<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<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: rgb(0, 0, 0); font-family: Calibri, Helvetica, sans-serif, "EmojiFont", "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols;" dir="ltr">
<p style="margin-top:0;margin-bottom:0">Reviewed-by: Alex Deucher <alexander.deucher@amd.com><br>
</p>
<br>
<div style="color: rgb(0, 0, 0);">
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" face="Calibri, sans-serif" color="#000000"><b>From:</b> amd-gfx <amd-gfx-bounces@lists.freedesktop.org> on behalf of Rex Zhu <Rex.Zhu@amd.com><br>
<b>Sent:</b> Tuesday, March 6, 2018 9:56 PM<br>
<b>To:</b> amd-gfx@lists.freedesktop.org<br>
<b>Cc:</b> Zhu, Rex<br>
<b>Subject:</b> [PATCH] drm/amd/pp: Fix "Add auto power profilng switch based on workloads"</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">1. fix typo "<" should be "<<"<br>
2. fix code style<br>
3. fix uninitialized point *workload<br>
<br>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com><br>
<br>
Change-Id: I35d03d19360c75e8eb2021bd3db63e52c93e1e61<br>
---<br>
 drivers/gpu/drm/amd/powerplay/amd_powerplay.c      | 14 +++++++-------<br>
 drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c        | 10 +++++-----<br>
 drivers/gpu/drm/amd/powerplay/hwmgr/pp_psm.c       |  2 +-<br>
 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c   |  2 +-<br>
 drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c |  2 +-<br>
 5 files changed, 15 insertions(+), 15 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c<br>
index 84e65df..b989bf3 100644<br>
--- a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c<br>
+++ b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c<br>
@@ -1081,7 +1081,7 @@ static int pp_dpm_switch_power_profile(void *handle,<br>
 {<br>
         struct pp_hwmgr *hwmgr;<br>
         struct pp_instance *pp_handle = (struct pp_instance *)handle;<br>
-       long *workload;<br>
+       long workload;<br>
         uint32_t index;<br>
 <br>
         if (pp_check(pp_handle))<br>
@@ -1100,19 +1100,19 @@ static int pp_dpm_switch_power_profile(void *handle,<br>
         mutex_lock(&pp_handle->pp_lock);<br>
 <br>
         if (!en) {<br>
-               hwmgr->workload_mask &= ~(1 < hwmgr->workload_prority[type]);<br>
+               hwmgr->workload_mask &= ~(1 << hwmgr->workload_prority[type]);<br>
                 index = fls(hwmgr->workload_mask);<br>
-               index = index > 0 && index <= Workload_Policy_Max? index - 1 : 0;<br>
-               *workload = hwmgr->workload_setting[index];<br>
+               index = index > 0 && index <= Workload_Policy_Max ? index - 1 : 0;<br>
+               workload = hwmgr->workload_setting[index];<br>
         } else {<br>
-               hwmgr->workload_mask |= (1 < hwmgr->workload_prority[type]);<br>
+               hwmgr->workload_mask |= (1 << hwmgr->workload_prority[type]);<br>
                 index = fls(hwmgr->workload_mask);<br>
                 index = index <= Workload_Policy_Max ? index - 1 : 0;<br>
-               *workload = hwmgr->workload_setting[index];<br>
+               workload = hwmgr->workload_setting[index];<br>
         }<br>
 <br>
         if (hwmgr->dpm_level != AMD_DPM_FORCED_LEVEL_MANUAL)<br>
-               hwmgr->hwmgr_func->set_power_profile_mode(hwmgr, workload, 0);<br>
+               hwmgr->hwmgr_func->set_power_profile_mode(hwmgr, &workload, 0);<br>
         mutex_unlock(&pp_handle->pp_lock);<br>
 <br>
         return 0;<br>
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c<br>
index aa83114..af1b22d 100644<br>
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c<br>
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c<br>
@@ -133,11 +133,11 @@ static void hwmgr_init_workload_prority(struct pp_hwmgr *hwmgr)<br>
         hwmgr->workload_prority[PP_SMC_POWER_PROFILE_VR] = 3;<br>
         hwmgr->workload_prority[PP_SMC_POWER_PROFILE_COMPUTE] = 4;<br>
 <br>
-       hwmgr->workload_setting[0]= PP_SMC_POWER_PROFILE_POWERSAVING;<br>
-       hwmgr->workload_setting[1]= PP_SMC_POWER_PROFILE_VIDEO;<br>
-       hwmgr->workload_setting[2]= PP_SMC_POWER_PROFILE_FULLSCREEN3D;<br>
-       hwmgr->workload_setting[3]= PP_SMC_POWER_PROFILE_VR;<br>
-       hwmgr->workload_setting[4]= PP_SMC_POWER_PROFILE_COMPUTE;<br>
+       hwmgr->workload_setting[0] = PP_SMC_POWER_PROFILE_POWERSAVING;<br>
+       hwmgr->workload_setting[1] = PP_SMC_POWER_PROFILE_VIDEO;<br>
+       hwmgr->workload_setting[2] = PP_SMC_POWER_PROFILE_FULLSCREEN3D;<br>
+       hwmgr->workload_setting[3] = PP_SMC_POWER_PROFILE_VR;<br>
+       hwmgr->workload_setting[4] = PP_SMC_POWER_PROFILE_COMPUTE;<br>
 }<br>
 <br>
 int hwmgr_early_init(struct pp_instance *handle)<br>
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/pp_psm.c b/drivers/gpu/drm/amd/powerplay/hwmgr/pp_psm.c<br>
index 51439a1..d0ef8f9 100644<br>
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/pp_psm.c<br>
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/pp_psm.c<br>
@@ -251,7 +251,7 @@ int psm_adjust_power_state_dynamic(struct pp_hwmgr *hwmgr, bool skip,<br>
 <br>
         if (hwmgr->dpm_level != AMD_DPM_FORCED_LEVEL_MANUAL) {<br>
                 index = fls(hwmgr->workload_mask);<br>
-               index = index > 0 && index <= Workload_Policy_Max? index - 1 : 0;<br>
+               index = index > 0 && index <= Workload_Policy_Max ? index - 1 : 0;<br>
                 workload = hwmgr->workload_setting[index];<br>
 <br>
                 if (hwmgr->power_profile_mode != workload && hwmgr->hwmgr_func->set_power_profile_mode)<br>
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c<br>
index 4f26014..d4d1d2e 100644<br>
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c<br>
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c<br>
@@ -1510,7 +1510,7 @@ static void smu7_init_dpm_defaults(struct pp_hwmgr *hwmgr)<br>
         data->current_profile_setting.mclk_up_hyst = 0;<br>
         data->current_profile_setting.mclk_down_hyst = 100;<br>
         data->current_profile_setting.mclk_activity = SMU7_MCLK_TARGETACTIVITY_DFLT;<br>
-       hwmgr->workload_mask = 1 < hwmgr->workload_prority[PP_SMC_POWER_PROFILE_FULLSCREEN3D];<br>
+       hwmgr->workload_mask = 1 << hwmgr->workload_prority[PP_SMC_POWER_PROFILE_FULLSCREEN3D];<br>
         hwmgr->power_profile_mode = PP_SMC_POWER_PROFILE_FULLSCREEN3D;<br>
         hwmgr->default_power_profile_mode = PP_SMC_POWER_PROFILE_FULLSCREEN3D;<br>
 <br>
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c<br>
index 25165b4..f23861f 100644<br>
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c<br>
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c<br>
@@ -766,7 +766,7 @@ static int vega10_hwmgr_backend_init(struct pp_hwmgr *hwmgr)<br>
 <br>
         hwmgr->backend = data;<br>
 <br>
-       hwmgr->workload_mask = 1 < hwmgr->workload_prority[PP_SMC_POWER_PROFILE_VIDEO];<br>
+       hwmgr->workload_mask = 1 << hwmgr->workload_prority[PP_SMC_POWER_PROFILE_VIDEO];<br>
         hwmgr->power_profile_mode = PP_SMC_POWER_PROFILE_VIDEO;<br>
         hwmgr->default_power_profile_mode = PP_SMC_POWER_PROFILE_VIDEO;<br>
 <br>
-- <br>
1.9.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" id="LPlnk623810" previewremoved="true">https://lists.freedesktop.org/mailman/listinfo/amd-gfx</a><br>
</div>
</span></font></div>
</div>
</div>
</body>
</html>