Skip to content

Commit 396beb9

Browse files
Evan Quanalexdeucher
authored andcommitted
drm/amd/pm: correct the metrics version for SMU 11.0.11/12/13
Correct the metrics version used for SMU 11.0.11/12/13. Fixes misreported GPU metrics (e.g., fan speed, etc.) depending on which version of SMU firmware is loaded. Bug: https://gitlab.freedesktop.org/drm/amd/-/issues/1925 Signed-off-by: Evan Quan <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 6a81703 commit 396beb9

File tree

1 file changed

+44
-13
lines changed

1 file changed

+44
-13
lines changed

drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c

Lines changed: 44 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -697,12 +697,28 @@ static int sienna_cichlid_get_smu_metrics_data(struct smu_context *smu,
697697
uint32_t apu_percent = 0;
698698
uint32_t dgpu_percent = 0;
699699

700-
if ((smu->adev->ip_versions[MP1_HWIP][0] == IP_VERSION(11, 0, 7)) &&
701-
(smu->smc_fw_version >= 0x3A4900))
702-
use_metrics_v3 = true;
703-
else if ((smu->adev->ip_versions[MP1_HWIP][0] == IP_VERSION(11, 0, 7)) &&
704-
(smu->smc_fw_version >= 0x3A4300))
705-
use_metrics_v2 = true;
700+
switch (smu->adev->ip_versions[MP1_HWIP][0]) {
701+
case IP_VERSION(11, 0, 7):
702+
if (smu->smc_fw_version >= 0x3A4900)
703+
use_metrics_v3 = true;
704+
else if (smu->smc_fw_version >= 0x3A4300)
705+
use_metrics_v2 = true;
706+
break;
707+
case IP_VERSION(11, 0, 11):
708+
if (smu->smc_fw_version >= 0x412D00)
709+
use_metrics_v2 = true;
710+
break;
711+
case IP_VERSION(11, 0, 12):
712+
if (smu->smc_fw_version >= 0x3B2300)
713+
use_metrics_v2 = true;
714+
break;
715+
case IP_VERSION(11, 0, 13):
716+
if (smu->smc_fw_version >= 0x491100)
717+
use_metrics_v2 = true;
718+
break;
719+
default:
720+
break;
721+
}
706722

707723
ret = smu_cmn_get_metrics_table(smu,
708724
NULL,
@@ -3833,13 +3849,28 @@ static ssize_t sienna_cichlid_get_gpu_metrics(struct smu_context *smu,
38333849
uint16_t average_gfx_activity;
38343850
int ret = 0;
38353851

3836-
if ((adev->ip_versions[MP1_HWIP][0] == IP_VERSION(11, 0, 7)) &&
3837-
(smu->smc_fw_version >= 0x3A4900))
3838-
use_metrics_v3 = true;
3839-
else if ((adev->ip_versions[MP1_HWIP][0] == IP_VERSION(11, 0, 7)) &&
3840-
(smu->smc_fw_version >= 0x3A4300))
3841-
use_metrics_v2 = true;
3842-
3852+
switch (smu->adev->ip_versions[MP1_HWIP][0]) {
3853+
case IP_VERSION(11, 0, 7):
3854+
if (smu->smc_fw_version >= 0x3A4900)
3855+
use_metrics_v3 = true;
3856+
else if (smu->smc_fw_version >= 0x3A4300)
3857+
use_metrics_v2 = true;
3858+
break;
3859+
case IP_VERSION(11, 0, 11):
3860+
if (smu->smc_fw_version >= 0x412D00)
3861+
use_metrics_v2 = true;
3862+
break;
3863+
case IP_VERSION(11, 0, 12):
3864+
if (smu->smc_fw_version >= 0x3B2300)
3865+
use_metrics_v2 = true;
3866+
break;
3867+
case IP_VERSION(11, 0, 13):
3868+
if (smu->smc_fw_version >= 0x491100)
3869+
use_metrics_v2 = true;
3870+
break;
3871+
default:
3872+
break;
3873+
}
38433874

38443875
ret = smu_cmn_get_metrics_table(smu,
38453876
&metrics_external,

0 commit comments

Comments
 (0)