This series introduces a render-node eventfd subscription mechanism to allow userspace to receive notifications for selected GPU events via eventfd.
Userspace can bind an eventfd to a driver-defined event_id through a render node ioctl. When the corresponding event occurs, the driver signals the associated eventfd contexts. The initial producer implemented in this series is the GFX11 MES USERQ EOP interrupt path. The eventfd manager is embedded in amdgpu_fpriv and therefore tied to the lifetime of the drm_file. The IRQ producer resolves the manager at signal time through the queue -> file -> fpriv path, avoiding storing manager pointers in longer-lived objects. Duplicate binds of the same (event_id, eventfd) are treated as idempotent. This series introduces a render-node eventfd subscription mechanism to allow userspace to receive notifications for selected GPU events via eventfd. Userspace can bind an eventfd to a driver-defined event_id through a render node ioctl. When the corresponding event occurs, the driver signals the associated eventfd contexts. The initial producer implemented in this series is the GFX11 MES USERQ EOP interrupt path. The eventfd manager is embedded in amdgpu_fpriv and therefore tied to the lifetime of the drm_file. The IRQ producer resolves the manager at signal time through the queue -> file -> fpriv path, avoiding storing manager pointers in longer-lived objects. Duplicate binds of the same (event_id, eventfd) are treated as idempotent. Changes since v3: * Use eventfd_ctx pointer as binding identity instead of fd number * Make duplicate (event_id, ctx) binds idempotent * Replace manager bind limit locking with atomic counter * Add helper for xarray get-or-create event_id * Tie eventfd manager lifetime to drm_file (amdgpu_fpriv) * Remove eventfd manager pointer from fence driver * Resolve eventfd manager in IRQ via queue -> file -> fpriv * Fix build issues and minor cleanup Only compilation tested. Suggested-by: Christian König <[email protected]> Signed-off-by: Srinivasan Shanmugam <[email protected]> Srinivasan Shanmugam (4): drm/amdgpu: Add render-node EVENTFD manager core drm/amdgpu: Embed eventfd manager in amdgpu_fpriv 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 | 9 + drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 2 + drivers/gpu/drm/amd/amdgpu/amdgpu_eventfd.c | 279 ++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_eventfd.h | 59 +++++ drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 33 +++ drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 30 ++- include/uapi/drm/amdgpu_drm.h | 33 +++ 8 files changed, 442 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
