On 2/16/26 16:49, Srinivasan Shanmugam wrote: > Introduce two new UAPI ioctls to allow userspace to bind and unbind > an eventfd to a userspace-defined event_id on the render node. > > DRM_AMDGPU_EVENTFD_BIND > DRM_AMDGPU_EVENTFD_UNBIND > > The bind ioctl associates an eventfd file descriptor with an event_id > within the context of a drm_file (i.e., per-process / per-PASID). > When a matching interrupt or driver event occurs, the kernel can > signal the corresponding eventfd, allowing userspace to use poll/epoll > for event notification. > > The unbind ioctl removes the association.
Please re-order the patches. This is the uAPI which finally enables the feature for userspace and should come last. > > Cc: Harish Kasiviswanathan <[email protected]> > Cc: Felix Kuehling <[email protected]> > Cc: Alex Deucher <[email protected]> > Cc: Christian König <[email protected]> > Signed-off-by: Srinivasan Shanmugam <[email protected]> > Change-Id: I02faa7404c10c40d74c9aa2d4a367c226b8b23fd > --- > include/uapi/drm/amdgpu_drm.h | 35 ++++++++++++++++++++++++++++++++++- > 1 file changed, 34 insertions(+), 1 deletion(-) > > diff --git a/include/uapi/drm/amdgpu_drm.h b/include/uapi/drm/amdgpu_drm.h > index 33e8738ce91f..4b367352bebb 100644 > --- a/include/uapi/drm/amdgpu_drm.h > +++ b/include/uapi/drm/amdgpu_drm.h > @@ -39,6 +39,8 @@ extern "C" { > #endif > > #define DRM_AMDGPU_GEM_CREATE 0x00 > +#define DRM_AMDGPU_EVENTFD_BIND 0x1A /* render-node eventfd > bind */ > +#define DRM_AMDGPU_EVENTFD_UNBIND 0x1B /* render-node eventfd unbind */ Please no comment behind defines, additional to that the comments don't seem to add new information. > #define DRM_AMDGPU_GEM_MMAP 0x01 > #define DRM_AMDGPU_CTX 0x02 > #define DRM_AMDGPU_BO_LIST 0x03 > @@ -79,7 +81,12 @@ extern "C" { > #define DRM_IOCTL_AMDGPU_USERQ_SIGNAL DRM_IOWR(DRM_COMMAND_BASE + > DRM_AMDGPU_USERQ_SIGNAL, struct drm_amdgpu_userq_signal) > #define DRM_IOCTL_AMDGPU_USERQ_WAIT DRM_IOWR(DRM_COMMAND_BASE + > DRM_AMDGPU_USERQ_WAIT, struct drm_amdgpu_userq_wait) > #define DRM_IOCTL_AMDGPU_GEM_LIST_HANDLES DRM_IOWR(DRM_COMMAND_BASE + > DRM_AMDGPU_GEM_LIST_HANDLES, struct drm_amdgpu_gem_list_handles) > - > +#define DRM_IOCTL_AMDGPU_EVENTFD_BIND \ > + DRM_IOW(DRM_COMMAND_BASE + DRM_AMDGPU_EVENTFD_BIND, \ > + struct drm_amdgpu_eventfd_bind) > +#define DRM_IOCTL_AMDGPU_EVENTFD_UNBIND \ > + DRM_IOW(DRM_COMMAND_BASE + DRM_AMDGPU_EVENTFD_UNBIND, \ > + struct drm_amdgpu_eventfd_unbind) > /** > * DOC: memory domains > * > @@ -204,6 +211,32 @@ union drm_amdgpu_gem_create { > struct drm_amdgpu_gem_create_out out; > }; > > +/** > + * struct drm_amdgpu_eventfd_bind - bind an eventfd to an event_id > + * @event_id: userspace-defined event id (e.g., HSA signal event id) > + * @eventfd: userspace eventfd file descriptor to signal > + * @flags: reserved for future use, must be 0 > + * > + * Semantics: > + * - bind is per drm_file (per process / per PASID context) > + * - multiple GPUs: userspace repeats bind on each render node > + */ > +struct drm_amdgpu_eventfd_bind { > + __u32 event_id; > + __s32 eventfd; > + __u32 flags; > +}; > + > +/** > + * struct drm_amdgpu_eventfd_unbind - unbind an eventfd from an event_id > + * @event_id: event id to unbind > + * @flags: reserved for future use, must be 0 > + */ > +struct drm_amdgpu_eventfd_unbind { > + __u32 event_id; Why no eventfd on unbind? For the design generally leep in mind that we can have multiple eventfd bound to the same signal! Regards, Christian. > + __u32 flags; > +}; > + > /** Opcode to create new residency list. */ > #define AMDGPU_BO_LIST_OP_CREATE 0 > /** Opcode to destroy previously created residency list */
