<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 style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Reviewed-by: Alex Deucher <alexander.deucher@amd.com><br>
</div>
<div id="appendonsend"></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 Russell, Kent <Kent.Russell@amd.com><br>
<b>Sent:</b> Friday, August 23, 2019 9:37 AM<br>
<b>To:</b> amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org><br>
<b>Cc:</b> Russell, Kent <Kent.Russell@amd.com><br>
<b>Subject:</b> [PATCH] drm/powerplay: Fix Vega20 power reading again</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">For the 40.46 SMU release, they changed CurrSocketPower to<br>
AverageSocketPower, but this was changed back in 40.47 so just check if<br>
it's 40.46 and make the appropriate change<br>
<br>
Tested with 40.45, 40.46 and 40.47 successfully<br>
<br>
Change-Id: Icbbe6fd3381b8ad6298c2d0852a726ffac98f93a<br>
Signed-off-by: Kent Russell <kent.russell@amd.com><br>
---<br>
 drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c | 7 ++++---<br>
 drivers/gpu/drm/amd/powerplay/vega20_ppt.c         | 7 ++++---<br>
 2 files changed, 8 insertions(+), 6 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c<br>
index 9f50a12f5c03..98a6f5305974 100644<br>
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c<br>
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c<br>
@@ -2101,10 +2101,11 @@ static int vega20_get_gpu_power(struct pp_hwmgr *hwmgr,<br>
         if (ret)<br>
                 return ret;<br>
 <br>
-       if (hwmgr->smu_version < 0x282e00)<br>
-               *query = metrics_table.CurrSocketPower << 8;<br>
-       else<br>
+       /* For the 40.46 release, they changed the value name */<br>
+       if (hwmgr->smu_version == 0x282e00)<br>
                 *query = metrics_table.AverageSocketPower << 8;<br>
+       else<br>
+               *query = metrics_table.CurrSocketPower << 8;<br>
 <br>
         return ret;<br>
 }<br>
diff --git a/drivers/gpu/drm/amd/powerplay/vega20_ppt.c b/drivers/gpu/drm/amd/powerplay/vega20_ppt.c<br>
index 0fac824490d7..899bf96b23e1 100644<br>
--- a/drivers/gpu/drm/amd/powerplay/vega20_ppt.c<br>
+++ b/drivers/gpu/drm/amd/powerplay/vega20_ppt.c<br>
@@ -2932,10 +2932,11 @@ static int vega20_get_gpu_power(struct smu_context *smu, uint32_t *value)<br>
         if (ret)<br>
                 return ret;<br>
 <br>
-       if (smu_version < 0x282e00)<br>
-               *value = metrics.CurrSocketPower << 8;<br>
-       else<br>
+       /* For the 40.46 release, they changed the value name */<br>
+       if (smu_version == 0x282e00)<br>
                 *value = metrics.AverageSocketPower << 8;<br>
+       else<br>
+               *value = metrics.CurrSocketPower << 8;<br>
 <br>
         return 0;<br>
 }<br>
-- <br>
2.17.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></div>
</span></font></div>
</body>
</html>