The queue reset path already resolves the affected queue directly from
the doorbell and funnels successful reset handling through
amdgpu_userq_handle_hung_queue(). Reuse that common handling point to
create the corresponding WAIT_EVENT record.

Keeping the notification in the common helper ensures that queue state
is updated before userspace is notified and that both EVENTFD and
WAIT_EVENT observe the same reset. It also avoids duplicating the
doorbell lookup or adding a queue scan in the MES reset path.

No MES or GFX interrupt changes are needed.

Signed-off-by: Srinivasan Shanmugam <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
index 1abc05779192..8d081fda3e52 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
@@ -271,8 +271,8 @@ void amdgpu_userq_process_fence_irq(struct amdgpu_device 
*adev, u32 doorbell)
  * @adev: AMDGPU device
  * @queue: affected user queue
  *
- * Mark the queue as hung, notify matching QUEUE_RESET EVENTFD
- * subscribers, force-complete its fences, and send the DRM wedged event.
+ * Mark the queue as hung, notify userspace of the queue reset,
+ * force-complete its fences, and send the DRM wedged event.
  *
  * Return:
  * true when the queue was handled, false for an invalid queue.
@@ -282,6 +282,7 @@ amdgpu_userq_handle_hung_queue(struct amdgpu_device *adev,
                               struct amdgpu_usermode_queue *queue)
 {
        struct amdgpu_eventfd_mgr *eventfd_mgr;
+       struct amdgpu_wait_event_mgr *wait_event_mgr;
 
        if (!queue)
                return false;
@@ -293,6 +294,11 @@ amdgpu_userq_handle_hung_queue(struct amdgpu_device *adev,
                              DRM_AMDGPU_EVENT_TYPE_QUEUE_RESET,
                              queue);
 
+       wait_event_mgr = amdgpu_userq_wait_event_mgr(queue->userq_mgr);
+       amdgpu_wait_event_add(wait_event_mgr,
+                             DRM_AMDGPU_EVENT_TYPE_QUEUE_RESET,
+                             queue);
+
        amdgpu_userq_fence_driver_force_completion(queue);
 
        drm_dev_wedged_event(adev_to_drm(adev),
-- 
2.34.1

Reply via email to