[PATCH] drm/amd/amdgpu: fix the GPU power print error in pm info

Zhang, Yifan Yifan1.Zhang at amd.com
Tue Oct 24 14:28:44 UTC 2023


[AMD Official Use Only - General]

-----Original Message-----
From: Ma, Li <Li.Ma at amd.com>
Sent: Tuesday, October 24, 2023 7:09 PM
To: amd-gfx at lists.freedesktop.org
Cc: Deucher, Alexander <Alexander.Deucher at amd.com>; Zhang, Yifan <Yifan1.Zhang at amd.com>; Feng, Kenneth <Kenneth.Feng at amd.com>; StDenis, Tom <Tom.StDenis at amd.com>; Ma, Li <Li.Ma at amd.com>
Subject: [PATCH] drm/amd/amdgpu: fix the GPU power print error in pm info

Print the digit of the fractional part individually to avoid carrying during display.

Signed-off-by: Li Ma <li.ma at amd.com>
---
 drivers/gpu/drm/amd/pm/amdgpu_pm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/pm/amdgpu_pm.c b/drivers/gpu/drm/amd/pm/amdgpu_pm.c
index 358bb5e485f2..cc853559cf0f 100644
--- a/drivers/gpu/drm/amd/pm/amdgpu_pm.c
+++ b/drivers/gpu/drm/amd/pm/amdgpu_pm.c
@@ -4290,10 +4290,10 @@ static int amdgpu_debugfs_pm_info_pp(struct seq_file *m, struct amdgpu_device *a
                seq_printf(m, "\t%u mV (VDDNB)\n", value);
        size = sizeof(uint32_t);
        if (!amdgpu_dpm_read_sensor(adev, AMDGPU_PP_SENSOR_GPU_AVG_POWER, (void *)&query, &size))
-               seq_printf(m, "\t%u.%u W (average GPU)\n", query >> 8, query & 0xff);
+               seq_printf(m, "\t%u.%u%u W (average GPU)\n", query >> 8, (query &
+0xff) / 10, (query & 0xff) % 10);

Would you pls elaborate on this with an example ? it looks to me it makes no difference here.

        size = sizeof(uint32_t);
        if (!amdgpu_dpm_read_sensor(adev, AMDGPU_PP_SENSOR_GPU_INPUT_POWER, (void *)&query, &size))
-               seq_printf(m, "\t%u.%u W (current GPU)\n", query >> 8, query & 0xff);
+               seq_printf(m, "\t%u.%u%u W (current GPU)\n", query >> 8, (query &
+0xff) / 10, (query & 0xff) % 10);

Would you pls elaborate on this with an example? it looks to me it makes no difference here.

        size = sizeof(value);
        seq_printf(m, "\n");

--
2.25.1



More information about the amd-gfx mailing list