Skip to contentSkip to conversation

drm/amd/pm: add support for checking SDMA reset capability

PATCH In review [email protected] 2 participants 4 messages Feb 21, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v3 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.

v3: change smu_reset_sdma_is_supported type to bool (Tim)

---
 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
index faae9bf48aa4..7c4ff12269d9 100644
@@ -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 false if the hardware does not support software SMU or
+ * if the feature is not supported.
+ */
+bool amdgpu_dpm_reset_sdma_is_supported(struct amdgpu_device *adev)
+{
+	struct smu_context *smu = adev->powerplay.pp_handle;
+	bool ret;
+
+	if (!is_support_sw_smu(adev))
+		return false;
+
+	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
index 1f5ac7e0230d..9fb26b5c8ae7 100644
@@ -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);
+bool amdgpu_dpm_reset_sdma_is_supported(struct amdgpu_device *adev);
 
 #endif
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +17 -0
index 0b32c6cf6924..d71c8c58caa4 100644
@@ -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 true if supported, false otherwise.
+ */
+bool smu_reset_sdma_is_supported(struct smu_context *smu)
+{
+	bool ret = false;
+
+	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
index 3630593bce61..3ba169639f54 100644
@@ -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.
+	 */
+	bool (*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);
+bool 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
index 9f2de69f53b2..9f276f393b81 100644
@@ -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 false if the capability is not supported.
+ */
+static bool smu_v13_0_6_reset_sdma_is_supported(struct smu_context *smu)
+{
+	bool ret = true;
+
+	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 = false;
+	}
+
+	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
#1 lore raw

PATCH v3 2/2 drm/amdgpu: Initialize SDMA sysfs reset mask in late_init

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

- Introduce a new function sdma_v4_4_2_init_sysfs_reset_mask to initialize the sysfs reset mask for SDMA.
- Move the initialization of the sysfs reset mask to the late_init stage to ensure that the SMU initialization and capability setup are completed before checking the SDMA reset capability.
- Consolidate the logic for setting the supported reset types and initializing the sysfs reset mask into the new function.
- 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 | 55 ++++++++++++++++++++----
 1 file changed, 47 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c +47 -8
index 4fa688e00f5e..fd2884de2dc4 100644
@@ -107,6 +107,7 @@ static void sdma_v4_4_2_set_vm_pte_funcs(struct amdgpu_device *adev);
 static void sdma_v4_4_2_set_irq_funcs(struct amdgpu_device *adev);
 static void sdma_v4_4_2_set_ras_funcs(struct amdgpu_device *adev);
 static void sdma_v4_4_2_set_engine_reset_funcs(struct amdgpu_device *adev);
+static int  sdma_v4_4_2_init_sysfs_reset_mask(struct amdgpu_device *adev);
 
 static u32 sdma_v4_4_2_get_reg_offset(struct amdgpu_device *adev,
 		u32 instance, u32 offset)
@@ -1366,6 +1367,7 @@ static int sdma_v4_4_2_process_ras_data_cb(struct amdgpu_device *adev,
 static int sdma_v4_4_2_late_init(struct amdgpu_ip_block *ip_block)
 {
 	struct amdgpu_device *adev = ip_block->adev;
+	int r;
 #if 0
 	struct ras_ih_if ih_info = {
 		.cb = sdma_v4_4_2_process_ras_data_cb,
@@ -1374,7 +1376,12 @@ static int sdma_v4_4_2_late_init(struct amdgpu_ip_block *ip_block)
 	if (!amdgpu_persistent_edc_harvesting_supported(adev))
 		amdgpu_ras_reset_error_count(adev, AMDGPU_RAS_BLOCK__SDMA);
 
-	return 0;
+	/* The initialization is done in the late_init stage to ensure that the SMU
+	 * initialization and capability setup are completed before we check the SDMA
+	 * reset capability
+	 */
+	r = sdma_v4_4_2_init_sysfs_reset_mask(adev);
+	return r;
 }
 
 static int sdma_v4_4_2_sw_init(struct amdgpu_ip_block *ip_block)
@@ -1481,10 +1488,6 @@ 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);
-
 	if (amdgpu_sdma_ras_sw_init(adev)) {
 		dev_err(adev->dev, "fail to initialize sdma ras block\n");
 		return -EINVAL;
@@ -1497,9 +1500,6 @@ static int sdma_v4_4_2_sw_init(struct amdgpu_ip_block *ip_block)
 	else
 		DRM_ERROR("Failed to allocated memory for SDMA IP Dump\n");
 
-	r = amdgpu_sdma_sysfs_reset_mask_init(adev);
-	if (r)
-		return r;
 	/* Initialize guilty flags for GFX and PAGE queues */
 	adev->sdma.gfx_guilty = false;
 	adev->sdma.page_guilty = false;
@@ -2328,6 +2328,45 @@ static void sdma_v4_4_2_set_vm_pte_funcs(struct amdgpu_device *adev)
 	adev->vm_manager.vm_pte_num_scheds = adev->sdma.num_instances;
 }
 
+/**
+ * sdma_v4_4_2_init_sysfs_reset_mask - Initialize sysfs reset mask for SDMA
+ * @adev: Pointer to the AMDGPU device structure
+ *
+ * This function initializes the sysfs reset mask for SDMA and sets the supported
+ * reset types based on the IP version and firmware versions.
+ *
+ * Returns: 0 on success, or a negative error code on failure.
+ */
+static int sdma_v4_4_2_init_sysfs_reset_mask(struct amdgpu_device *adev)
+{
+	int r = 0;
+
+	/* Set the supported reset types */
+	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->sdma.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;
+	}
+
+	/* Initialize the sysfs reset mask */
+	r = amdgpu_sdma_sysfs_reset_mask_init(adev);
+
+	return r;
+
+}
+
 const struct amdgpu_ip_block_version sdma_v4_4_2_ip_block = {
 	.type = AMD_IP_BLOCK_TYPE_SDMA,
 	.major = 4,
Signature · 1 line
2.25.1
#2 lore raw

Re: [PATCH v3 2/2] drm/amdgpu: Initialize SDMA sysfs reset mask in late_init

Quoted 39 lines · On 2/21/2025 11:47 AM, [email protected] wrote:

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

- Introduce a new function sdma_v4_4_2_init_sysfs_reset_mask to initialize the sysfs reset mask for SDMA.
- Move the initialization of the sysfs reset mask to the late_init stage to ensure that the SMU initialization and capability setup are completed before checking the SDMA reset capability.
- Consolidate the logic for setting the supported reset types and initializing the sysfs reset mask into the new function.
- 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 | 55 ++++++++++++++++++++----
 1 file changed, 47 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c +2 -0
index 4fa688e00f5e..fd2884de2dc4 100644
@@ -107,6 +107,7 @@ static void sdma_v4_4_2_set_vm_pte_funcs(struct amdgpu_device *adev);
 static void sdma_v4_4_2_set_irq_funcs(struct amdgpu_device *adev);
 static void sdma_v4_4_2_set_ras_funcs(struct amdgpu_device *adev);
 static void sdma_v4_4_2_set_engine_reset_funcs(struct amdgpu_device *adev);
+static int  sdma_v4_4_2_init_sysfs_reset_mask(struct amdgpu_device *adev);
 
 static u32 sdma_v4_4_2_get_reg_offset(struct amdgpu_device *adev,
 		u32 instance, u32 offset)
@@ -1366,6 +1367,7 @@ static int sdma_v4_4_2_process_ras_data_cb(struct amdgpu_device *adev,
 static int sdma_v4_4_2_late_init(struct amdgpu_ip_block *ip_block)
 {
 	struct amdgpu_device *adev = ip_block->adev;
+	int r;
 #if 0
 	struct ras_ih_if ih_info = {
 		.cb = sdma_v4_4_2_process_ras_data_cb,

drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c static int sdma_v4_4_2_late_init(struct amdgpu_ip_block *ip_block) · line 1383

Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c +5 -1
@@ -1374,7 +1376,12 @@ static int sdma_v4_4_2_late_init(struct amdgpu_ip_block *ip_block)
 	if (!amdgpu_persistent_edc_harvesting_supported(adev))
 		amdgpu_ras_reset_error_count(adev, AMDGPU_RAS_BLOCK__SDMA);
 
-	return 0;
+	/* The initialization is done in the late_init stage to ensure that the SMU
+	 * initialization and capability setup are completed before we check the SDMA
+	 * reset capability
+	 */
+	r = sdma_v4_4_2_init_sysfs_reset_mask(adev);

Late init is called after every reset. Since the sysfs file is created already, it will return something like -EEXIST.

Thanks,
Lijo

Quoted 71 lines
drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c +40 -7
+	return r;
 }
 
 static int sdma_v4_4_2_sw_init(struct amdgpu_ip_block *ip_block)
@@ -1481,10 +1488,6 @@ 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);
-
 	if (amdgpu_sdma_ras_sw_init(adev)) {
 		dev_err(adev->dev, "fail to initialize sdma ras block\n");
 		return -EINVAL;
@@ -1497,9 +1500,6 @@ static int sdma_v4_4_2_sw_init(struct amdgpu_ip_block *ip_block)
 	else
 		DRM_ERROR("Failed to allocated memory for SDMA IP Dump\n");
 
-	r = amdgpu_sdma_sysfs_reset_mask_init(adev);
-	if (r)
-		return r;
 	/* Initialize guilty flags for GFX and PAGE queues */
 	adev->sdma.gfx_guilty = false;
 	adev->sdma.page_guilty = false;
@@ -2328,6 +2328,45 @@ static void sdma_v4_4_2_set_vm_pte_funcs(struct amdgpu_device *adev)
 	adev->vm_manager.vm_pte_num_scheds = adev->sdma.num_instances;
 }
 
+/**
+ * sdma_v4_4_2_init_sysfs_reset_mask - Initialize sysfs reset mask for SDMA
+ * @adev: Pointer to the AMDGPU device structure
+ *
+ * This function initializes the sysfs reset mask for SDMA and sets the supported
+ * reset types based on the IP version and firmware versions.
+ *
+ * Returns: 0 on success, or a negative error code on failure.
+ */
+static int sdma_v4_4_2_init_sysfs_reset_mask(struct amdgpu_device *adev)
+{
+	int r = 0;
+
+	/* Set the supported reset types */
+	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->sdma.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;
+	}
+
+	/* Initialize the sysfs reset mask */
+	r = amdgpu_sdma_sysfs_reset_mask_init(adev);
+
+	return r;
+
+}
+
 const struct amdgpu_ip_block_version sdma_v4_4_2_ip_block = {
 	.type = AMD_IP_BLOCK_TYPE_SDMA,
 	.major = 4,
#3 lore raw

RE: [PATCH v3 2/2] drm/amdgpu: Initialize SDMA sysfs reset mask in late_init

[AMD Official Use Only - AMD Internal Distribution Only]

-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Friday, February 21, 2025 4:13 PM
To: Zhang, Jesse(Jie) <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Kim, Jonathan <[email protected]>; Zhu, Jiadong <[email protected]>; Huang, Tim <[email protected]>; Prosyak, Vitaly <[email protected]>
Subject: Re: [PATCH v3 2/2] drm/amdgpu: Initialize SDMA sysfs reset mask in late_init

Quoted 46 lines · On 2/21/2025 11:47 AM, [email protected] wrote:

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

- Introduce a new function sdma_v4_4_2_init_sysfs_reset_mask to initialize the sysfs reset mask for SDMA.
- Move the initialization of the sysfs reset mask to the late_init stage to ensure that the SMU initialization and capability setup are completed before checking the SDMA reset capability.
- Consolidate the logic for setting the supported reset types and initializing the sysfs reset mask into the new function.
- 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 | 55
++++++++++++++++++++----
 1 file changed, 47 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c +0 -0
index 4fa688e00f5e..fd2884de2dc4 100644
@@ -107,6 +107,7 @@ static void sdma_v4_4_2_set_vm_pte_funcs(struct
amdgpu_device *adev);  static void sdma_v4_4_2_set_irq_funcs(struct
amdgpu_device *adev);  static void sdma_v4_4_2_set_ras_funcs(struct
amdgpu_device *adev);  static void

sdma_v4_4_2_set_engine_reset_funcs(struct amdgpu_device *adev);

drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c +2 -0
+static int  sdma_v4_4_2_init_sysfs_reset_mask(struct amdgpu_device
+*adev);
 
 static u32 sdma_v4_4_2_get_reg_offset(struct amdgpu_device *adev,
              u32 instance, u32 offset)
@@ -1366,6 +1367,7 @@ static int

sdma_v4_4_2_process_ras_data_cb(struct amdgpu_device *adev, static

int sdma_v4_4_2_late_init(struct amdgpu_ip_block *ip_block)  {
      struct amdgpu_device *adev = ip_block->adev;
+     int r;
 #if 0
      struct ras_ih_if ih_info = {
              .cb = sdma_v4_4_2_process_ras_data_cb, @@ -1374,7 +1376,12 @@
static int sdma_v4_4_2_late_init(struct amdgpu_ip_block *ip_block)
      if (!amdgpu_persistent_edc_harvesting_supported(adev))
              amdgpu_ras_reset_error_count(adev, AMDGPU_RAS_BLOCK__SDMA);

drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c static int sdma_v4_4_2_late_init(struct amdgpu_ip_block *ip_block) · line 1383

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c +5 -1
-     return 0;
+     /* The initialization is done in the late_init stage to ensure that the SMU
+      * initialization and capability setup are completed before we check the SDMA
+      * reset capability
+      */
+     r = sdma_v4_4_2_init_sysfs_reset_mask(adev);

Late init is called after every reset. Since the sysfs file is created already, it will return something like -EEXIST.
Thanks Lijo, update the patch
Thanks,
Lijo

Quoted 72 lines
drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c +42 -8
+     return r;
 }
 
 static int sdma_v4_4_2_sw_init(struct amdgpu_ip_block *ip_block) @@
-1481,10 +1488,6 @@ 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);
-
      if (amdgpu_sdma_ras_sw_init(adev)) {
              dev_err(adev->dev, "fail to initialize sdma ras block\n");
              return -EINVAL;
@@ -1497,9 +1500,6 @@ static int sdma_v4_4_2_sw_init(struct amdgpu_ip_block *ip_block)
      else
              DRM_ERROR("Failed to allocated memory for SDMA IP Dump\n");
 
-     r = amdgpu_sdma_sysfs_reset_mask_init(adev);
-     if (r)
-             return r;
      /* Initialize guilty flags for GFX and PAGE queues */
      adev->sdma.gfx_guilty = false;
      adev->sdma.page_guilty = false;
@@ -2328,6 +2328,45 @@ static void sdma_v4_4_2_set_vm_pte_funcs(struct amdgpu_device *adev)
      adev->vm_manager.vm_pte_num_scheds = adev->sdma.num_instances;  }
 
+/**
+ * sdma_v4_4_2_init_sysfs_reset_mask - Initialize sysfs reset mask
+for SDMA
+ * @adev: Pointer to the AMDGPU device structure
+ *
+ * This function initializes the sysfs reset mask for SDMA and sets
+the supported
+ * reset types based on the IP version and firmware versions.
+ *
+ * Returns: 0 on success, or a negative error code on failure.
+ */
+static int sdma_v4_4_2_init_sysfs_reset_mask(struct amdgpu_device
+*adev) {
+     int r = 0;
+
+     /* Set the supported reset types */
+     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->sdma.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;
+     }
+
+     /* Initialize the sysfs reset mask */
+     r = amdgpu_sdma_sysfs_reset_mask_init(adev);
+
+     return r;
+
+}
+
 const struct amdgpu_ip_block_version sdma_v4_4_2_ip_block = {
      .type = AMD_IP_BLOCK_TYPE_SDMA,
      .major = 4,