Re: [PATCH] drm/amd/powerplay: refine AMDGPU_PP_SENSOR_XXX index for powerplay

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Reviewed-by: Alex Deucher <alexander.deucher@xxxxxxx>

From: amd-gfx <amd-gfx-bounces@xxxxxxxxxxxxxxxxxxxxx> on behalf of Wang, Kevin(Yang) <Kevin1.Wang@xxxxxxx>
Sent: Friday, July 19, 2019 8:17 AM
To: amd-gfx@xxxxxxxxxxxxxxxxxxxxx
Cc: Wang, Kevin(Yang); Huang, Ray; Feng, Kenneth; Quan, Evan
Subject: [PATCH] drm/amd/powerplay: refine AMDGPU_PP_SENSOR_XXX index for powerplay
 
for patch:
drm/amd/powerplay: expose current hotspot and memory temperatures V2

this patch will add some new sensor type to enum amd_pp_sensors,
we should add these types to tail to be compatible with the sensor in
effect.

eg: some application will use old amd_pp_sensors type, likes umr.
the umr will use sensor index to get specific sensor value by sysfs
of "/sys/kernel/debug/dri/0/amdgpu_sensors", the old change will cause
the umr can't get correct value, it should be update sensor index by
this header for itself.

Signed-off-by: Kevin Wang <kevin1.wang@xxxxxxx>
---
 drivers/gpu/drm/amd/amdgpu/si_dpm.c                | 1 +
 drivers/gpu/drm/amd/include/kgd_pp_interface.h     | 6 +++---
 drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c  | 1 +
 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c   | 1 +
 drivers/gpu/drm/amd/powerplay/hwmgr/smu8_hwmgr.c   | 1 +
 drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c | 1 +
 drivers/gpu/drm/amd/powerplay/hwmgr/vega12_hwmgr.c | 1 +
 drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c | 1 +
 drivers/gpu/drm/amd/powerplay/navi10_ppt.c         | 2 ++
 drivers/gpu/drm/amd/powerplay/vega20_ppt.c         | 2 ++
 10 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/si_dpm.c b/drivers/gpu/drm/amd/amdgpu/si_dpm.c
index d57e75e5c71f..9f120333dc71 100644
--- a/drivers/gpu/drm/amd/amdgpu/si_dpm.c
+++ b/drivers/gpu/drm/amd/amdgpu/si_dpm.c
@@ -8012,6 +8012,7 @@ static int si_dpm_read_sensor(void *handle, int idx,
                 }
                 return -EINVAL;
         case AMDGPU_PP_SENSOR_GPU_TEMP:
+       case AMDGPU_PP_SENSOR_EDGE_TEMP:
                 *((uint32_t *)value) = si_dpm_get_temp(adev);
                 *size = 4;
                 return 0;
diff --git a/drivers/gpu/drm/amd/include/kgd_pp_interface.h b/drivers/gpu/drm/amd/include/kgd_pp_interface.h
index 9733bbf9bc72..af71da7d9896 100644
--- a/drivers/gpu/drm/amd/include/kgd_pp_interface.h
+++ b/drivers/gpu/drm/amd/include/kgd_pp_interface.h
@@ -112,9 +112,6 @@ enum amd_pp_sensors {
         AMDGPU_PP_SENSOR_MEM_LOAD,
         AMDGPU_PP_SENSOR_GFX_MCLK,
         AMDGPU_PP_SENSOR_GPU_TEMP,
-       AMDGPU_PP_SENSOR_EDGE_TEMP = AMDGPU_PP_SENSOR_GPU_TEMP,
-       AMDGPU_PP_SENSOR_HOTSPOT_TEMP,
-       AMDGPU_PP_SENSOR_MEM_TEMP,
         AMDGPU_PP_SENSOR_VCE_POWER,
         AMDGPU_PP_SENSOR_UVD_POWER,
         AMDGPU_PP_SENSOR_GPU_POWER,
@@ -123,6 +120,9 @@ enum amd_pp_sensors {
         AMDGPU_PP_SENSOR_ENABLED_SMC_FEATURES_MASK,
         AMDGPU_PP_SENSOR_MIN_FAN_RPM,
         AMDGPU_PP_SENSOR_MAX_FAN_RPM,
+       AMDGPU_PP_SENSOR_EDGE_TEMP,
+       AMDGPU_PP_SENSOR_HOTSPOT_TEMP,
+       AMDGPU_PP_SENSOR_MEM_TEMP,
 };
 
 enum amd_pp_task {
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c
index e32ae9d3373c..c6d8b399cc80 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c
@@ -1130,6 +1130,7 @@ static int smu10_read_sensor(struct pp_hwmgr *hwmgr, int idx,
                 *size = 4;
                 break;
         case AMDGPU_PP_SENSOR_GPU_TEMP:
+       case AMDGPU_PP_SENSOR_EDGE_TEMP:
                 *((uint32_t *)value) = smu10_thermal_get_temperature(hwmgr);
                 break;
         default:
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c
index 10d66e3c7a9f..1195f86f86af 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c
@@ -3546,6 +3546,7 @@ static int smu7_read_sensor(struct pp_hwmgr *hwmgr, int idx,
                 *size = 4;
                 return 0;
         case AMDGPU_PP_SENSOR_GPU_TEMP:
+       case AMDGPU_PP_SENSOR_EDGE_TEMP:
                 *((uint32_t *)value) = smu7_thermal_get_temperature(hwmgr);
                 *size = 4;
                 return 0;
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/smu8_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/smu8_hwmgr.c
index 019d6a206492..b2fc57dfb467 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/smu8_hwmgr.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/smu8_hwmgr.c
@@ -1769,6 +1769,7 @@ static int smu8_read_sensor(struct pp_hwmgr *hwmgr, int idx,
                 *((uint32_t *)value) = data->vce_power_gated ? 0 : 1;
                 return 0;
         case AMDGPU_PP_SENSOR_GPU_TEMP:
+       case AMDGPU_PP_SENSOR_EDGE_TEMP:
                 *((uint32_t *)value) = smu8_thermal_get_temperature(hwmgr);
                 return 0;
         default:
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c
index 1d9bb29adaef..a309aeed53ab 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c
@@ -3794,6 +3794,7 @@ static int vega10_read_sensor(struct pp_hwmgr *hwmgr, int idx,
                 *size = 4;
                 break;
         case AMDGPU_PP_SENSOR_GPU_TEMP:
+       case AMDGPU_PP_SENSOR_EDGE_TEMP:
                 *((uint32_t *)value) = vega10_thermal_get_temperature(hwmgr);
                 *size = 4;
                 break;
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega12_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/vega12_hwmgr.c
index efb6d3762feb..69d1255db091 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega12_hwmgr.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega12_hwmgr.c
@@ -1368,6 +1368,7 @@ static int vega12_read_sensor(struct pp_hwmgr *hwmgr, int idx,
                         *size = 4;
                 break;
         case AMDGPU_PP_SENSOR_GPU_TEMP:
+       case AMDGPU_PP_SENSOR_EDGE_TEMP:
                 *((uint32_t *)value) = vega12_thermal_get_temperature(hwmgr);
                 *size = 4;
                 break;
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c
index f27c6fbb192e..172321f44940 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c
@@ -2185,6 +2185,7 @@ static int vega20_read_sensor(struct pp_hwmgr *hwmgr, int idx,
                 *((uint32_t *)value) = vega20_thermal_get_temperature(hwmgr);
                 *size = 4;
                 break;
+       case AMDGPU_PP_SENSOR_GPU_TEMP:
         case AMDGPU_PP_SENSOR_EDGE_TEMP:
                 ret = vega20_get_metrics_table(hwmgr, &metrics_table);
                 if (ret)
diff --git a/drivers/gpu/drm/amd/powerplay/navi10_ppt.c b/drivers/gpu/drm/amd/powerplay/navi10_ppt.c
index 0a53695785b6..35e5aa152ee1 100644
--- a/drivers/gpu/drm/amd/powerplay/navi10_ppt.c
+++ b/drivers/gpu/drm/amd/powerplay/navi10_ppt.c
@@ -1341,6 +1341,7 @@ static int navi10_thermal_get_temperature(struct smu_context *smu,
                 *value = metrics.TemperatureHotspot *
                         SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
                 break;
+       case AMDGPU_PP_SENSOR_GPU_TEMP:
         case AMDGPU_PP_SENSOR_EDGE_TEMP:
                 *value = metrics.TemperatureEdge *
                         SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
@@ -1384,6 +1385,7 @@ static int navi10_read_sensor(struct smu_context *smu,
                 break;
         case AMDGPU_PP_SENSOR_HOTSPOT_TEMP:
         case AMDGPU_PP_SENSOR_EDGE_TEMP:
+       case AMDGPU_PP_SENSOR_GPU_TEMP:
         case AMDGPU_PP_SENSOR_MEM_TEMP:
                 ret = navi10_thermal_get_temperature(smu, sensor, (uint32_t *)data);
                 *size = 4;
diff --git a/drivers/gpu/drm/amd/powerplay/vega20_ppt.c b/drivers/gpu/drm/amd/powerplay/vega20_ppt.c
index b44ec7c670c5..55996f3a1883 100644
--- a/drivers/gpu/drm/amd/powerplay/vega20_ppt.c
+++ b/drivers/gpu/drm/amd/powerplay/vega20_ppt.c
@@ -3123,6 +3123,7 @@ static int vega20_thermal_get_temperature(struct smu_context *smu,
 
                 *value = temp;
                 break;
+       case AMDGPU_PP_SENSOR_GPU_TEMP:
         case AMDGPU_PP_SENSOR_EDGE_TEMP:
                 *value = metrics.TemperatureEdge *
                         SMU_TEMPERATURE_UNITS_PER_CENTIGRADES;
@@ -3166,6 +3167,7 @@ static int vega20_read_sensor(struct smu_context *smu,
                 *size = 4;
                 break;
         case AMDGPU_PP_SENSOR_HOTSPOT_TEMP:
+       case AMDGPU_PP_SENSOR_GPU_TEMP:
         case AMDGPU_PP_SENSOR_EDGE_TEMP:
         case AMDGPU_PP_SENSOR_MEM_TEMP:
                 ret = vega20_thermal_get_temperature(smu, sensor, (uint32_t *)data);
--
2.22.0

_______________________________________________
amd-gfx mailing list
amd-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
amd-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux