drm/amd/pm: Refactor SMU 13.0.6 SDMA reset firmware version checks
Subsystems (3)
PATCH v2 3/3 drm/amd/pm: Refactor SMU 13.0.6 SDMA reset firmware version checks
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.
V2: return -EOPNOTSUPP for unspported pmfw
--- .../drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c | 23 ++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +17 -6
@@ -2745,12 +2745,23 @@ 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 ) -return 0 ; +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 <0x4557000 )) || + ((smu_program ==5 ) && (smu->smc_fw_version <0x5551200 )) || + ((smu_program ==7 ) && (smu->smc_fw_version <0x7550700 ))) { +dev_err (smu->adev->dev, +"ResetSDMA not supported: SMU program %u requires PMFW >= 0x%x\n" +"Current PMFW version: 0x%x\n" ,smu_program, + smu_program ==0 ?0x00557900 : smu_program ==4 ?0x4557000 : + smu_program ==5 ?0x5551200 : smu_program ==7 ?0x7550700 :0 , + smu->smc_fw_version); +return -EOPNOTSUPP ; + } ret =smu_cmn_send_smc_msg_with_param (smu, SMU_MSG_ResetSDMA, inst_mask,NULL );
Signature · 1 line
2.25.1
Quoted 25 lines · On 1/15/2025 3:18 PM, [email protected] wrote:
From: "[email protected]" <[email protected]>
This patch refactors the firmware version checks in
smu_v13_0_6_reset_sdmato support multiple SMU programs with different firmware version thresholds.V2: return
-EOPNOTSUPPfor unspported pmfwSuggested-by Lazar Lijo <[email protected]>Signed-off-by Jesse Zhang <[email protected]>--- .../drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c | 23 ++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-)drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +0
-4@@ -2745,12 +2745,23 @@ 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) ||
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c static int smu_v13_0_6_reset_sdma(struct smu_context *smu, uint32_t inst_mask) · line 2755
Quoted 10 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +8
-2- smu->smc_fw_version < 0x00557900) -return 0 ; +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 < 0x4557000)) || + ((smu_program == 5) && (smu->smc_fw_version < 0x5551200)) ||
Missed to check this last time -
Note that this won't work as this FW version is not used with IP version 13.0.6.
It will return always return unsupported for program 5 because of this check - amdgpu_ip_version(adev, MP1_HWIP, 0) != IP_VERSION(13, 0, 6)
Thanks,
Lijo
Quoted 12 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +9
-0+ ((smu_program == 7) && (smu->smc_fw_version < 0x7550700))) { +dev_err (smu->adev->dev, +"ResetSDMA not supported: SMU program %u requires PMFW >= 0x%x\n" +"Current PMFW version: 0x%x\n" ,smu_program, + smu_program ==0 ?0x00557900 : smu_program ==4 ?0x4557000 : + smu_program ==5 ?0x5551200 : smu_program ==7 ?0x7550700 :0 , + smu->smc_fw_version); +return -EOPNOTSUPP ; + } ret =smu_cmn_send_smc_msg_with_param (smu, SMU_MSG_ResetSDMA, inst_mask,NULL );
Quoted 10 lines · On Wed, Jan 15, 2025 at 4:48 AM [email protected] <[email protected]> wrote:
From: "[email protected]" <[email protected]>
This patch refactors the firmware version checks in
smu_v13_0_6_reset_sdmato support multiple SMU programs with different firmware version thresholds.V2: return
-EOPNOTSUPPfor unspported pmfwSuggested-by Lazar Lijo <[email protected]>Signed-off-by Jesse Zhang <[email protected]>
Series is:
Quoted 41 lines
--- .../drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c | 23 ++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-)drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +17
-7@@ -2745,12 +2745,23 @@ 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 ) -return 0 ; +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 <0x4557000 )) || + ((smu_program ==5 ) && (smu->smc_fw_version <0x5551200 )) || + ((smu_program ==7 ) && (smu->smc_fw_version <0x7550700 ))) { +dev_err (smu->adev->dev, +"ResetSDMA not supported: SMU program %u requires PMFW >= 0x%x\n" +"Current PMFW version: 0x%x\n" ,smu_program, + smu_program ==0 ?0x00557900 : smu_program ==4 ?0x4557000 : + smu_program ==5 ?0x5551200 : smu_program ==7 ?0x7550700 :0 , + smu->smc_fw_version); +return -EOPNOTSUPP ; + } ret =smu_cmn_send_smc_msg_with_param (smu, SMU_MSG_ResetSDMA, inst_mask,NULL ); --2.25.1