Skip to contentSkip to conversation

drm/amdgpu/sdma7: Add queue reset sysfs for sdmav7

PATCH In review [email protected] 3 participants 3 messages Dec 10, 2024

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

PATCH 5/5 drm/amdgpu/sdma7: Add queue reset sysfs for sdmav7

sdmv7 queue reset already supports by mmio, add its sys file.

---
 drivers/gpu/drm/amd/amdgpu/sdma_v7_0.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/sdma_v7_0.c +7 -1
index 627e0173b64d..8e69b84e0165 100644
@@ -1368,6 +1368,9 @@ static int sdma_v7_0_sw_init(struct amdgpu_ip_block *ip_block)
 			return r;
 	}
 
+	adev->sdma.supported_reset =
+		amdgpu_get_soft_full_reset_mask(&adev->sdma.instance[0].ring);
+	adev->sdma.supported_reset |= AMDGPU_RESET_TYPE_PER_QUEUE;
 	/* Allocate memory for SDMA IP Dump buffer */
 	ptr = kcalloc(adev->sdma.num_instances * reg_count, sizeof(uint32_t), GFP_KERNEL);
 	if (ptr)
@@ -1378,7 +1381,9 @@ static int sdma_v7_0_sw_init(struct amdgpu_ip_block *ip_block)
 #ifdef CONFIG_DRM_AMDGPU_NAVI3X_USERQ
 	adev->userq_funcs[AMDGPU_HW_IP_DMA] = &userq_mes_funcs;
 #endif
-
+	r = amdgpu_sdma_sysfs_reset_mask_init(adev);
+	if (r)
+		return r;
 
 	return r;
 }
@@ -1391,6 +1396,7 @@ static int sdma_v7_0_sw_fini(struct amdgpu_ip_block *ip_block)
 	for (i = 0; i < adev->sdma.num_instances; i++)
 		amdgpu_ring_fini(&adev->sdma.instance[i].ring);
 
+	amdgpu_sdma_sysfs_reset_mask_fini(adev);
 	amdgpu_sdma_destroy_inst_ctx(adev, true);
 
 	if (adev->firmware.load_type == AMDGPU_FW_LOAD_DIRECT)
Signature · 1 line
2.25.1
maintainer Reviewed-by on v1 5/5
#1 lore raw

[Public]

Series is:

________________________________
From: amd-gfx <[email protected]> on behalf of [email protected] <[email protected]>
Sent: Monday, December 9, 2024 10:53 PM
To: [email protected] <[email protected]>
Cc: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Zhu, Jiadong <[email protected]>; Liang, Prike <[email protected]>; Huang, Tim <[email protected]>; Zhang, Jesse(Jie) <[email protected]>
Subject: [PATCH 5/5] drm/amdgpu/sdma7: Add queue reset sysfs for sdmav7

sdmv7 queue reset already supports by mmio, add its sys file.

---
 drivers/gpu/drm/amd/amdgpu/sdma_v7_0.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/sdma_v7_0.c +7 -1
index 627e0173b64d..8e69b84e0165 100644
@@ -1368,6 +1368,9 @@ static int sdma_v7_0_sw_init(struct amdgpu_ip_block *ip_block)
                         return r;
         }
 
+       adev->sdma.supported_reset =
+               amdgpu_get_soft_full_reset_mask(&adev->sdma.instance[0].ring);
+       adev->sdma.supported_reset |= AMDGPU_RESET_TYPE_PER_QUEUE;
         /* Allocate memory for SDMA IP Dump buffer */
         ptr = kcalloc(adev->sdma.num_instances * reg_count, sizeof(uint32_t), GFP_KERNEL);
         if (ptr)
@@ -1378,7 +1381,9 @@ static int sdma_v7_0_sw_init(struct amdgpu_ip_block *ip_block)
 #ifdef CONFIG_DRM_AMDGPU_NAVI3X_USERQ
         adev->userq_funcs[AMDGPU_HW_IP_DMA] = &userq_mes_funcs;
 #endif
-
+       r = amdgpu_sdma_sysfs_reset_mask_init(adev);
+       if (r)
+               return r;
 
         return r;
 }
@@ -1391,6 +1396,7 @@ static int sdma_v7_0_sw_fini(struct amdgpu_ip_block *ip_block)
         for (i = 0; i < adev->sdma.num_instances; i++)
                 amdgpu_ring_fini(&adev->sdma.instance[i].ring);
 
+       amdgpu_sdma_sysfs_reset_mask_fini(adev);
         amdgpu_sdma_destroy_inst_ctx(adev, true);
 
         if (adev->firmware.load_type == AMDGPU_FW_LOAD_DIRECT)

--
2.25.1

#2 lore raw
In reply to [email protected]
Quoted 22 lines · On 2024-12-09 22:53, [email protected] wrote:

sdmv7 queue reset already supports by mmio, add its sys file.

---
  drivers/gpu/drm/amd/amdgpu/sdma_v7_0.c | 8 +++++++-
  1 file changed, 7 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/sdma_v7_0.c +3 -0
index 627e0173b64d..8e69b84e0165 100644
@@ -1368,6 +1368,9 @@ static int sdma_v7_0_sw_init(struct amdgpu_ip_block *ip_block)
  			return r;
  	}
 
+	adev->sdma.supported_reset =
+		amdgpu_get_soft_full_reset_mask(&adev->sdma.instance[0].ring);
+	adev->sdma.supported_reset |= AMDGPU_RESET_TYPE_PER_QUEUE;
  	/* Allocate memory for SDMA IP Dump buffer */
  	ptr = kcalloc(adev->sdma.num_instances * reg_count, sizeof(uint32_t), GFP_KERNEL);
  	if (ptr)

drivers/gpu/drm/amd/amdgpu/sdma_v7_0.c static int sdma_v7_0_sw_init(struct amdgpu_ip_block *ip_block) · line 1388

Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/sdma_v7_0.c +3 -1
@@ -1378,7 +1381,9 @@ static int sdma_v7_0_sw_init(struct amdgpu_ip_block *ip_block)
  #ifdef CONFIG_DRM_AMDGPU_NAVI3X_USERQ
  	adev->userq_funcs[AMDGPU_HW_IP_DMA] = &userq_mes_funcs;
  #endif
-
+	r = amdgpu_sdma_sysfs_reset_mask_init(adev);
+	if (r)
+		return r;
 
  	return r;

4 lines above - should it be one line only? I hope the compiler can optimize the code to be same as below. At lease we can remove "if (r)" to be sure no extra instruction is generated.

return amdgpu_sdma_sysfs_reset_mask_init(adev);

David

Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/sdma_v7_0.c +1 -0
  }
@@ -1391,6 +1396,7 @@ static int sdma_v7_0_sw_fini(struct amdgpu_ip_block *ip_block)
  	for (i = 0; i < adev->sdma.num_instances; i++)
  		amdgpu_ring_fini(&adev->sdma.instance[i].ring);
 
+	amdgpu_sdma_sysfs_reset_mask_fini(adev);
  	amdgpu_sdma_destroy_inst_ctx(adev, true);
 
  	if (adev->firmware.load_type == AMDGPU_FW_LOAD_DIRECT)