Queue USERQ_EOP event records into the per-file wait-event manager from
the gfx11 EOP interrupt path.

This wires the first producer into the WAIT_EVENT path.

Use the doorbell offset as the current queue selector for queue-scoped
waiting. This keeps the initial wait path independent of a separate
logical queue id definition.

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

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
index 4ee53178cdea..7d737d55c817 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
@@ -1185,6 +1185,7 @@ int amdgpu_userq_mgr_init(struct amdgpu_userq_mgr 
*userq_mgr, struct drm_file *f
        userq_mgr->adev = adev;
        userq_mgr->file = file_priv;
        userq_mgr->eventfd_mgr = fpriv ? &fpriv->eventfd_mgr : NULL;
+       userq_mgr->wait_event_mgr = fpriv ? &fpriv->wait_event_mgr : NULL;
 
        INIT_DELAYED_WORK(&userq_mgr->resume_work, amdgpu_userq_restore_worker);
        INIT_WORK(&userq_mgr->reset_work, amdgpu_userq_mgr_reset_work);
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.h 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.h
index 3941028af4a6..66ef69311205 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq.h
@@ -129,6 +129,7 @@ struct amdgpu_userq_mgr {
        struct delayed_work             resume_work;
        struct drm_file                 *file;
        struct amdgpu_eventfd_mgr       *eventfd_mgr;
+       struct amdgpu_wait_event_mgr    *wait_event_mgr;
 
        /**
         * @reset_work:
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c 
b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
index a47e8caf519a..1bd1eee77262 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
@@ -6500,6 +6500,10 @@ static int gfx_v11_0_eop_irq(struct amdgpu_device *adev,
                                       DRM_AMDGPU_EVENT_TYPE_USERQ_EOP,
                                       queue_key);
 
+       if (mgr && mgr->wait_event_mgr)
+               amdgpu_wait_event_push_userq_eop(mgr->wait_event_mgr,
+                                                queue_key, 0, 0, 0);
+
         xa_unlock_irqrestore(xa, flags);
        } else {
                me_id = (entry->ring_id & 0x0c) >> 2;
-- 
2.34.1

Reply via email to