<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 Wang, Kevin(Yang) <Kevin1.Wang@amd.com><br>
<b>Sent:</b> Friday, July 19, 2019 8:17 AM<br>
<b>To:</b> amd-gfx@lists.freedesktop.org<br>
<b>Cc:</b> Wang, Kevin(Yang); Huang, Ray; Feng, Kenneth; Quan, Evan<br>
<b>Subject:</b> [PATCH] drm/amd/powerplay: refine AMDGPU_PP_SENSOR_XXX index for powerplay</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">for patch:<br>
drm/amd/powerplay: expose current hotspot and memory temperatures V2<br>
<br>
this patch will add some new sensor type to enum amd_pp_sensors,<br>
we should add these types to tail to be compatible with the sensor in<br>
effect.<br>
<br>
eg: some application will use old amd_pp_sensors type, likes umr.<br>
the umr will use sensor index to get specific sensor value by sysfs<br>
of "/sys/kernel/debug/dri/0/amdgpu_sensors", the old change will cause<br>
the umr can't get correct value, it should be update sensor index by<br>
this header for itself.<br>
<br>
Signed-off-by: Kevin Wang <kevin1.wang@amd.com><br>
---<br>
drivers/gpu/drm/amd/amdgpu/si_dpm.c | 1 +<br>
drivers/gpu/drm/amd/include/kgd_pp_interface.h | 6 +++---<br>
drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c | 1 +<br>
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c | 1 +<br>
drivers/gpu/drm/amd/powerplay/hwmgr/smu8_hwmgr.c | 1 +<br>
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c | 1 +<br>
drivers/gpu/drm/amd/powerplay/hwmgr/vega12_hwmgr.c | 1 +<br>
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c | 1 +<br>
drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 2 ++<br>
drivers/gpu/drm/amd/powerplay/vega20_ppt.c | 2 ++<br>
10 files changed, 14 insertions(+), 3 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/si_dpm.c b/drivers/gpu/drm/amd/amdgpu/si_dpm.c<br>
index d57e75e5c71f..9f120333dc71 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/si_dpm.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/si_dpm.c<br>
@@ -8012,6 +8012,7 @@ static int si_dpm_read_sensor(void *handle, int idx,<br>
}<br>
return -EINVAL;<br>
case AMDGPU_PP_SENSOR_GPU_TEMP:<br>
+ case AMDGPU_PP_SENSOR_EDGE_TEMP:<br>
*((uint32_t *)value) = si_dpm_get_temp(adev);<br>
*size = 4;<br>
return 0;<br>
diff --git a/drivers/gpu/drm/amd/include/kgd_pp_interface.h b/drivers/gpu/drm/amd/include/kgd_pp_interface.h<br>
index 9733bbf9bc72..af71da7d9896 100644<br>
--- a/drivers/gpu/drm/amd/include/kgd_pp_interface.h<br>
+++ b/drivers/gpu/drm/amd/include/kgd_pp_interface.h<br>
@@ -112,9 +112,6 @@ enum amd_pp_sensors {<br>
AMDGPU_PP_SENSOR_MEM_LOAD,<br>
AMDGPU_PP_SENSOR_GFX_MCLK,<br>
AMDGPU_PP_SENSOR_GPU_TEMP,<br>
- AMDGPU_PP_SENSOR_EDGE_TEMP = AMDGPU_PP_SENSOR_GPU_TEMP,<br>
- AMDGPU_PP_SENSOR_HOTSPOT_TEMP,<br>
- AMDGPU_PP_SENSOR_MEM_TEMP,<br>
AMDGPU_PP_SENSOR_VCE_POWER,<br>
AMDGPU_PP_SENSOR_UVD_POWER,<br>
AMDGPU_PP_SENSOR_GPU_POWER,<br>
@@ -123,6 +120,9 @@ enum amd_pp_sensors {<br>
AMDGPU_PP_SENSOR_ENABLED_SMC_FEATURES_MASK,<br>
AMDGPU_PP_SENSOR_MIN_FAN_RPM,<br>
AMDGPU_PP_SENSOR_MAX_FAN_RPM,<br>
+ AMDGPU_PP_SENSOR_EDGE_TEMP,<br>
+ AMDGPU_PP_SENSOR_HOTSPOT_TEMP,<br>
+ AMDGPU_PP_SENSOR_MEM_TEMP,<br>
};<br>
<br>
enum amd_pp_task {<br>
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c<br>
index e32ae9d3373c..c6d8b399cc80 100644<br>
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c<br>
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c<br>
@@ -1130,6 +1130,7 @@ static int smu10_read_sensor(struct pp_hwmgr *hwmgr, int idx,<br>
*size = 4;<br>
break;<br>
case AMDGPU_PP_SENSOR_GPU_TEMP:<br>
+ case AMDGPU_PP_SENSOR_EDGE_TEMP:<br>
*((uint32_t *)value) = smu10_thermal_get_temperature(hwmgr);<br>
break;<br>
default:<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 10d66e3c7a9f..1195f86f86af 100644<br>
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c<br>
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c<br>
@@ -3546,6 +3546,7 @@ static int smu7_read_sensor(struct pp_hwmgr *hwmgr, int idx,<br>
*size = 4;<br>
return 0;<br>
case AMDGPU_PP_SENSOR_GPU_TEMP:<br>
+ case AMDGPU_PP_SENSOR_EDGE_TEMP:<br>
*((uint32_t *)value) = smu7_thermal_get_temperature(hwmgr);<br>
*size = 4;<br>
return 0;<br>
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/smu8_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/smu8_hwmgr.c<br>
index 019d6a206492..b2fc57dfb467 100644<br>
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/smu8_hwmgr.c<br>
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/smu8_hwmgr.c<br>
@@ -1769,6 +1769,7 @@ static int smu8_read_sensor(struct pp_hwmgr *hwmgr, int idx,<br>
*((uint32_t *)value) = data->vce_power_gated ? 0 : 1;<br>
return 0;<br>
case AMDGPU_PP_SENSOR_GPU_TEMP:<br>
+ case AMDGPU_PP_SENSOR_EDGE_TEMP:<br>
*((uint32_t *)value) = smu8_thermal_get_temperature(hwmgr);<br>
return 0;<br>
default:<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 1d9bb29adaef..a309aeed53ab 100644<br>
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c<br>
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c<br>
@@ -3794,6 +3794,7 @@ static int vega10_read_sensor(struct pp_hwmgr *hwmgr, int idx,<br>
*size = 4;<br>
break;<br>
case AMDGPU_PP_SENSOR_GPU_TEMP:<br>
+ case AMDGPU_PP_SENSOR_EDGE_TEMP:<br>
*((uint32_t *)value) = vega10_thermal_get_temperature(hwmgr);<br>
*size = 4;<br>
break;<br>
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega12_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/vega12_hwmgr.c<br>
index efb6d3762feb..69d1255db091 100644<br>
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega12_hwmgr.c<br>
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega12_hwmgr.c<br>
@@ -1368,6 +1368,7 @@ static int vega12_read_sensor(struct pp_hwmgr *hwmgr, int idx,<br>
*size = 4;<br>
break;<br>
case AMDGPU_PP_SENSOR_GPU_TEMP:<br>
+ case AMDGPU_PP_SENSOR_EDGE_TEMP:<br>
*((uint32_t *)value) = vega12_thermal_get_temperature(hwmgr);<br>
*size = 4;<br>
break;<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 f27c6fbb192e..172321f44940 100644<br>
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c<br>
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c<br>
@@ -2185,6 +2185,7 @@ static int vega20_read_sensor(struct pp_hwmgr *hwmgr, int idx,<br>
*((uint32_t *)value) = vega20_thermal_get_temperature(hwmgr);<br>
*size = 4;<br>
break;<br>
+ case AMDGPU_PP_SENSOR_GPU_TEMP:<br>
case AMDGPU_PP_SENSOR_EDGE_TEMP:<br>
ret = vega20_get_metrics_table(hwmgr, &metrics_table);<br>
if (ret)<br>
diff --git a/drivers/gpu/drm/amd/powerplay/navi10_ppt.c b/drivers/gpu/drm/amd/powerplay/navi10_ppt.c<br>
index 0a53695785b6..35e5aa152ee1 100644<br>
--- a/drivers/gpu/drm/amd/powerplay/navi10_ppt.c<br>
+++ b/drivers/gpu/drm/amd/powerplay/navi10_ppt.c<br>
@@ -1341,6 +1341,7 @@ static int navi10_thermal_get_temperature(struct smu_context *smu,<br>
*value = metrics.TemperatureHotspot *<br>
SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;<br>
break;<br>
+ case AMDGPU_PP_SENSOR_GPU_TEMP:<br>
case AMDGPU_PP_SENSOR_EDGE_TEMP:<br>
*value = metrics.TemperatureEdge *<br>
SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;<br>
@@ -1384,6 +1385,7 @@ static int navi10_read_sensor(struct smu_context *smu,<br>
break;<br>
case AMDGPU_PP_SENSOR_HOTSPOT_TEMP:<br>
case AMDGPU_PP_SENSOR_EDGE_TEMP:<br>
+ case AMDGPU_PP_SENSOR_GPU_TEMP:<br>
case AMDGPU_PP_SENSOR_MEM_TEMP:<br>
ret = navi10_thermal_get_temperature(smu, sensor, (uint32_t *)data);<br>
*size = 4;<br>
diff --git a/drivers/gpu/drm/amd/powerplay/vega20_ppt.c b/drivers/gpu/drm/amd/powerplay/vega20_ppt.c<br>
index b44ec7c670c5..55996f3a1883 100644<br>
--- a/drivers/gpu/drm/amd/powerplay/vega20_ppt.c<br>
+++ b/drivers/gpu/drm/amd/powerplay/vega20_ppt.c<br>
@@ -3123,6 +3123,7 @@ static int vega20_thermal_get_temperature(struct smu_context *smu,<br>
<br>
*value = temp;<br>
break;<br>
+ case AMDGPU_PP_SENSOR_GPU_TEMP:<br>
case AMDGPU_PP_SENSOR_EDGE_TEMP:<br>
*value = metrics.TemperatureEdge *<br>
SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;<br>
@@ -3166,6 +3167,7 @@ static int vega20_read_sensor(struct smu_context *smu,<br>
*size = 4;<br>
break;<br>
case AMDGPU_PP_SENSOR_HOTSPOT_TEMP:<br>
+ case AMDGPU_PP_SENSOR_GPU_TEMP:<br>
case AMDGPU_PP_SENSOR_EDGE_TEMP:<br>
case AMDGPU_PP_SENSOR_MEM_TEMP:<br>
ret = vega20_thermal_get_temperature(smu, sensor, (uint32_t *)data);<br>
-- <br>
2.22.0<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>