This series introduces a render-node WAIT_EVENT ioctl for retrieving
AMDGPU event records and associated metadata.

WAIT_EVENT complements the EVENTFD notification interface. EVENTFD
provides lightweight wakeups when an event occurs, while WAIT_EVENT
allows userspace to retrieve the corresponding event type, queue
identity, and event-specific metadata.

This series builds on the render-node EVENTFD infrastructure introduced
in:

  https://patchwork.freedesktop.org/series/164618/#rev7

It also depends on the EVENTFD producer series:

  drm/amdgpu: Wire GPU events into EVENTFD notifications
  https://patchwork.freedesktop.org/series/168402/#rev4

The series adds the WAIT_EVENT infrastructure and producers for
USERQ_EOP and QUEUE_RESET event records.

Base branch:
  origin/amd-unified-interface

Base commit:
  540d68973c0b
  ("drm/amdgpu/userq: fix NULL deref in amdgpu_userq_evict_all")

The patches are organized as follows:

  1. Define the WAIT_EVENT ioctl and metadata structures.
  2. Add the per-file WAIT_EVENT manager, lifetime handling, and ioctl
     registration.
  3. Remove queue-scoped WAIT_EVENT records during queue teardown.
  4. Record USERQ_EOP WAIT_EVENT notifications.
  5. Record QUEUE_RESET WAIT_EVENT notifications.

WAIT_EVENT records are maintained per DRM file. For queue-scoped
events, queue_id is treated as a userspace USERQ handle and is resolved
to the corresponding queue object at the ioctl boundary. Internally,
records are matched using queue pointer equality and hold queue
references while pending.

Changes since v8:

* Clarified the WAIT_EVENT UAPI documentation for queue_id.

  - Document queue_id as the userspace USERQ queue handle for a queue
    created through DRM_IOCTL_AMDGPU_USERQ.
  - Apply the same clarification to the ioctl arguments and returned
    queue-scoped metadata.

* Squashed the WAIT_EVENT ioctl registration patch into the wait-event
  manager and per-file lifetime plumbing patch, as suggested by Alex.

* Reduced the series from six patches to five patches.

* Rebased onto the latest EVENTFD infrastructure and EVENTFD producer
  series.

The USERQ_EOP and QUEUE_RESET producer implementations are unchanged
from v8 and retain Alex's Reviewed-by tags.

Only compilation tested.

Srinivasan Shanmugam (5):
  drm/amdgpu/uapi: Add WAIT_EVENT ioctl and metadata structures
  drm/amdgpu: Add wait-event manager and per-file lifetime plumbing
  drm/amdgpu: Remove queue-scoped WAIT_EVENT records on queue teardown
  drm/amdgpu: Record USERQ_EOP WAIT_EVENT notifications
  drm/amdgpu: Record QUEUE_RESET WAIT_EVENT notifications

 drivers/gpu/drm/amd/amdgpu/Makefile           |   2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu.h           |   5 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c       |   1 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c       |   5 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c     |  33 ++
 drivers/gpu/drm/amd/amdgpu/amdgpu_userq.h     |   2 +
 .../gpu/drm/amd/amdgpu/amdgpu_wait_event.c    | 339 ++++++++++++++++++
 .../gpu/drm/amd/amdgpu/amdgpu_wait_event.h    |  78 ++++
 include/uapi/drm/amdgpu_drm.h                 | 109 ++++++
 9 files changed, 571 insertions(+), 3 deletions(-)
 create mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_wait_event.c
 create mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_wait_event.h

-- 
2.34.1

Reply via email to