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/#rev3

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")

Changes since v7:

* Added a USERQ_EOP WAIT_EVENT producer.

  - Record WAIT_EVENT notifications from
    amdgpu_userq_process_fence_irq().
  - Reuse the existing doorbell-to-queue lookup.
  - Keep queue-pointer-based routing internal and populate the userspace
    queue_id only when returning the matched event record.

* Added a QUEUE_RESET WAIT_EVENT producer.

  - Record WAIT_EVENT notifications from
    amdgpu_userq_handle_hung_queue().
  - Reuse the common queue reset handling shared with EVENTFD.
  - Avoid additional queue lookups or queue scans in the MES reset path.

* Added amdgpu_wait_event_add() as the common IRQ-safe helper for
  recording WAIT_EVENT records.

* Populate queue_id in the returned WAIT_EVENT record at the ioctl
  boundary rather than storing userspace queue IDs internally.

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

Only compilation tested.

Srinivasan Shanmugam (6):
  drm/amdgpu/uapi: Add WAIT_EVENT ioctl and metadata structures
  drm/amdgpu: Add wait-event manager and per-file lifetime plumbing
  drm/amdgpu: Register WAIT_EVENT ioctl
  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     |  37 +-
 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                 | 103 ++++++
 9 files changed, 567 insertions(+), 5 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