linux/include/uapi/drm
Rob Herring (Arm) 17cdb54644 accel: ethosu: Add performance counter support
The Arm Ethos-U NPUs have a PMU with performance counters. The PMU h/w
supports up to 4 (U65) or 8 (U85) counters which can be programmed for
different events. There is also a dedicated cycle counter.

The ABI and implementation are copied from the V3D driver. The main
difference in the ABI is there is no query API for the event list. The
events differ between the U65 and U85, so the events lists are
maintained in userspace along with other differences between the U65 and
U85.

The cycle counter is always enabled when the PMU is enabled. When the
user requests N events, reading the counters will return the N events
plus the cycle counter.

Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
Signed-off-by: Tomeu Vizoso <tomeu@tomeuvizoso.net>
Reviewed-by: Maíra Canal <mcanal@igalia.com>
Link: https://patch.msgid.link/20260601173814.250071-1-tomeu@tomeuvizoso.net

---
v2:
 - Use XArray instead of idr
 - Rework locking to use per device spinlock to protect modifying active
   perfmon. Based on pending V3D changes:
   https://lore.kernel.org/all/20260508-v3d-perfmon-lifetime-v1-1-f5b5642c085f@igalia.com/
 - Add missing perfmon puts in ethosu_ioctl_perfmon_set_global() and
   ethosu_ioctl_perfmon_get_values() error paths.
 - Fix reading number of counters on U85.
 - Add defines NPU_REG_PMCCNTR_CFG

v3:
 - Add explicit padding to drm_ethosu_perfmon_destroy
 - Fix SPDX license expression
 - Fix comment typos
 - Convert perfmon lock from spinlock to mutex
 - Simplify switch_perfmon condition check
 - Remove unused ethosu_perfmon_init
 - Add lockdep_assert_held to ethosu_perfmon_stop_locked

v4:
 - Use drmm_mutex_init() for perfmon lock
 - Add lockdep_assert_held() to ethosu_perfmon_start()
 - Fix a few style issues reported by Maíra
History 2026-06-01 19:44:24 +02:00
..
amdgpu_drm.h drm/amdgpu: update type for num_syncobj_handles in drm_amdgpu_userq_wait 2026-03-02 16:42:01 -05:00
amdxdna_accel.h accel/amdxdna: Add command doorbell and wait support 2026-05-07 14:07:34 -07:00
armada_drm.h License cleanup: add SPDX license identifier to uapi header files with a license 2017-11-02 11:20:11 +01:00
asahi_drm.h drm: Add UAPI for the Asahi driver 2025-04-08 17:15:57 -04:00
drm.h drm: uapi: Use SPDX in DRM core uAPI headers 2026-05-04 17:14:18 +03:00
drm_fourcc.h drm/fourcc: Fix descriptions of 32b float formats 2026-05-10 18:49:25 +02:00
drm_mode.h drm: uapi: Use SPDX in DRM core uAPI headers 2026-05-04 17:14:18 +03:00
drm_ras.h drm/drm_ras: Add clear-error-counter netlink command to drm_ras 2026-04-24 08:43:42 -04:00
drm_sarea.h drm: uapi: Use SPDX in DRM core uAPI headers 2026-05-04 17:14:18 +03:00
ethosu_accel.h accel: ethosu: Add performance counter support 2026-06-01 19:44:24 +02:00
etnaviv_drm.h Revert "drm/etnaviv: Expose a few more chipspecs to userspace" 2024-04-25 16:56:20 +02:00
exynos_drm.h drm/exynos: Rename Exynos to lowercase 2020-01-21 09:09:42 +09:00
habanalabs_accel.h accel/habanalabs/gaudi2: add signed dev info uAPI 2023-12-19 11:09:43 +02:00
i915_drm.h drm/i915: Support replaying GPU hangs with captured context image 2024-05-16 07:37:05 +00:00
ivpu_accel.h accel/ivpu: Add support for userptr buffer objects 2025-10-30 08:52:51 +01:00
lima_drm.h drm/lima: support heap buffer creation 2020-01-27 22:01:09 +08:00
msm_drm.h drm/msm/adreno: Expose a PARAM to check AQE support 2026-03-31 13:47:30 -07:00
nouveau_drm.h drm/nouveau: Add DRM_IOCTL_NOUVEAU_GET_ZCULL_INFO 2026-02-24 15:04:55 +01:00
nova_drm.h drm: nova-drm: add initial driver skeleton 2025-05-12 20:48:15 +02:00
omap_drm.h Revert "drm/omap: add OMAP_BO flags to affect buffer allocation" 2019-10-23 10:41:41 -04:00
panfrost_drm.h drm/panfrost: Add flag to map GEM object Write-Back Cacheable 2025-12-09 13:09:37 +01:00
panthor_drm.h drm/panthor: extend timestamp query with flags 2026-03-24 16:04:40 +00:00
pvr_drm.h drm/imagination: Numerous documentation fixes. 2023-11-28 18:56:03 +01:00
qaic_accel.h accel/qaic: Fix typo for struct qaic_manage_trans_passthrough 2024-12-13 08:55:09 -07:00
qxl_drm.h drm/qxl: fix __user annotations 2017-06-23 10:06:31 +02:00
radeon_drm.h drm/radeon: add extern C guard for the UAPI header 2016-05-13 14:06:14 +01:00
rocket_accel.h accel/rocket: rocket_accel.h: fix kernel-doc warnings 2026-01-10 17:49:15 +01:00
tegra_drm.h drm/tegra: tegra_drm.h: fix all uapi kernel-doc warnings 2026-05-28 17:19:29 +02:00
v3d_drm.h drm/v3d: Add parameter to retrieve the number of GPU resets per-fd 2025-07-17 11:17:32 -03:00
vc4_drm.h drm/vc4: Add a pad field to align drm_vc4_submit_cl to 64 bits. 2018-05-03 15:20:09 -07:00
vgem_drm.h drm/vgem: Attach sw fences to exported vGEM dma-buf (ioctl) 2016-07-18 08:54:55 +02:00
virtgpu_drm.h drm/virtio: add VIRTGPU_PARAM_BLOB_ALIGNMENT to params 2026-05-20 17:59:21 +03:00
vmwgfx_drm.h drm/vmwgfx: Add SPDX header to vmwgfx_drm.h 2024-01-30 14:18:19 -05:00
xe_drm.h drm/xe/uapi: Fix doc formatting and completeness in xe_drm.h 2026-04-08 09:22:26 -07:00