Signal USERQ EOP subscriptions through the userq manager associated with the queue, using the shared AMDGPU EVENTFD event type and a queue-scoped routing key.
In the current USERQ IRQ path, the queue object does not store an explicit logical queue_id. However, it already carries a doorbell_index, which is queue-specific and naturally available in the IRQ flow. Use the queue's doorbell_index as the queue-scoped routing key for USERQ EOP signaling. This folds the earlier intermediate gfx11 eventfd hookup into the final queue-aware signaling path, so the series only introduces the IRQ-side signaling once. For USERQ EOP, queue-scoped subscriptions are matched using the queue's doorbell_index as the queue-specific routing key. Userspace passes the same value through the current queue_id field when binding or unbinding EVENTFD subscriptions. Signaling remains notification-only and uses plain eventfd_signal(ctx) once per matched occurrence. 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 | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c index 8c82e90f871b..ff43902a9c48 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c @@ -26,6 +26,8 @@ #include <linux/module.h> #include <linux/pci.h> #include "amdgpu.h" +#include "amdgpu_userq.h" +#include "amdgpu_eventfd.h" #include "amdgpu_gfx.h" #include "amdgpu_psp.h" #include "amdgpu_smu.h" @@ -6523,14 +6525,27 @@ 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_usermode_queue *queue = NULL; + struct amdgpu_userq_mgr *mgr = NULL; struct xarray *xa = &adev->userq_doorbell_xa; + u32 queue_key = 0; unsigned long flags; xa_lock_irqsave(xa, flags); queue = xa_load(xa, doorbell_offset); - if (queue) + if (queue && queue->fence_drv) amdgpu_userq_fence_driver_process(queue->fence_drv); + + if (queue) { + mgr = queue->userq_mgr; + queue_key = queue->doorbell_index; + } + + if (mgr && mgr->eventfd_mgr) + amdgpu_eventfd_signal(mgr->eventfd_mgr, + DRM_AMDGPU_EVENT_TYPE_USERQ_EOP, + queue_key); + xa_unlock_irqrestore(xa, flags); } else { me_id = (entry->ring_id & 0x0c) >> 2; -- 2.34.1
