From: "[email protected]" <[email protected]>

This patch refactors the firmware version checks in `smu_v13_0_6_reset_sdma`
to support multiple SMU programs with different firmware version thresholds.

Signed-off-by: Jesse Zhang <[email protected]>
---
 .../gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c   | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c 
b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c
index 650aa9d0548a..5a5742571d29 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c
@@ -2745,11 +2745,15 @@ static int smu_v13_0_6_reset_sdma(struct smu_context 
*smu, uint32_t inst_mask)
 {
        struct amdgpu_device *adev = smu->adev;
        int ret = 0;
-
-       /* the message is only valid on SMU 13.0.6 with pmfw 85.121.00 and 
above */
-       if ((adev->flags & AMD_IS_APU) ||
-           amdgpu_ip_version(adev, MP1_HWIP, 0) != IP_VERSION(13, 0, 6) ||
-           smu->smc_fw_version < 0x00557900)
+       uint32_t smu_program;
+
+       smu_program = (smu->smc_fw_version >> 24) & 0xff;
+       /* the message is only valid on SMU 13.0.6 with these pmfw and above */
+       if (amdgpu_ip_version(adev, MP1_HWIP, 0) != IP_VERSION(13, 0, 6) ||
+               ((smu_program == 0) && (smu->smc_fw_version < 0x00557900)) ||
+               ((smu_program == 4) && (smu->smc_fw_version < 0x4556e00)) ||
+               ((smu_program == 5) && (smu->smc_fw_version < 0x5551200)) ||
+               ((smu_program == 7) && (smu->smc_fw_version < 0x7550700)))
                return 0;
 
        ret = smu_cmn_send_smc_msg_with_param(smu,
-- 
2.25.1

Reply via email to