[PATCH] drm/amdgpu: Renoir/Cezanne GPU power reporting issue

Liu, Aaron Aaron.Liu at amd.com
Fri Jan 13 02:11:22 UTC 2023


Reviewed-by: Aaron Liu aaron.liu at amd.com<mailto:aaron.liu at amd.com>

From: amd-gfx <amd-gfx-bounces at lists.freedesktop.org> On Behalf Of Zhang, Jesse(Jie)
Sent: Friday, January 13, 2023 10:07 AM
To: Deucher, Alexander <Alexander.Deucher at amd.com>
Cc: amd-gfx at lists.freedesktop.org
Subject: [PATCH] drm/amdgpu: Renoir/Cezanne GPU power reporting issue


[AMD Official Use Only - General]


    drm/amdgpu: Correct the power calcultion for Renior/Cezanne.
    From smu firmware,the value of power is transferred  in units of watts.
    Bug: https://gitlab.freedesktop.org/drm/amd/-/issues/2321
    Fixes: 137aac26a2ed ("drm/amdgpu/smu12: fix power reporting on renoir")

    Acked-by: Alex Deucher alexander.deucher at amd.com<mailto:alexander.deucher at amd.com>
    Signed-off-by: Jesse Zhang Jesse.Zhang at amd.com<mailto:Jesse.Zhang at amd.com>

diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c
index 85e22210963f..96a49a3b3ad9 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c
@@ -1171,6 +1171,7 @@ static int renoir_get_smu_metrics_data(struct smu_context *smu,
        int ret = 0;
        uint32_t apu_percent = 0;
        uint32_t dgpu_percent = 0;
+       struct amdgpu_device *adev = smu->adev;


        ret = smu_cmn_get_metrics_table(smu,
@@ -1196,7 +1197,11 @@ 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 (((adev->ip_versions[MP1_HWIP][0] == IP_VERSION(12, 0, 1)) && (adev->pm.fw_version >= 0x40000f))
+                       || ((adev->ip_versions[MP1_HWIP][0] == IP_VERSION(12, 0, 0)) && (adev->pm.fw_version >= 0x373200)))
+                       *value = metrics->CurrentSocketPower << 8;
+               else
+                       *value = (metrics->CurrentSocketPower << 8) / 1000;
                break;
        case METRICS_TEMPERATURE_EDGE:
                *value = (metrics->GfxTemperature / 100) *
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/amd-gfx/attachments/20230113/07711717/attachment-0001.htm>


More information about the amd-gfx mailing list