<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<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"><span>Reviewed-by: Evan Quan <evan.quan@amd.com></span><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>发件人:</b> amd-gfx <amd-gfx-bounces@lists.freedesktop.org> 代表 Deucher, Alexander <Alexander.Deucher@amd.com><br>
<b>发送时间:</b> 2018年5月8日 5:32:06<br>
<b>收件人:</b> Zhu, Rex; amd-gfx@lists.freedesktop.org<br>
<b>主题:</b> Re: [PATCH] drm/amd/pp: Refine the output of pp_power_profile_mode on VI</font>
<div> </div>
</div>
<meta content="text/html; charset=Windows-1252">
<style type="text/css" style="display:none">
<!--
p
        {margin-top:0;
        margin-bottom:0}
-->
</style>
<div dir="ltr">
<div id="x_divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:#000000; font-family:Calibri,Helvetica,sans-serif">
<p style="margin-top:0; margin-bottom:0">Acked-by: Alex Deucher <alexander.deucher@amd.com><br>
</p>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="x_divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> amd-gfx <amd-gfx-bounces@lists.freedesktop.org> on behalf of Rex Zhu <Rex.Zhu@amd.com><br>
<b>Sent:</b> Monday, May 7, 2018 2:37:42 AM<br>
<b>To:</b> amd-gfx@lists.freedesktop.org<br>
<b>Cc:</b> Zhu, Rex<br>
<b>Subject:</b> [PATCH] drm/amd/pp: Refine the output of pp_power_profile_mode on VI</font>
<div> </div>
</div>
<div class="x_BodyFragment"><font size="2"><span style="font-size:11pt">
<div class="x_PlainText">In order to keep consist with Vega,<br>
the output format of the pp_power_profile_mode would be<br>
<integer>  <mode name string>< “*” if this is the current profile>:"detail settings"<br>
and remove the "CURRENT" mode line.<br>
<br>
for example:<br>
NUM        MODE_NAME     SCLK_UP_HYST   SCLK_DOWN_HYST SCLK_ACTIVE_LEVEL     MCLK_UP_HYST   MCLK_DOWN_HYST MCLK_ACTIVE_LEVEL<br>
  0   3D_FULL_SCREEN:        0              100               30                0              100               10<br>
  1     POWER_SAVING:       10                0               30                -                -                -<br>
  2            VIDEO:        -                -                -               10               16               31<br>
  3               VR:        0               11               50                0              100               10<br>
  4          COMPUTE:        0                5               30                -                -                -<br>
  5         CUSTOM *:        0                5               30                0              100               10<br>
NUM        MODE_NAME     SCLK_UP_HYST   SCLK_DOWN_HYST SCLK_ACTIVE_LEVEL     MCLK_UP_HYST   MCLK_DOWN_HYST MCLK_ACTIVE_LEVEL<br>
  0   3D_FULL_SCREEN:        0              100               30                0              100               10<br>
  1   POWER_SAVING *:       10                0               30                0              100               10<br>
  2            VIDEO:        -                -                -               10               16               31<br>
  3               VR:        0               11               50                0              100               10<br>
  4          COMPUTE:        0                5               30                -                -                -<br>
  5           CUSTOM:        -                -                -                -                -                -<br>
<br>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com><br>
---<br>
 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c | 52 +++++++++++-------------<br>
 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.h |  1 -<br>
 2 files changed, 23 insertions(+), 30 deletions(-)<br>
<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 4c94e7a..39e49ce 100644<br>
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c<br>
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c<br>
@@ -75,12 +75,13 @@<br>
 #define PCIE_BUS_CLK                10000<br>
 #define TCLK                        (PCIE_BUS_CLK / 10)<br>
 <br>
-static const struct profile_mode_setting smu7_profiling[5] =<br>
+static const struct profile_mode_setting smu7_profiling[6] =<br>
                                         {{1, 0, 100, 30, 1, 0, 100, 10},<br>
                                          {1, 10, 0, 30, 0, 0, 0, 0},<br>
                                          {0, 0, 0, 0, 1, 10, 16, 31},<br>
                                          {1, 0, 11, 50, 1, 0, 100, 10},<br>
                                          {1, 0, 5, 30, 0, 0, 0, 0},<br>
+                                        {0, 0, 0, 0, 0, 0, 0, 0},<br>
                                         };<br>
 <br>
 #define PPSMC_MSG_SetVBITimeout_VEGAM    ((uint16_t) 0x310)<br>
@@ -4882,6 +4883,17 @@ static int smu7_get_power_profile_mode(struct pp_hwmgr *hwmgr, char *buf)<br>
         len = sizeof(smu7_profiling) / sizeof(struct profile_mode_setting);<br>
 <br>
         for (i = 0; i < len; i++) {<br>
+               if (i == hwmgr->power_profile_mode) {<br>
+                       size += sprintf(buf + size, "%3d %14s %s: %8d %16d %16d %16d %16d %16d\n",<br>
+                       i, profile_name[i], "*",<br>
+                       data->current_profile_setting.sclk_up_hyst,<br>
+                       data->current_profile_setting.sclk_down_hyst,<br>
+                       data->current_profile_setting.sclk_activity,<br>
+                       data->current_profile_setting.mclk_up_hyst,<br>
+                       data->current_profile_setting.mclk_down_hyst,<br>
+                       data->current_profile_setting.mclk_activity);<br>
+                       continue;<br>
+               }<br>
                 if (smu7_profiling[i].bupdate_sclk)<br>
                         size += sprintf(buf + size, "%3d %16s: %8d %16d %16d ",<br>
                         i, profile_name[i], smu7_profiling[i].sclk_up_hyst,<br>
@@ -4901,24 +4913,6 @@ static int smu7_get_power_profile_mode(struct pp_hwmgr *hwmgr, char *buf)<br>
                         "-", "-", "-");<br>
         }<br>
 <br>
-       size += sprintf(buf + size, "%3d %16s: %8d %16d %16d %16d %16d %16d\n",<br>
-                       i, profile_name[i],<br>
-                       data->custom_profile_setting.sclk_up_hyst,<br>
-                       data->custom_profile_setting.sclk_down_hyst,<br>
-                       data->custom_profile_setting.sclk_activity,<br>
-                       data->custom_profile_setting.mclk_up_hyst,<br>
-                       data->custom_profile_setting.mclk_down_hyst,<br>
-                       data->custom_profile_setting.mclk_activity);<br>
-<br>
-       size += sprintf(buf + size, "%3s %16s: %8d %16d %16d %16d %16d %16d\n",<br>
-                       "*", "CURRENT",<br>
-                       data->current_profile_setting.sclk_up_hyst,<br>
-                       data->current_profile_setting.sclk_down_hyst,<br>
-                       data->current_profile_setting.sclk_activity,<br>
-                       data->current_profile_setting.mclk_up_hyst,<br>
-                       data->current_profile_setting.mclk_down_hyst,<br>
-                       data->current_profile_setting.mclk_activity);<br>
-<br>
         return size;<br>
 }<br>
 <br>
@@ -4957,16 +4951,16 @@ static int smu7_set_power_profile_mode(struct pp_hwmgr *hwmgr, long *input, uint<br>
                 if (size < 8)<br>
                         return -EINVAL;<br>
 <br>
-               data->custom_profile_setting.bupdate_sclk = input[0];<br>
-               data->custom_profile_setting.sclk_up_hyst = input[1];<br>
-               data->custom_profile_setting.sclk_down_hyst = input[2];<br>
-               data->custom_profile_setting.sclk_activity = input[3];<br>
-               data->custom_profile_setting.bupdate_mclk = input[4];<br>
-               data->custom_profile_setting.mclk_up_hyst = input[5];<br>
-               data->custom_profile_setting.mclk_down_hyst = input[6];<br>
-               data->custom_profile_setting.mclk_activity = input[7];<br>
-               if (!smum_update_dpm_settings(hwmgr, &data->custom_profile_setting)) {<br>
-                       memcpy(&data->current_profile_setting, &data->custom_profile_setting, sizeof(struct profile_mode_setting));<br>
+               tmp.bupdate_sclk = input[0];<br>
+               tmp.sclk_up_hyst = input[1];<br>
+               tmp.sclk_down_hyst = input[2];<br>
+               tmp.sclk_activity = input[3];<br>
+               tmp.bupdate_mclk = input[4];<br>
+               tmp.mclk_up_hyst = input[5];<br>
+               tmp.mclk_down_hyst = input[6];<br>
+               tmp.mclk_activity = input[7];<br>
+               if (!smum_update_dpm_settings(hwmgr, &tmp)) {<br>
+                       memcpy(&data->current_profile_setting, &tmp, sizeof(struct profile_mode_setting));<br>
                         hwmgr->power_profile_mode = mode;<br>
                 }<br>
                 break;<br>
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.h b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.h<br>
index 51a776e..c91e75d 100644<br>
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.h<br>
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.h<br>
@@ -327,7 +327,6 @@ struct smu7_hwmgr {<br>
         uint16_t                              mem_latency_high;<br>
         uint16_t                              mem_latency_low;<br>
         uint32_t                              vr_config;<br>
-       struct profile_mode_setting           custom_profile_setting;<br>
         struct profile_mode_setting           current_profile_setting;<br>
 };<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">https://lists.freedesktop.org/mailman/listinfo/amd-gfx</a><br>
</div>
</span></font></div>
</div>
</body>
</html>