From: jsg Date: Wed, 25 Jan 2023 01:50:20 +0000 (+0000) Subject: drm/amdgpu: Correct the power calcultion for Renior/Cezanne. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=40c514d97f3f3ecd9a07cad30f3403325636f350;p=openbsd drm/amdgpu: Correct the power calcultion for Renior/Cezanne. From jie1zhan 8dabe4e0daa999b2f11e354a0f67934420e095b4 in linux-6.1.y/6.1.8 c7bae4aaa5609c1fa9761c35dbcc5fcc92915222 in mainline linux --- diff --git a/sys/dev/pci/drm/amd/pm/swsmu/smu12/renoir_ppt.c b/sys/dev/pci/drm/amd/pm/swsmu/smu12/renoir_ppt.c index 85e22210963..5cdc0716548 100644 --- a/sys/dev/pci/drm/amd/pm/swsmu/smu12/renoir_ppt.c +++ b/sys/dev/pci/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) *