drm/amd/pm: add support for checking SDMA reset capability
Subsystems (3)
PATCH v2 1/2 drm/amd/pm: add support for checking SDMA reset capability
From: "[email protected]" <[email protected]>
This patch introduces a new function to check if the SMU supports resetting the SDMA engine. This capability check ensures that the driver does not attempt to reset the SDMA engine on hardware that does not support it.
The following changes are included:
- New function amdgpu_dpm_reset_sdma_is_supported to check SDMA reset support at the AMDGPU driver level.
- New function smu_reset_sdma_is_supported to check SDMA reset support at the SMU level.
- Implementation of smu_v13_0_6_reset_sdma_is_supported for the specific SMU version v13.0.6.
- Updated smu_v13_0_6_reset_sdma to use the new capability check before attempting to reset the SDMA engine.
--- drivers/gpu/drm/amd/pm/amdgpu_dpm.c | 23 +++++++++++++++++++ drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h | 1 + drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 17 ++++++++++++++ drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h | 5 ++++ .../drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c | 23 ++++++++++++++++++- 5 files changed, 68 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/amdgpu_dpm.c +23 -0
@@ -722,6 +722,29 @@ int amdgpu_dpm_send_rma_reason(struct amdgpu_device *adev)return ret; } +/** +* amdgpu_dpm_reset_sdma_is_supported - Check if SDMA reset is supported +* @adev: amdgpu_device pointer +* +* This function checks if the SMU supports resetting the SDMA engine. +* It returns -EOPNOTSUPP if the hardware does not support software SMU or +* if the feature is not supported. +*/ +int amdgpu_dpm_reset_sdma_is_supported (struct amdgpu_device *adev) +{ +struct smu_context *smu = adev->powerplay.pp_handle; +int ret; + +if (!is_support_sw_smu (adev)) +return -EOPNOTSUPP ; + +mutex_lock (&adev->pm.mutex); + ret =smu_reset_sdma_is_supported (smu); +mutex_unlock (&adev->pm.mutex); + +return ret; +} +int amdgpu_dpm_reset_sdma (struct amdgpu_device *adev,uint32_t inst_mask) {struct smu_context *smu = adev->powerplay.pp_handle;
drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h +1 -0
@@ -603,5 +603,6 @@ int amdgpu_dpm_set_pm_policy(struct amdgpu_device *adev, int policy_type,ssize_t amdgpu_dpm_get_pm_policy_info (struct amdgpu_device *adev,enum pp_pm_policy p_type,char *buf);int amdgpu_dpm_reset_sdma (struct amdgpu_device *adev,uint32_t inst_mask); +int amdgpu_dpm_reset_sdma_is_supported (struct amdgpu_device *adev);#endif
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +17 -0
@@ -3907,6 +3907,23 @@ int smu_send_rma_reason(struct smu_context *smu)return ret; } +/** +* smu_reset_sdma_is_supported - Check if SDMA reset is supported by SMU +* @smu: smu_context pointer +* +* This function checks if the SMU supports resetting the SDMA engine. +* It returns 0 if supported, -EOPNOTSUPP otherwise. +*/ +int smu_reset_sdma_is_supported (struct smu_context *smu) +{ +int ret =0 ; + +if (smu->ppt_funcs && smu->ppt_funcs->reset_sdma_is_supported) + ret = smu->ppt_funcs->reset_sdma_is_supported (smu); + +return ret; +} +int smu_reset_sdma (struct smu_context *smu,uint32_t inst_mask) {int ret =0 ;
drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h +5 -0
@@ -1376,6 +1376,10 @@ struct pptable_funcs {* @reset_sdma: message SMU to soft reset sdma instance. */ int (*reset_sdma)(struct smu_context *smu,uint32_t inst_mask); +/** +* @reset_sdma_is_supported: Check if support resets the SDMA engine. +*/ +int (*reset_sdma_is_supported)(struct smu_context *smu);/** * @get_ecc_table: message SMU to get ECC INFO table.
@@ -1637,6 +1641,7 @@ int smu_send_hbm_bad_pages_num(struct smu_context *smu, uint32_t size);int smu_send_hbm_bad_channel_flag (struct smu_context *smu,uint32_t size);int smu_send_rma_reason (struct smu_context *smu);int smu_reset_sdma (struct smu_context *smu,uint32_t inst_mask); +int smu_reset_sdma_is_supported (struct smu_context *smu);int smu_set_pm_policy (struct smu_context *smu,enum pp_pm_policy p_type,int level); ssize_t smu_get_pm_policy_info(struct smu_context *smu,
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +22 -1
@@ -2902,11 +2902,31 @@ static int smu_v13_0_6_send_rma_reason(struct smu_context *smu)return ret; } +/** +* smu_v13_0_6_reset_sdma_is_supported - Check if SDMA reset is supported +* @smu: smu_context pointer +* +* This function checks if the SMU supports resetting the SDMA engine. +* It returns -EOPNOTSUPP if the capability is not supported. +*/ +static int smu_v13_0_6_reset_sdma_is_supported (struct smu_context *smu) +{ +int ret =0 ; + +if (!smu_v13_0_6_cap_supported (smu,SMU_CAP (SDMA_RESET ))) { +dev_info (smu->adev->dev, +"SDMA reset capability is not supported\n" ); + ret =EOPNOTSUPP ; + } + +return ret; +} +static int smu_v13_0_6_reset_sdma (struct smu_context *smu,uint32_t inst_mask) {int ret =0 ; -if (!smu_v13_0_6_cap_supported (smu,SMU_CAP (SDMA_RESET ))) +if (smu_v13_0_6_reset_sdma_is_supported (smu))return -EOPNOTSUPP ; ret = smu_cmn_send_smc_msg_with_param(smu,
@@ -3590,6 +3610,7 @@ static const struct pptable_funcs smu_v13_0_6_ppt_funcs = { .send_hbm_bad_pages_num = smu_v13_0_6_smu_send_hbm_bad_page_num, .send_rma_reason = smu_v13_0_6_send_rma_reason, .reset_sdma = smu_v13_0_6_reset_sdma, + .reset_sdma_is_supported = smu_v13_0_6_reset_sdma_is_supported, };void smu_v13_0_6_set_ppt_funcs (struct smu_context *smu)
Signature · 1 line
2.25.1
PATCH v2 2/2 drm/amdgpu: Enable per-queue reset support
From: "[email protected]" <[email protected]>
- Modify the sdma_v4_4_2_sw_init function to conditionally enable per-queue reset support.
- For IP versions 9.4.3 and 9.4.4, enable per-queue reset if the MEC firmware version is at least 0xb0 and PMFW supports queue reset.
- Add a TODO comment for future support of per-queue reset for IP version 9.4.5.
This change ensures that per-queue reset is only enabled when the MEC and PMFW support it.
--- drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c +15 -1
@@ -1458,9 +1458,23 @@ static int sdma_v4_4_2_sw_init(struct amdgpu_ip_block *ip_block) } } -/* TODO: Add queue reset mask when FW fully supports it */ adev->sdma.supported_reset =amdgpu_get_soft_full_reset_mask (&adev->sdma.instance[0 ].ring); +/* +* the user queue relies on MEC fw and pmfw when the sdma queue do reset. +* it needs to check both of them at here to skip old mec and pmfw. +*/ +switch (amdgpu_ip_version (adev,GC_HWIP ,0 )) { +case IP_VERSION (9 ,4 ,3 ): +case IP_VERSION (9 ,4 ,4 ): +if ((adev->gfx.mec_fw_version >=0xb0 ) &&amdgpu_dpm_reset_sdma_is_supported (adev)) + adev->gfx.compute_supported_reset |=AMDGPU_RESET_TYPE_PER_QUEUE ; +break ; +case IP_VERSION (9 ,4 ,5 ): +/*TODO: enable the queue reset flag until fw supported */ +default : +break ; + }if (amdgpu_sdma_ras_sw_init (adev)) {dev_err (adev->dev,"fail to initialize sdma ras block\n" );
Signature · 1 line
2.25.1
RE: [PATCH V2 2/2] drm/amdgpu: Enable per-queue reset support
[AMD Official Use Only - AMD Internal Distribution Only]
Hi Jesse,
Quoted 52 lines
-----Original Message-----
From: [email protected] <[email protected]>
Sent: Thursday, February 20, 2025 4:31 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Zhu, Jiadong <[email protected]>; Huang, Tim <[email protected]>; Zhang, Jesse(Jie) <[email protected]>; Kim, Jonathan <[email protected]>; Prosyak, Vitaly <[email protected]>; Zhang, Jesse(Jie) <[email protected]>
Subject: [PATCH V2 2/2] drm/amdgpu: Enable per-queue reset supportFrom: "[email protected]" <[email protected]>
- Modify the
sdma_v4_4_2_sw_initfunction to conditionally enable per-queue reset support.
- For IP versions 9.4.3 and 9.4.4, enable per-queue reset if the MEC firmware version is at least0xb0and PMFW supports queue reset.
- Add a TODO comment for future support of per-queue reset for IP version 9.4.5.This change ensures that per-queue reset is only enabled when the MEC and PMFW support it.
Suggested-by Jonathan Kim <[email protected]>Signed-off-by Vitaly Prosyak <[email protected]>Signed-off-by Jesse Zhang <[email protected]>--- drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c +2
-1@@ -1458,9 +1458,23 @@ static int sdma_v4_4_2_sw_init(struct amdgpu_ip_block *ip_block) } } -/* TODO: Add queue reset mask when FW fully supports it */ adev->sdma.supported_reset =amdgpu_get_soft_full_reset_mask (&adev->sdma.instance[0 ].ring); +/* +* the user queue relies on MEC fw and pmfw when the sdma queue do reset.
drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c +6
-0+* it needs to check both of them at here to skip old mec and pmfw. +*/ +switch (amdgpu_ip_version (adev,GC_HWIP ,0 )) { +case IP_VERSION (9 ,4 ,3 ): +case IP_VERSION (9 ,4 ,4 ): + if ((adev->gfx.mec_fw_version >= 0xb0) &&
Quoted 3 lines
amdgpu_dpm_reset_sdma_is_supported(adev))
+adev->gfx.compute_supported_reset|=AMDGPU_RESET_TYPE_PER_QUEUE;
Do you want to check the adev->gfx.compute_supported_reset here or a typo?
Tim
Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c +6
-1+break ; +case IP_VERSION (9 ,4 ,5 ): +/*TODO: enable the queue reset flag until fw supported */ +default : +break ; + }if (amdgpu_sdma_ras_sw_init (adev)) {dev_err (adev->dev,"fail to initialize sdma ras block\n" ); --2.25.1
RE: [PATCH V2 2/2] drm/amdgpu: Enable per-queue reset support
[AMD Official Use Only - AMD Internal Distribution Only]
-----Original Message-----
From: Huang, Tim <[email protected]>
Sent: Thursday, February 20, 2025 4:55 PM
To: Zhang, Jesse(Jie) <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Zhu, Jiadong <[email protected]>; Zhang, Jesse(Jie) <[email protected]>; Kim, Jonathan <[email protected]>; Prosyak, Vitaly <[email protected]>; Zhang, Jesse(Jie) <[email protected]>
Subject: RE: [PATCH V2 2/2] drm/amdgpu: Enable per-queue reset support
[AMD Official Use Only - AMD Internal Distribution Only]
Hi Jesse,
Quoted 54 lines
-----Original Message-----
From: [email protected] <[email protected]>
Sent: Thursday, February 20, 2025 4:31 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Zhu, Jiadong <[email protected]>; Huang, Tim <[email protected]>; Zhang, Jesse(Jie) <[email protected]>; Kim, Jonathan <[email protected]>; Prosyak, Vitaly <[email protected]>; Zhang, Jesse(Jie) <[email protected]>
Subject: [PATCH V2 2/2] drm/amdgpu: Enable per-queue reset supportFrom: "[email protected]" <[email protected]>
- Modify the
sdma_v4_4_2_sw_initfunction to conditionally enable per-queue reset support.
- For IP versions 9.4.3 and 9.4.4, enable per-queue reset if the MEC firmware version is at least0xb0and PMFW supports queue reset.
- Add a TODO comment for future support of per-queue reset for IP version 9.4.5.This change ensures that per-queue reset is only enabled when the MEC and PMFW support it.
Suggested-by Jonathan Kim <[email protected]>Signed-off-by Vitaly Prosyak <[email protected]>Signed-off-by Jesse Zhang <[email protected]>--- drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c +3
-1@@ -1458,9 +1458,23 @@ static int sdma_v4_4_2_sw_init(struct amdgpu_ip_block *ip_block) } } -/* TODO: Add queue reset mask when FW fully supports it */ adev->sdma.supported_reset =amdgpu_get_soft_full_reset_mask (&adev->sdma.instance[0 ].ring); +/* +* the user queue relies on MEC fw and pmfw when the sdma queue +do reset.
drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c +6
-0+* it needs to check both of them at here to skip old mec and pmfw. +*/ +switch (amdgpu_ip_version (adev,GC_HWIP ,0 )) { +case IP_VERSION (9 ,4 ,3 ): +case IP_VERSION (9 ,4 ,4 ): + if ((adev->gfx.mec_fw_version >= 0xb0) &&
Quoted 3 lines
amdgpu_dpm_reset_sdma_is_supported(adev))
+adev->gfx.compute_supported_reset|=AMDGPU_RESET_TYPE_PER_QUEUE;
Do you want to check the adev->gfx.compute_supported_reset here or a typo? Thanks Tim, will fix the type. It should be adev->sdma.compute_supported_reset
Tim
Quoted 12 lines
drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c +6
-0+break ; +case IP_VERSION (9 ,4 ,5 ): +/*TODO: enable the queue reset flag until fw supported */ +default : +break ; + }if (amdgpu_sdma_ras_sw_init (adev)) { dev_err(adev->dev, "fail to initialize sdma rasblock\n");
--
2.25.1
[Public]
Hi Jesse,
Quoted 60 lines
-----Original Message-----
From: [email protected] <[email protected]>
Sent: Thursday, February 20, 2025 4:31 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Zhu, Jiadong <[email protected]>; Huang, Tim <[email protected]>; Zhang, Jesse(Jie) <[email protected]>; Prosyak, Vitaly <[email protected]>; Zhang, Jesse(Jie) <[email protected]>
Subject: [PATCH v2 1/2] drm/amd/pm: add support for checking SDMA reset capabilityFrom: "[email protected]" <[email protected]>
This patch introduces a new function to check if the SMU supports resetting the SDMA engine.
This capability check ensures that the driver does not attempt to reset the SDMA engine on hardware that does not support it.The following changes are included:
- New functionamdgpu_dpm_reset_sdma_is_supportedto check SDMA reset
support at the AMDGPU driver level.
- New functionsmu_reset_sdma_is_supportedto check SDMA reset support at the SMU level.
- Implementation ofsmu_v13_0_6_reset_sdma_is_supportedfor the specific
SMU version v13.0.6.
- Updatedsmu_v13_0_6_reset_sdmato use the new capability check before
attempting to reset the SDMA engine.Signed-off-by Vitaly Prosyak <[email protected]>Signed-off-by Jesse Zhang <[email protected]>--- drivers/gpu/drm/amd/pm/amdgpu_dpm.c | 23 +++++++++++++++++++ drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h | 1 + drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 17 ++++++++++++++ drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h | 5 ++++ .../drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c | 23 ++++++++++++++++++- 5 files changed, 68 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/pm/amdgpu_dpm.c +6
-0@@ -722,6 +722,29 @@ int amdgpu_dpm_send_rma_reason(struct amdgpu_device *adev)return ret; } +/** +* amdgpu_dpm_reset_sdma_is_supported - Check if SDMA reset is +supported +* @adev: amdgpu_device pointer +* +* This function checks if the SMU supports resetting the SDMA engine.
drivers/gpu/drm/amd/pm/amdgpu_dpm.c int amdgpu_dpm_send_rma_reason(struct · line 741
Quoted 10 lines
drivers/gpu/drm/amd/pm/amdgpu_dpm.c +10
-0+* It returns -EOPNOTSUPP if the hardware does not support software SMU +or +* if the feature is not supported. +*/ +int amdgpu_dpm_reset_sdma_is_supported (struct amdgpu_device *adev) { +struct smu_context *smu = adev->powerplay.pp_handle; +int ret; + +if (!is_support_sw_smu (adev)) +return -EOPNOTSUPP ;
We may need to carefully set the return type and return value for this function, as it is used in your patch 2/2 like this:
if ((adev->gfx.mec_fw_version >= 0xb0) &&amdgpu_dpm_reset_sdma_is_supported(adev))
Quoted 97 lines
drivers/gpu/drm/amd/pm/amdgpu_dpm.c +8
-0+ +mutex_lock (&adev->pm.mutex); + ret =smu_reset_sdma_is_supported (smu); +mutex_unlock (&adev->pm.mutex); + +return ret; +} + int amdgpu_dpm_reset_sdma(struct amdgpu_device *adev, uint32_tinst_mask) { struct smu_context *smu = adev->powerplay.pp_handle; diff --git
a/drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.hb/drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h
index1f5ac7e0230d..353a10119dc5100644drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h +0
-0@@ -603,5 +603,6 @@ int amdgpu_dpm_set_pm_policy(struct
amdgpu_device*adev, intpolicy_type,ssize_tamdgpu_dpm_get_pm_policy_info(structamdgpu_device*adev,
enumpp_pm_policyp_type, char *buf); intamdgpu_dpm_reset_sdma(struct amdgpu_device *adev, uint32_t inst_mask);drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h +1
-0+int amdgpu_dpm_reset_sdma_is_supported (struct amdgpu_device *adev);#endif drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +17
-0@@ -3907,6 +3907,23 @@ int smu_send_rma_reason(struct smu_context *smu)return ret; } +/** +* smu_reset_sdma_is_supported - Check if SDMA reset is supported by +SMU +* @smu: smu_context pointer +* +* This function checks if the SMU supports resetting the SDMA engine. +* It returns 0 if supported, -EOPNOTSUPP otherwise. +*/ +int smu_reset_sdma_is_supported (struct smu_context *smu) { +int ret =0 ; + +if (smu->ppt_funcs && smu->ppt_funcs->reset_sdma_is_supported) + ret = smu->ppt_funcs->reset_sdma_is_supported (smu); + +return ret; +} +int smu_reset_sdma (struct smu_context *smu,uint32_t inst_mask) {int ret =0 ;drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h +2
-0@@ -1376,6 +1376,10 @@ struct pptable_funcs {* @reset_sdma: message SMU to soft reset sdma instance. */ int (*reset_sdma)(struct smu_context *smu,uint32_t inst_mask); +/** +* @reset_sdma_is_supported: Check if support resets the SDMA engine.
drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h +2
-0+*/ +int (*reset_sdma_is_supported)(struct smu_context *smu);/** * @get_ecc_table: message SMU to get ECC INFO table. @@ -1637,6 +1641,7 @@ int smu_send_hbm_bad_pages_num(struct
smu_context*smu,uint32_tsize); intsmu_send_hbm_bad_channel_flag(struct smu_context *smu, uint32_t size); intsmu_send_rma_reason(struct smu_context *smu); intsmu_reset_sdma(struct smu_context *smu, uint32_t inst_mask); +intsmu_reset_sdma_is_supported(struct smu_context *smu);
int smu_set_pm_policy(structsmu_context*smu, enumpp_pm_policyp_type,int level);
ssize_tsmu_get_pm_policy_info(structsmu_context*smu, diff --gita/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.cb/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.cindex9f2de69f53b2..a200ac7b15a8100644drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +7
-0@@ -2902,11 +2902,31 @@ static int smu_v13_0_6_send_rma_reason(struct smu_context *smu) return ret; } +/** +* smu_v13_0_6_reset_sdma_is_supported - Check if SDMA reset is +supported +* @smu: smu_context pointer +* +* This function checks if the SMU supports resetting the SDMA engine. +* It returns -EOPNOTSUPP if the capability is not supported.
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c static int · line 2922
Quoted 10 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +9
-0+*/ +static int smu_v13_0_6_reset_sdma_is_supported (struct smu_context *smu) +{ +int ret =0 ; + +if (!smu_v13_0_6_cap_supported (smu,SMU_CAP (SDMA_RESET ))) { +dev_info (smu->adev->dev, +"SDMA reset capability is not supported\n" ); + ret =EOPNOTSUPP ;
Need to set the return value consistence with the return of amdgpu_dpm_reset_sdma_is_supported if not supported.
Tim
Quoted 26 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +7
-1+ } + +return ret; +} +static int smu_v13_0_6_reset_sdma (struct smu_context *smu,uint32_t inst_mask) {int ret =0 ; -if (!smu_v13_0_6_cap_supported (smu,SMU_CAP (SDMA_RESET ))) +if (smu_v13_0_6_reset_sdma_is_supported (smu))return -EOPNOTSUPP ; ret = smu_cmn_send_smc_msg_with_param(smu,@@ -3590,6 +3610,7 @@ static const struct pptable_funcs smu_v13_0_6_ppt_funcs = { .send_hbm_bad_pages_num = smu_v13_0_6_smu_send_hbm_bad_page_num, .send_rma_reason = smu_v13_0_6_send_rma_reason, .reset_sdma = smu_v13_0_6_reset_sdma, + .reset_sdma_is_supported = smu_v13_0_6_reset_sdma_is_supported, };void
smu_v13_0_6_set_ppt_funcs(struct smu_context *smu)
--
2.25.1