On Tue, Nov 24, 2026 at 10:01:28AM -0800, Zack McKevitt wrote: > 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.
Pushed to drm-misc-next, thank you for the patches. Thanks, Rodrigo. > > Changes in v5: > - Address Sashiko comments: > - Convert mode from u8 to uint in drm_ras netlink spec. > - Add check for qdev->dev_state != QAIC_ONLINE in telemetry_request(). > - Flush the tele_wq workqueue after mhi_unprepare_from_transfer in > qaic_telemetry_mhi_remove. > - Small formatting fixes. > > Link to v4: > https://lore.kernel.org/all/[email protected]/ > > 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/[email protected]/#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/[email protected]/ > > 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/[email protected]/ > > 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 | 564 +++++++++++++++++++++ > 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, 1462 insertions(+), 71 deletions(-) > create mode 100644 drivers/accel/qaic/qaic_telemetry.c > create mode 100644 drivers/accel/qaic/qaic_telemetry.h > > -- > 2.43.0 >
