]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
drm/amdgpu: Add fallback to pipe reset if KCQ ring reset fails
authorJesse.Zhang <Jesse.Zhang@amd.com>
Tue, 16 Sep 2025 05:11:06 +0000 (13:11 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 13 Nov 2025 20:37:31 +0000 (15:37 -0500)
[ Upstream commit 7469567d882374dcac3fdb8b300e0f28cf875a75 ]

Add a fallback mechanism to attempt pipe reset when KCQ reset
fails to recover the ring. After performing the KCQ reset and
queue remapping, test the ring functionality. If the ring test
fails, initiate a pipe reset as an additional recovery step.

v2: fix the typo (Lijo)
v3: try pipeline reset when kiq mapping fails (Lijo)

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Signed-off-by: Jesse Zhang <Jesse.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c

index 51babf5c78c86c20ef806e31e9d0a4185ffda5b8..f06bc94cf6e142b074bed053e1c2d3d9b35274a6 100644 (file)
@@ -3562,6 +3562,7 @@ static int gfx_v9_4_3_reset_kcq(struct amdgpu_ring *ring,
        struct amdgpu_device *adev = ring->adev;
        struct amdgpu_kiq *kiq = &adev->gfx.kiq[ring->xcc_id];
        struct amdgpu_ring *kiq_ring = &kiq->ring;
+       int reset_mode = AMDGPU_RESET_TYPE_PER_QUEUE;
        unsigned long flags;
        int r;
 
@@ -3599,6 +3600,7 @@ pipe_reset:
                if (!(adev->gfx.compute_supported_reset & AMDGPU_RESET_TYPE_PER_PIPE))
                        return -EOPNOTSUPP;
                r = gfx_v9_4_3_reset_hw_pipe(ring);
+               reset_mode = AMDGPU_RESET_TYPE_PER_PIPE;
                dev_info(adev->dev, "ring: %s pipe reset :%s\n", ring->name,
                                r ? "failed" : "successfully");
                if (r)
@@ -3621,10 +3623,20 @@ pipe_reset:
        r = amdgpu_ring_test_ring(kiq_ring);
        spin_unlock_irqrestore(&kiq->ring_lock, flags);
        if (r) {
+               if (reset_mode == AMDGPU_RESET_TYPE_PER_QUEUE)
+                       goto pipe_reset;
+
                dev_err(adev->dev, "fail to remap queue\n");
                return r;
        }
 
+       if (reset_mode == AMDGPU_RESET_TYPE_PER_QUEUE) {
+               r = amdgpu_ring_test_ring(ring);
+               if (r)
+                       goto pipe_reset;
+       }
+
+
        return amdgpu_ring_reset_helper_end(ring, timedout_fence);
 }