From: "jesse.zh...@amd.com" <jesse.zh...@amd.com>

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

Suggested-by: Jonathan Kim <jonathan....@amd.com>
Signed-off-by: Vitaly Prosyak <vitaly.pros...@amd.com>
Signed-off-by: Jesse Zhang <jesse.zh...@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c 
b/drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c
index 9925b183c07f..0e004b156e95 100644
--- a/drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c
+++ b/drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c
@@ -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");
-- 
2.25.1

Reply via email to