[PATCH 20/36] drm/amdgpu/sdma7: re-emit unprocessed state on ring reset
Alex Deucher
alexander.deucher at amd.com
Tue Jun 17 03:07:59 UTC 2025
Re-emit the unprocessed state after resetting the queue.
Signed-off-by: Alex Deucher <alexander.deucher at amd.com>
---
drivers/gpu/drm/amd/amdgpu/sdma_v7_0.c | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v7_0.c b/drivers/gpu/drm/amd/amdgpu/sdma_v7_0.c
index 40416f2d03238..2b8e9239ad0ba 100644
--- a/drivers/gpu/drm/amd/amdgpu/sdma_v7_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/sdma_v7_0.c
@@ -802,11 +802,23 @@ static bool sdma_v7_0_check_soft_reset(struct amdgpu_ip_block *ip_block)
return false;
}
+static bool sdma_v7_0_is_queue_selected(struct amdgpu_device *adev,
+ uint32_t instance_id)
+{
+ /* we always use queue0 for KGD */
+ u32 context_status = RREG32(sdma_v7_0_get_reg_offset(adev, instance_id,
+ regSDMA0_QUEUE0_CONTEXT_STATUS));
+
+ /* Check if the SELECTED bit is set */
+ return (context_status & SDMA0_QUEUE0_CONTEXT_STATUS__SELECTED_MASK) != 0;
+}
+
static int sdma_v7_0_reset_queue(struct amdgpu_ring *ring,
unsigned int vmid,
struct amdgpu_fence *guilty_fence)
{
struct amdgpu_device *adev = ring->adev;
+ bool is_guilty;
int i, r;
if (amdgpu_sriov_vf(adev))
@@ -822,7 +834,8 @@ static int sdma_v7_0_reset_queue(struct amdgpu_ring *ring,
return -EINVAL;
}
- drm_sched_wqueue_stop(&ring->sched);
+ is_guilty = sdma_v7_0_is_queue_selected(adev, i);
+ amdgpu_ring_reset_helper_begin(ring, is_guilty ? guilty_fence : NULL);
r = amdgpu_mes_reset_legacy_queue(adev, ring, vmid, true);
if (r)
@@ -831,9 +844,8 @@ static int sdma_v7_0_reset_queue(struct amdgpu_ring *ring,
r = sdma_v7_0_gfx_resume_instance(adev, i, true);
if (r)
return r;
- amdgpu_fence_driver_force_completion(ring);
- drm_sched_wqueue_start(&ring->sched);
- return 0;
+
+ return amdgpu_ring_reset_helper_end(ring, is_guilty ? guilty_fence : NULL);
}
/**
--
2.49.0
More information about the amd-gfx
mailing list