Based on Christian's feedbacks:
The core concept is a per-drm_file "eventfd manager" (owned by amdgpu_fpriv)
that
maps event_id -> a list of eventfd contexts (fan-out). The manager is kref’d so
it can be safely referenced by longer-lived producer objects, such as the USERQ
fence driver, which may outlive the originating amdgpu_fpriv.
This v3 contains:
Core: amdgpu_eventfd.[ch] implements the per-file eventfd manager and wires
its lifetime into open/postclose.
USERQ: fence driver stores a kref’d amdgpu_eventfd_mgr pointer instead of
referencing amdgpu_fpriv directly.
GFX11 producer: wire GFX11 MES/userq EOP IRQ to signal a fixed event_id via
the manager, by resolving doorbell_offset -> fence_drv -> mgr.
UAPI: add two render-node ioctls to bind/unbind an eventfd to an event_id.
Notes:
Multiple eventfds can be bound to the same event_id (fan-out).
The UAPI structs contain only fixed-width scalars (no pointers), avoiding
compat ioctl issues.
Testing:
- Compile-tested only (CONFIG_DRM_AMDGPU=m).
Follow-up work:
- I will post a separate series adding the KFD/PASID bridge:
* PASID -> eventfd_mgr registry (refcounted; no PASID -> fpriv raw
pointers)
* amdgpu_eventfd_notify(pasid, event_id, count)
* Stop depending on KFD (kfd_events.c) to be the place that “converts
interrupts → eventfd wakeups”.
Do that directly in KGD (amdgpu) where the interrupts are
already handled.
Srinivasan Shanmugam (4):
drm/amdgpu: Add render-node EVENTFD manager core
drm/amdgpu/userq: Hold eventfd manager ref in fence driver
drm/amdgpu/gfx11: Wire MES EOP IRQ to render-node eventfd
drm/amdgpu/uapi: Add EVENTFD bind/unbind ioctls for render node
drivers/gpu/drm/amd/amdgpu/Makefile | 3 +-
drivers/gpu/drm/amd/amdgpu/amdgpu.h | 11 +
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 2 +
drivers/gpu/drm/amd/amdgpu/amdgpu_eventfd.c | 321 ++++++++++++++++++
drivers/gpu/drm/amd/amdgpu/amdgpu_eventfd.h | 76 +++++
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 64 +++-
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c | 2 +-
.../gpu/drm/amd/amdgpu/amdgpu_userq_fence.c | 24 +-
.../gpu/drm/amd/amdgpu/amdgpu_userq_fence.h | 4 +
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 14 +
include/uapi/drm/amdgpu_drm.h | 18 +
11 files changed, 533 insertions(+), 6 deletions(-)
create mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_eventfd.c
create mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_eventfd.h
--
2.34.1