Signal USERQ EOP EVENTFD subscriptions from the USERQ IRQ path.

The EOP interrupt already tells us which queue completed. Use that queue
to wake up the matching EVENTFD subscribers.

This keeps EVENTFD routing based on the actual queue object instead of
queue identifiers or doorbell offsets, avoiding issues with queue
identifier reuse.

EVENTFD remains notification-only.

Cc: Alex Deucher <[email protected]>
Cc: Christian König <[email protected]>
Signed-off-by: Srinivasan Shanmugam <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c 
b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
index 1941bfbcbfbf..565447d7790b 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
@@ -6488,7 +6488,22 @@ static int gfx_v11_0_eop_irq(struct amdgpu_device *adev,
        DRM_DEBUG("IH: CP EOP\n");
 
        if (adev->enable_mes && doorbell_offset) {
+               struct amdgpu_usermode_queue *queue;
+               struct amdgpu_eventfd_mgr *eventfd_mgr;
+               struct xarray *xa = &adev->userq_doorbell_xa;
+               unsigned long flags;
+
                amdgpu_userq_process_fence_irq(adev, doorbell_offset);
+
+               xa_lock_irqsave(xa, flags);
+               queue = xa_load(xa, doorbell_offset);
+               if (queue) {
+                       eventfd_mgr = 
amdgpu_userq_eventfd_mgr(queue->userq_mgr);
+                       amdgpu_eventfd_signal(eventfd_mgr,
+                                             DRM_AMDGPU_EVENT_TYPE_USERQ_EOP,
+                                             queue);
+               }
+               xa_unlock_irqrestore(xa, flags);
        } else {
                me_id = (entry->ring_id & 0x0c) >> 2;
                pipe_id = (entry->ring_id & 0x03) >> 0;
-- 
2.34.1

Reply via email to