drm/amdgpu: add check before free wb entry
authorJesse Zhang <jesse.zhang@amd.com>
Wed, 24 Apr 2024 04:59:22 +0000 (12:59 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 26 Apr 2024 21:22:43 +0000 (17:22 -0400)
Check if ring is not a mes queue before freeing the wb entry,
because we only allocate a wb entry when it's not a mes queue.

Signed-off-by: Jesse Zhang <jesse.zhang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c
drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c
drivers/gpu/drm/amd/amdgpu/sdma_v6_0.c

index 45a2d0a..b7d33d7 100644 (file)
@@ -999,7 +999,8 @@ static int sdma_v5_0_ring_test_ring(struct amdgpu_ring *ring)
        r = amdgpu_ring_alloc(ring, 20);
        if (r) {
                DRM_ERROR("amdgpu: dma failed to lock ring %d (%d).\n", ring->idx, r);
-               amdgpu_device_wb_free(adev, index);
+               if (!ring->is_mes_queue)
+                       amdgpu_device_wb_free(adev, index);
                return r;
        }
 
index 43e64b2..cc9e961 100644 (file)
@@ -839,7 +839,8 @@ static int sdma_v5_2_ring_test_ring(struct amdgpu_ring *ring)
        r = amdgpu_ring_alloc(ring, 20);
        if (r) {
                DRM_ERROR("amdgpu: dma failed to lock ring %d (%d).\n", ring->idx, r);
-               amdgpu_device_wb_free(adev, index);
+               if (!ring->is_mes_queue)
+                       amdgpu_device_wb_free(adev, index);
                return r;
        }
 
index 1f48771..c833b6b 100644 (file)
@@ -861,7 +861,8 @@ static int sdma_v6_0_ring_test_ring(struct amdgpu_ring *ring)
        r = amdgpu_ring_alloc(ring, 5);
        if (r) {
                DRM_ERROR("amdgpu: dma failed to lock ring %d (%d).\n", ring->idx, r);
-               amdgpu_device_wb_free(adev, index);
+               if (!ring->is_mes_queue)
+                       amdgpu_device_wb_free(adev, index);
                return r;
        }