Skip to contentSkip to conversation

drm/amdgpu/smu12: fix power reporting on CZN/BCL

PATCH In review Alex Deucher 4 participants 6 messages Jan 12, 2023 – Jan 16, 2023

Subsystems (3)
lore
Share & tools
lore

Alex Deucher

author maintainer
#0 lore raw

PATCH 1/2 drm/amdgpu/smu12: fix power reporting on CZN/BCL

The metrics interface exposes the socket power in W, but apparently RN systems exposed the power as mW. See
commit 137aac26a2ed ("drm/amdgpu/smu12: fix power reporting on renoir"). So leave RN as mW and use W for CZN/BCL.

Fixes 137aac26a2ed ("drm/amdgpu/smu12: fix power reporting on renoir")
---
 drivers/gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c +4 -1
index 85e22210963f..77308d481c54 100644
@@ -1196,7 +1196,10 @@ static int renoir_get_smu_metrics_data(struct smu_context *smu,
 		*value = metrics->AverageUvdActivity / 100;
 		break;
 	case METRICS_AVERAGE_SOCKETPOWER:
-		*value = (metrics->CurrentSocketPower << 8) / 1000;
+		if (smu->adev->ip_versions[MP1_HWIP][0] == IP_VERSION(12, 0, 0))
+			*value = (metrics->CurrentSocketPower << 8) / 1000; /* mW */
+		else
+			*value = metrics->CurrentSocketPower << 8; /* W */
 		break;
 	case METRICS_TEMPERATURE_EDGE:
 		*value = (metrics->GfxTemperature / 100) *
Signature · 1 line
2.39.0
author maintainer
#1 lore raw

PATCH 2/2 drm/amdgpu/pm: update hwmon power documentation

Power reporting is socket power. On APUs this includes the CPU. Update the documentation to clarify this.

---
 drivers/gpu/drm/amd/pm/amdgpu_pm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/amdgpu_pm.c +1 -1
index 236657eece47..76b9ec64ca50 100644
@@ -3059,7 +3059,7 @@ static ssize_t amdgpu_hwmon_show_mclk_label(struct device *dev,
  *
  * hwmon interfaces for GPU power:
  *
- * - power1_average: average power used by the GPU in microWatts
+ * - power1_average: average power used by the SoC in microWatts.  On APUs this includes the CPU.
  *
  * - power1_cap_min: minimum cap supported in microWatts
  *
Signature · 1 line
2.39.0
#2 lore raw

Re: [PATCH 2/2] drm/amdgpu/pm: update hwmon power documentation

Can someone review this patch (2/2)? 1/2 is superseded by Jesse's patch, but this one still makes sense.

Thanks

Quoted 25 lines · Alex Deucher

Power reporting is socket power. On APUs this includes the CPU. Update the documentation to clarify this.

---
 drivers/gpu/drm/amd/pm/amdgpu_pm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/amdgpu_pm.c +1 -2
index 236657eece47..76b9ec64ca50 100644
@@ -3059,7 +3059,7 @@ static ssize_t amdgpu_hwmon_show_mclk_label(struct device *dev,
  *
  * hwmon interfaces for GPU power:
  *
- * - power1_average: average power used by the GPU in microWatts
+ * - power1_average: average power used by the SoC in microWatts.  On APUs this includes the CPU.
  *
  * - power1_cap_min: minimum cap supported in microWatts
  *
--

2.39.0

Reviewed-by on v1 2/2
#3 lore raw

RE: [PATCH 2/2] drm/amdgpu/pm: update hwmon power documentation

In reply to Alex Deucher

[AMD Official Use Only - General]

Quoted 34 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Alex Deucher
Sent: Friday, January 13, 2023 12:25 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: [PATCH 2/2] drm/amdgpu/pm: update hwmon power documentation

Power reporting is socket power. On APUs this includes the CPU. Update the documentation to clarify this.

---
 drivers/gpu/drm/amd/pm/amdgpu_pm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/amdgpu_pm.c +1 -1
index 236657eece47..76b9ec64ca50 100644
@@ -3059,7 +3059,7 @@ static ssize_t
 amdgpu_hwmon_show_mclk_label(struct device *dev,
  *
  * hwmon interfaces for GPU power:
  *
- * - power1_average: average power used by the GPU in microWatts
+ * - power1_average: average power used by the SoC in microWatts.  On APUs

this includes the CPU.
*
* - power1_cap_min: minimum cap supported in microWatts *
--
2.39.0

Reviewed-by on v1 2/2
#4 lore raw

RE: [PATCH 2/2] drm/amdgpu/pm: update hwmon power documentation

In reply to Alex Deucher

[AMD Official Use Only - General]

Quoted 35 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Alex Deucher
Sent: Friday, January 13, 2023 12:25 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: [PATCH 2/2] drm/amdgpu/pm: update hwmon power documentation

Power reporting is socket power. On APUs this includes the CPU. Update the documentation to clarify this.

---
 drivers/gpu/drm/amd/pm/amdgpu_pm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/amdgpu_pm.c +1 -1
index 236657eece47..76b9ec64ca50 100644
@@ -3059,7 +3059,7 @@ static ssize_t
 amdgpu_hwmon_show_mclk_label(struct device *dev,
  *
  * hwmon interfaces for GPU power:
  *
- * - power1_average: average power used by the GPU in microWatts
+ * - power1_average: average power used by the SoC in microWatts.  On

APUs this includes the CPU.
*
* - power1_cap_min: minimum cap supported in microWatts *
--
2.39.0

#5 lore raw
In reply to Alex Deucher
Quoted 5 lines · Alex Deucher

The metrics interface exposes the socket power in W, but apparently RN systems exposed the power as mW. See
commit 137aac26a2ed ("drm/amdgpu/smu12: fix power reporting on renoir"). So leave RN as mW and use W for CZN/BCL.

Just saw that Jesse is working on a proper patch that fixes this for real based on the firmware versions. So let's take that instead.

Alex

Quoted 28 lines
Fixes 137aac26a2ed ("drm/amdgpu/smu12: fix power reporting on renoir")
---
 drivers/gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c +4 -2
index 85e22210963f..77308d481c54 100644
@@ -1196,7 +1196,10 @@ static int renoir_get_smu_metrics_data(struct smu_context *smu,
                *value = metrics->AverageUvdActivity / 100;
                break;
        case METRICS_AVERAGE_SOCKETPOWER:
-               *value = (metrics->CurrentSocketPower << 8) / 1000;
+               if (smu->adev->ip_versions[MP1_HWIP][0] == IP_VERSION(12, 0, 0))
+                       *value = (metrics->CurrentSocketPower << 8) / 1000; /* mW */
+               else
+                       *value = metrics->CurrentSocketPower << 8; /* W */
                break;
        case METRICS_TEMPERATURE_EDGE:
                *value = (metrics->GfxTemperature / 100) *
--

2.39.0