Signal a fixed event_id on GFX11 MES/userq EOP interrupts. Resolve doorbell_offset -> userq (adev->userq_doorbell_xa) and signal the per-file eventfd manager embedded in amdgpu_fpriv.
This avoids storing eventfd manager pointers in longer-lived objects. Cc: Alex Deucher <[email protected]> Cc: Christian König <[email protected]> Signed-off-by: Srinivasan Shanmugam <[email protected]> Change-Id: I53a61e1d58983ccc99e1978effee72aac71ee0b4 --- drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 30 +++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c index b1a1b8a10a08..8af57625d7a3 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" @@ -54,6 +56,8 @@ #define GFX11_NUM_GFX_RINGS 1 #define GFX11_MEC_HPD_SIZE 2048 +#define AMDGPU_EVENT_ID_USERQ_EOP 1 + #define RLCG_UCODE_LOADING_START_ADDRESS 0x00002000L #define RLC_PG_DELAY_3_DEFAULT_GC_11_0_1 0x1388 @@ -6488,14 +6492,30 @@ 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_userq_fence_driver *fence_drv = NULL; - struct xarray *xa = &adev->userq_xa; + struct amdgpu_usermode_queue *queue = NULL; + struct amdgpu_fpriv *fpriv = NULL; + struct drm_file *file = NULL; + struct xarray *xa = &adev->userq_doorbell_xa; unsigned long flags; xa_lock_irqsave(xa, flags); - fence_drv = xa_load(xa, doorbell_offset); - if (fence_drv) - amdgpu_userq_fence_driver_process(fence_drv); + queue = xa_load(xa, doorbell_offset); + + if (queue && queue->fence_drv) + amdgpu_userq_fence_driver_process(queue->fence_drv); + + /* + * Resolve per-file manager via queue -> userq_mgr -> file. + * file->driver_priv remains valid while the queue exists. + */ + if (queue && queue->userq_mgr) + file = READ_ONCE(queue->userq_mgr->file); + if (file) { + fpriv = READ_ONCE(file->driver_priv); + if (fpriv) + amdgpu_eventfd_signal(&fpriv->eventfd_mgr, + AMDGPU_EVENT_ID_USERQ_EOP); + } xa_unlock_irqrestore(xa, flags); } else { me_id = (entry->ring_id & 0x0c) >> 2; -- 2.34.1
