<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:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p style="margin-top:0;margin-bottom:0"><span style="font-size: 12pt;">it looks fine for me, </span><br>
</p>
<div>please <a class="mention ms-bgc-nlr ms-fcl-b" id="OWAAM928179" href="mailto:Alexander.Deucher@amd.com">
@Deucher, Alexander</a> double check confirm.</div>
<div><br>
</div>
<div>Reviewed-by: Kevin Wang <kevin1.wang@amd.com></div>
<div><br>
</div>
<div>Best Regards,<br>
Kevin<br>
<br>
<div style="color: rgb(0, 0, 0);">
<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 Kenneth Feng <kenneth.feng@amd.com><br>
<b>Sent:</b> Tuesday, July 23, 2019 5:39 PM<br>
<b>To:</b> amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org><br>
<b>Cc:</b> Feng, Kenneth <Kenneth.Feng@amd.com><br>
<b>Subject:</b> [PATCH] drm/amd/powerplay: change smu_read_sensor sequence in smu</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">change the smu_read_sensor sequence to:<br>
<br>
asic specific sensor read -> smu v11 specific sensor read -> smu v11 common sensor read<br>
<br>
Signed-off-by: Kenneth Feng <kenneth.feng@amd.com><br>
---<br>
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 3 +++<br>
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h | 4 ++--<br>
drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 5 ++++-<br>
drivers/gpu/drm/amd/powerplay/smu_v11_0.c | 8 ++++----<br>
drivers/gpu/drm/amd/powerplay/vega20_ppt.c | 5 ++++-<br>
5 files changed, 17 insertions(+), 8 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c<br>
index 416f9a8..8ff18c8 100644<br>
--- a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c<br>
+++ b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c<br>
@@ -315,6 +315,9 @@ int smu_common_read_sensor(struct smu_context *smu, enum amd_pp_sensors sensor,<br>
{<br>
int ret = 0;<br>
<br>
+ if(!data || !size)<br>
+ return -EINVAL;<br>
+<br>
switch (sensor) {<br>
case AMDGPU_PP_SENSOR_STABLE_PSTATE_SCLK:<br>
*((uint32_t *)data) = smu->pstate_sclk;<br>
diff --git a/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h b/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h<br>
index b702c9e..fabb373 100644<br>
--- a/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h<br>
+++ b/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h<br>
@@ -819,9 +819,9 @@ struct smu_funcs<br>
#define smu_start_thermal_control(smu) \<br>
((smu)->funcs->start_thermal_control? (smu)->funcs->start_thermal_control((smu)) : 0)<br>
#define smu_read_sensor(smu, sensor, data, size) \<br>
- ((smu)->funcs->read_sensor? (smu)->funcs->read_sensor((smu), (sensor), (data), (size)) : 0)<br>
-#define smu_asic_read_sensor(smu, sensor, data, size) \<br>
((smu)->ppt_funcs->read_sensor? (smu)->ppt_funcs->read_sensor((smu), (sensor), (data), (size)) : 0)<br>
+#define smu_smc_read_sensor(smu, sensor, data, size) \<br>
+ ((smu)->funcs->read_sensor? (smu)->funcs->read_sensor((smu), (sensor), (data), (size)) : -EINVAL)<br>
#define smu_get_power_profile_mode(smu, buf) \<br>
((smu)->ppt_funcs->get_power_profile_mode ? (smu)->ppt_funcs->get_power_profile_mode((smu), buf) : 0)<br>
#define smu_set_power_profile_mode(smu, param, param_size) \<br>
diff --git a/drivers/gpu/drm/amd/powerplay/navi10_ppt.c b/drivers/gpu/drm/amd/powerplay/navi10_ppt.c<br>
index c8ce9bb..6409718 100644<br>
--- a/drivers/gpu/drm/amd/powerplay/navi10_ppt.c<br>
+++ b/drivers/gpu/drm/amd/powerplay/navi10_ppt.c<br>
@@ -1366,6 +1366,9 @@ static int navi10_read_sensor(struct smu_context *smu,<br>
struct smu_table_context *table_context = &smu->smu_table;<br>
PPTable_t *pptable = table_context->driver_pptable;<br>
<br>
+ if(!data || !size)<br>
+ return -EINVAL;<br>
+<br>
switch (sensor) {<br>
case AMDGPU_PP_SENSOR_MAX_FAN_RPM:<br>
*(uint32_t *)data = pptable->FanMaximumRpm;<br>
@@ -1387,7 +1390,7 @@ static int navi10_read_sensor(struct smu_context *smu,<br>
*size = 4;<br>
break;<br>
default:<br>
- return -EINVAL;<br>
+ ret = smu_smc_read_sensor(smu, sensor, data, size);<br>
}<br>
<br>
return ret;<br>
diff --git a/drivers/gpu/drm/amd/powerplay/smu_v11_0.c b/drivers/gpu/drm/amd/powerplay/smu_v11_0.c<br>
index e3a1784..5267b68 100644<br>
--- a/drivers/gpu/drm/amd/powerplay/smu_v11_0.c<br>
+++ b/drivers/gpu/drm/amd/powerplay/smu_v11_0.c<br>
@@ -1267,6 +1267,10 @@ static int smu_v11_0_read_sensor(struct smu_context *smu,<br>
void *data, uint32_t *size)<br>
{<br>
int ret = 0;<br>
+<br>
+ if(!data || !size)<br>
+ return -EINVAL;<br>
+<br>
switch (sensor) {<br>
case AMDGPU_PP_SENSOR_GFX_MCLK:<br>
ret = smu_get_current_clk_freq(smu, SMU_UCLK, (uint32_t *)data);<br>
@@ -1289,10 +1293,6 @@ static int smu_v11_0_read_sensor(struct smu_context *smu,<br>
break;<br>
}<br>
<br>
- /* try get sensor data by asic */<br>
- if (ret)<br>
- ret = smu_asic_read_sensor(smu, sensor, data, size);<br>
-<br>
if (ret)<br>
*size = 0;<br>
<br>
diff --git a/drivers/gpu/drm/amd/powerplay/vega20_ppt.c b/drivers/gpu/drm/amd/powerplay/vega20_ppt.c<br>
index 9ead361..e864a54 100644<br>
--- a/drivers/gpu/drm/amd/powerplay/vega20_ppt.c<br>
+++ b/drivers/gpu/drm/amd/powerplay/vega20_ppt.c<br>
@@ -3163,6 +3163,9 @@ static int vega20_read_sensor(struct smu_context *smu,<br>
struct smu_table_context *table_context = &smu->smu_table;<br>
PPTable_t *pptable = table_context->driver_pptable;<br>
<br>
+ if(!data || !size)<br>
+ return -EINVAL;<br>
+<br>
switch (sensor) {<br>
case AMDGPU_PP_SENSOR_MAX_FAN_RPM:<br>
*(uint32_t *)data = pptable->FanMaximumRpm;<br>
@@ -3186,7 +3189,7 @@ static int vega20_read_sensor(struct smu_context *smu,<br>
*size = 4;<br>
break;<br>
default:<br>
- return -EINVAL;<br>
+ ret = smu_smc_read_sensor(smu, sensor, data, size);<br>
}<br>
<br>
return ret;<br>
-- <br>
2.7.4<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="LPlnk308364" class="OWAAutoLink" previewremoved="true">https://lists.freedesktop.org/mailman/listinfo/amd-gfx</a></div>
<div id="LPBorder_GT_15638749518470.02267473158651634" style="margin-bottom: 20px; overflow: auto; width: 100%; text-indent: 0px;">
<table id="LPContainer_15638749518450.8626503153022167" role="presentation" cellspacing="0" style="width: 90%; background-color: rgb(255, 255, 255); position: relative; overflow: auto; padding-top: 20px; padding-bottom: 20px; margin-top: 20px; border-top: 1px dotted rgb(200, 200, 200); border-bottom: 1px dotted rgb(200, 200, 200);">
<tbody>
<tr valign="top" style="border-spacing: 0px;">
<td id="TextCell_15638749518460.7609342713450393" colspan="2" style="vertical-align: top; position: relative; padding: 0px; display: table-cell;">
<div id="LPRemovePreviewContainer_15638749518460.24310328073303422"></div>
<div id="LPTitle_15638749518460.7214757521911543" style="top: 0px; color: rgb(0, 120, 215); font-weight: 400; font-size: 21px; font-family: wf_segoe-ui_light, "Segoe UI Light", "Segoe WP Light", "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif; line-height: 21px;">
<a id="LPUrlAnchor_15638749518460.9823406329165418" href="https://lists.freedesktop.org/mailman/listinfo/amd-gfx" target="_blank" style="text-decoration: none;">amd-gfx Info Page - freedesktop.org</a></div>
<div id="LPMetadata_15638749518470.8057760659421027" style="margin: 10px 0px 16px; color: rgb(102, 102, 102); font-weight: 400; font-family: wf_segoe-ui_normal, "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif; font-size: 14px; line-height: 14px;">
lists.freedesktop.org</div>
<div id="LPDescription_15638749518470.6436677658830974" style="display: block; color: rgb(102, 102, 102); font-weight: 400; font-family: wf_segoe-ui_normal, "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif; font-size: 14px; line-height: 20px; max-height: 100px; overflow: hidden;">
To see the collection of prior postings to the list, visit the amd-gfx Archives.. Using amd-gfx: To post a message to all the list members, send email to amd-gfx@lists.freedesktop.org. You can subscribe to the list, or change your existing subscription, in
the sections below.</div>
</td>
</tr>
</tbody>
</table>
</div>
<br>
</span></font></div>
</div>
</div>
</div>
</body>
</html>