dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 0/4] Extend drm_ras for qaic telemetry
@ 2026-11-17 23:34 Zack McKevitt
  2026-11-17 23:34 ` [PATCH v4 1/4] drm/drm_ras: Reference-count nodes across netlink handlers Zack McKevitt
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Zack McKevitt @ 2026-11-17 23:34 UTC (permalink / raw)
  To: dri-devel, netdev, riana.tauro, aravind.iddamsetty, rodrigo.vivi,
	raag.jadav, simona.vetter, airlied, kuba, ogabbay, lizhi.hou,
	karol.wachowski
  Cc: jeff.hugo, carl.vanderlip, troy.hanson, youssef.abdulrahman,
	Zack McKevitt

This patch series extends the drm_ras netlink interface to include a new
node type for telemetry nodes. Telemetry nodes support three operations:
getting, setting (optional), and listing telemetry fields. Drivers may
specify an optional predoit function to validate get and set operations.

Telemetry get operations take the drm_ras node id and telemetry field to
be read and return the field's value and any status reported by the driver.
Telemetry set operations take the node id, telemetry field, and value,
and return only the status reported by the driver.

Before adding telemetry nodes, a new patch is introduced to add refcounts
to drm_ras nodes stored in the xarray. This protects the nodes, which are
owned by the device, from being unregistered and freed in the middle of
a netlink doit such as getting an error counter.

This extension also removes the admin requirement on the list-nodes
operation. This allows drm_ras nodes to be discovered by userspace programs
for drivers that do not necessarily require admin privileges, like qaic.

The new drm_ras telemetry interface is implemented by the qaic driver,
which exposes the telemetry fields to userspace and enforces filesystem-
esque permission checks on telemetry operations in its telemetry_pre
callback.

Claude Opus 5.5 was used to assist in the development of these patches and
to address Sashiko feedback.

Changes in v4:
 - Add refcounts to track drm_ras node lifetimes.
 - Address Sashiko comments:
    - Fix status field population when HW returns an error.
    - Add refcounts for telemetry nodes.
    - Update outdated commit messages.
    - Add static to private functions in qaic_telemetry.c, and remove them
      from qaic_telemetry.h.
    - Stop returning remaining jiffies when device status is nonzero in
      telemetry_request().
    - Add mhi_unprepare_from_transfer if drm_ras node registration fails
      in qaic_telemetry_mhi_probe().
 - Consolidate get/set dumpits into a single dump operation.
 - Pin telemetry node to context in pre-doit and unpin in post-doit.
   This ensures the same node is used between pre-doit and doit calls.
 - Change field attribute to uint and status to sint.
 - Added NL_SET_BAD_ATTR calls to telemetry netlink functions.
 - Reject non-telemetry nodes in telemetry get/set/list-fields.
 - Updated qaic Kconfig to depend on DRM_RAS.

Link to v3: https://lore.kernel.org/all/20261106181225.3333260-1-zachary.mckevitt@oss.qualcomm.com/#t

Changes in v3:
 - Address Sashiko comments:
    - Properly return status when telemetry request is successful but a
      hardware error occurs.
    - Validate telemetry fields against their gettable/settable fields
      lists when invoking the predoit.
    - Update documentation in include/drm/drm_ras.h.
    - Moved calls to qaic_drm_ras_register/unregister to mhi_probe/remove
      instead of pci_probe/remove.
    - Added srcu read locks around calls to telemetry_request() in get
      and set callbacks in qaic_telemetry.c.
    - Added a tele_ch check to telemetry_request().
    - Properly handle a -ERESTARTSYS return from
      wait_for_completion_interrputable in telemetry_request().
    - Ensure field can be truncated to a u8 in qaic's telemetry get and
      set callbacks.
 - Minor code cleanups (typos, header ordering, etc).

Link to v2: https://lore.kernel.org/all/20261029203000.1763447-1-zachary.mckevitt@oss.qualcomm.com/

Changes in v2:
 - Address Sashiko comments:
    - Initialize certain stack variables in drm_ras.c.
    - Added attribute guards (GENL_REQ_ATTR_CHECK) in telemetry doits.
    - Added a valid node check in drm_ras_nl_pre_telemetry.
    - Fixed improper node callback in telemetry_set.
    - Now registering drm_ras node after MHI initialization.
    - Now removing drm_ras node before freeing MHI controller.
    - Added scoped_with_init_fs guard to qaic_telemetry_pre's inode check.
    - Fixed improper kfree in qaic_drm_ras_register_node.
 - Changed telemetry value attribute to sint and dropped padding attribute.
 - Updated documentation in drm_ras.yaml.
 - Renamed telemetry read/write to get/set.
 - Added dumpit for gettable and settable telemetry values.
 - Made telemetry_set optional and added admin-perm for it.
 - Specified ynl file regeneration in commit message for patch 2.

Link to v1: https://lore.kernel.org/all/20261009173152.2436195-1-zachary.mckevitt@oss.qualcomm.com/

Zack McKevitt (4):
  drm/drm_ras: Reference-count nodes across netlink handlers
  drm/drm_ras: Remove admin-perm flag from list-nodes operation
  drm/drm_ras: Extend DRM RAS interface to include telemetry nodes
  accel/qaic: Add callbacks for DRM RAS netlink telemetry

 Documentation/netlink/specs/drm_ras.yaml |  98 +++-
 drivers/accel/qaic/Kconfig               |   1 +
 drivers/accel/qaic/Makefile              |   1 +
 drivers/accel/qaic/qaic.h                |  19 +
 drivers/accel/qaic/qaic_drv.c            |  15 +
 drivers/accel/qaic/qaic_telemetry.c      | 563 +++++++++++++++++++++
 drivers/accel/qaic/qaic_telemetry.h      |  14 +
 drivers/gpu/drm/drm_ras.c                | 611 ++++++++++++++++++++---
 drivers/gpu/drm/drm_ras_nl.c             |  45 +-
 drivers/gpu/drm/drm_ras_nl.h             |  10 +
 include/drm/drm_ras.h                    |  98 ++++
 include/uapi/drm/drm_ras.h               |  29 +-
 include/uapi/drm/qaic_accel.h            |  28 ++
 13 files changed, 1461 insertions(+), 71 deletions(-)
 create mode 100644 drivers/accel/qaic/qaic_telemetry.c
 create mode 100644 drivers/accel/qaic/qaic_telemetry.h

-- 
2.43.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-11-18 23:35 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-17 23:34 [PATCH v4 0/4] Extend drm_ras for qaic telemetry Zack McKevitt
2026-11-17 23:34 ` [PATCH v4 1/4] drm/drm_ras: Reference-count nodes across netlink handlers Zack McKevitt
2026-11-17 23:34 ` [PATCH v4 2/4] drm/drm_ras: Remove admin-perm flag from list-nodes operation Zack McKevitt
2026-11-17 23:34 ` [PATCH v4 3/4] drm/drm_ras: Extend DRM RAS interface to include telemetry nodes Zack McKevitt
2026-11-18 23:35   ` sashiko-bot
2026-11-17 23:34 ` [PATCH v4 4/4] accel/qaic: Add callbacks for DRM RAS netlink telemetry Zack McKevitt
2026-11-18 23:35   ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox