Extend WAIT_EVENT with optional userspace condition-wait fields. When provided, WAIT_EVENT completes only when both: - a matching event record exists, and - the userspace condition passes
The condition uses a userspace address, value, mask, and compare operator. This keeps the existing WAIT_EVENT behavior unchanged when no condition fields are specified. Cc: Alex Deucher <[email protected]> Cc: Christian König <[email protected]> Signed-off-by: Srinivasan Shanmugam <[email protected]> --- include/uapi/drm/amdgpu_drm.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/include/uapi/drm/amdgpu_drm.h b/include/uapi/drm/amdgpu_drm.h index d2038d38645a..82c6f3bd628b 100644 --- a/include/uapi/drm/amdgpu_drm.h +++ b/include/uapi/drm/amdgpu_drm.h @@ -250,6 +250,16 @@ struct drm_amdgpu_eventfd { __u32 flags; }; +enum drm_amdgpu_wait_cond_op { + DRM_AMDGPU_WAIT_COND_NONE = 0, + DRM_AMDGPU_WAIT_COND_EQ = 1, + DRM_AMDGPU_WAIT_COND_NEQ = 2, + DRM_AMDGPU_WAIT_COND_GT = 3, + DRM_AMDGPU_WAIT_COND_GTE = 4, + DRM_AMDGPU_WAIT_COND_LT = 5, + DRM_AMDGPU_WAIT_COND_LTE = 6, +}; + /** * struct drm_amdgpu_wait_event_queue - queue-scoped event metadata * @queue_id: queue selector @@ -337,9 +347,17 @@ struct drm_amdgpu_wait_event_data { * @out_ptr: userspace pointer to struct drm_amdgpu_wait_event_data * @out_size: size of userspace output buffer * @flags: must be 0 + * @cond_op: optional condition compare operator + * @reserved0: reserved, must be 0 + * @cond_addr: optional userspace address for condition waiting + * @cond_value: comparison value for condition waiting + * @cond_mask: mask for condition waiting * * Wait for the selected event and copy the first matching event record to * userspace. Matching records are consumed by a single waiter. + * + * If @cond_op is not DRM_AMDGPU_WAIT_COND_NONE, WAIT_EVENT completes only + * when both the event selection and the userspace condition pass. */ struct drm_amdgpu_wait_event { __u32 event_type; @@ -348,6 +366,12 @@ struct drm_amdgpu_wait_event { __u64 out_ptr; __u32 out_size; __u32 flags; + __u16 cond_op; + __u16 reserved0; + __u32 reserved1; + __u64 cond_addr; + __u64 cond_value; + __u64 cond_mask; }; /** Opcode to create new residency list. */ -- 2.34.1
