perf: Add Raspberry Pi AXI PMU driver
Subsystems (5)
v19 cover perf: Add Raspberry Pi AXI PMU driver
Motivation & Background
=======================
Currently, Linux lacks a standard perf-API compatible driver for the Broadcom AXI bus-watcher performance monitor blocks on Raspberry Pi platforms (BCM2835, BCM2711, and BCM2712). Prior out-of-tree vendor solutions relied on custom debugfs nodes and ad-hoc kthreads, preventing integration with standard Linux perf tooling (perf stat, perf list, etc.).
Note that this hardware block (brcm,bcm2835-axiperf) is distinct from the Northstar BCM5301X AXI Trace Module (brcm,bcm5301x-axi-pmu,
https://lore.kernel.org/r/[email protected]).
Key Architectural Features
==========================
1. Standard Linux Perf Integration:
- Exposes uncore AXI interconnect events via /sys/bus/event_source/devices/rpi_axi_pmu/ and documents them in Documentation/admin-guide/perf/rpi-axi-pmu.rst.
- Supports up to 3 concurrently monitored (bus, filter) pairs per monitor (NUM_BUS_WATCHERS_PER_MONITOR = 3), with reference counting so all counter metrics on the same (monitor, bus, filter) share a single hardware watcher without multiplexing.
- Enforces group validation (rpi_axi_pmu__validate_group()) to reject event groups requiring more than 3 watchers per monitor at perf_event_open() time, while supporting time-multiplexing across more than 3 ungrouped buses.
- Masks counter deltas to each hardware register's bit width (32-bit for *trans, 28-bit for *wait/*max, and 8-bit for rpend) and tracks per-interval watermarks for level registers (*max and rpend) so perf stat and perf stat -I report accurate peak levels.
2. Hybrid MMIO & Firmware Mailbox Architecture:
- System Monitor (monitor=0): Performs fast atomic-safe MMIO reads.
- VideoCore VPU Monitor (monitor=1): Polled asynchronously in process context (vpu_work) via a single 44-word bulk Raspberry Pi firmware mailbox RPI_FIRMWARE_GET_PERIPH_REG call across all three VPU bus watchers. At probe time, rpi_axi_pmu_vpu_accessible() verifies that the firmware can reach the VPU monitor hardware and hides the vpu_* sysfs events if unavailable.
3. Per-SoC & Stepping Support:
- Patch 1 adds the Device Tree binding (brcm,bcm2835-axiperf,
`brcm,bcm2711-axiperf`, `brcm,bcm2712-axiperf`) and `MAINTAINERS`
entry.
- Patch 2 adds the driver and admin-guide documentation for BCM2835 and
BCM2711. - Patch 3 adds BCM2712 (Raspberry Pi 5) C0 and D0 support, including runtime D0 stepping detection via the bus-watcher AXI ID mask field, C0 (13-port) and D0 (10-port) System bus tables, 6-bit sparse AXI master ID filter tables (BCM2712_FLT_MAX = 64), and ratrans.
Hardware Validation
===================
The bus tables, master ID filters, and register layouts have been validated against Broadcom register documentation and direct hardware measurements on:
- BCM2835 (Raspberry Pi 1 B+)
- BCM2837 (Raspberry Pi 3 B+)
- BCM2711 B0 (Raspberry Pi 4 B and Raspberry Pi 400)
- BCM2712 C0 (Raspberry Pi 5 rev 1.0)
- BCM2712 D0 (Raspberry Pi 5 rev 1.2, Raspberry Pi 500, and Raspberry Pi 500+)
Example on Raspberry Pi 5 (BCM2712) counting all 11 metrics on the arm bus simultaneously on a single bus watcher:
$ sudo perf stat -a \
-e rpi_axi_pmu/arm_atwait/ -e rpi_axi_pmu/arm_atrans/ \
-e rpi_axi_pmu/arm_amax/ -e rpi_axi_pmu/arm_wwait/ \
-e rpi_axi_pmu/arm_wtrans/ -e rpi_axi_pmu/arm_wmax/ \
-e rpi_axi_pmu/arm_rwait/ -e rpi_axi_pmu/arm_rtrans/ \
-e rpi_axi_pmu/arm_rmax/ -e rpi_axi_pmu/arm_rpend/ \
-e rpi_axi_pmu/arm_ratrans/ \
-- dd if=/dev/zero of=/dev/null bs=1M count=2048Performance counter stats for 'system wide':
222,085 rpi_axi_pmu/arm_atwait/
21,789,405 rpi_axi_pmu/arm_atrans/
2,196 rpi_axi_pmu/arm_amax/
39,623,624 rpi_axi_pmu/arm_wwait/
43,482,567 rpi_axi_pmu/arm_wtrans/
2,197 rpi_axi_pmu/arm_wmax/
554 rpi_axi_pmu/arm_rwait/
96,264 rpi_axi_pmu/arm_rtrans/
1 rpi_axi_pmu/arm_rmax/
5 rpi_axi_pmu/arm_rpend/
48,148 rpi_axi_pmu/arm_ratrans/0.208600205 seconds time elapsed
And filtering per_atrans by VPU_UC0 (filter=1) and ARM (filter=11):
$ sudo perf stat -a \
-e rpi_axi_pmu/per_atrans/ \
-e rpi_axi_pmu/per_atrans,filter=1/ \
-e rpi_axi_pmu/per_atrans,filter=11/ \
-- sleep 1Performance counter stats for 'system wide':
29,393 rpi_axi_pmu/per_atrans/
19,934 rpi_axi_pmu/per_atrans,filter=1/
9,452 rpi_axi_pmu/per_atrans,filter=11/1.001089440 seconds time elapsed
Tooling & AI Assistance
=======================
Per Documentation/process/coding-assistants.rst and Documentation/process/generated-content.rst:
- Tools used: Google Antigravity (gemini-3.1-pro), Anthropic Claude, and Sashiko automated kernel patch review, alongside standard kernel tooling (scripts/checkpatch.pl, scripts/kernel-doc, make dt_binding_check).
- Summary of prompts and assistance:
- Assisted in converting the downstream Raspberry Pi debugfs AXI monitor (drivers/perf/raspberrypi_axi_monitor.c) into a Linux perf PMU driver (drivers/perf/rpi_axi_pmu.c), generating the repetitive PMU_EVENT_ATTR_STRING sysfs event tables across SoC generations, the Device Tree binding schema (brcm,bcm2835-axiperf.yaml), and the admin-guide documentation (Documentation/admin-guide/perf/rpi-axi-pmu.rst).
- Assisted with iterative review and fixes across revisions, including synchronization between atomic MMIO reads (pmu->lock) and deferred process-context VPU mailbox polling (vpu_mutex / vpu_work), scoped locking and compiler context-analysis annotations, bulk VPU mailbox reads, BCM2712 C0/D0 stepping detection and filter masks, and per-interval watermark tracking for level registers (*max and rpend).
- Portions affected:
Documentation/devicetree/bindings/perf/brcm,bcm2835-axiperf.yaml, Documentation/admin-guide/perf/rpi-axi-pmu.rst, and drivers/perf/rpi_axi_pmu.c.
- Testing and verification:
All generated code and tables were reviewed by the authors and tested on physical BCM2835, BCM2837, BCM2711 B0, BCM2712 C0, and BCM2712 D0 hardware using perf list and perf stat (single-watcher multi-metric counting, perf stat -I interval watermark tracking, AXI master ID filtering, VPU firmware accessibility probing, and 10-bus multiplexing).
Changelog
=========
v19:
- Driver (Patches 2 & 3):
- Track pmu->timer_running under pmu->lock so 0 -> 1 transitions of
`pmu->active_events` (such as during `perf_rotate_context()`) do not
re-arm `pmu->hrtimer` while it is already queued or executing, avoiding
both a `WARN_ON(timer->is_queued)` race in `hrtimer_forward_now()` and
100 ms timer resets when multiplexing intervals are shorter than 100 ms
(per Sashiko).
- Convert lock critical sections to scoped guards (`guard()` and
`scoped_guard()`) from `linux/cleanup.h`, add compiler context-analysis
locking annotations (`__guarded_by()`, `__must_hold()`,
`__must_not_hold()`, `context_unsafe()`), and enable
`CONTEXT_ANALYSIS_rpi_axi_pmu.o := y` in `drivers/perf/Makefile`.
- Avoid ternary conditional between distinct `enum bcm2712d0_system_bus`
and `enum bcm2712_system_bus` constants in `config_is_valid()` (`LLVM=1
W=1` `-Wenum-compare-conditional`).v18: https://lore.kernel.org/r/[email protected]
- Rebased onto v7.4-rc1.
- Device Tree Bindings (Patch 1, per Rob Herring and Sashiko):
- Reworded description: in brcm,bcm2835-axiperf.yaml to avoid : inside the unquoted YAML 1.2 plain scalar (make dt_binding_check and yamllint clean).
- Driver & Documentation (Patches 2 & 3):
- Added Dom Cobley's Tested-by: tags.
v17: https://lore.kernel.org/r/[email protected]
- Device Tree Bindings (Patch 1, per Krzysztof Kozlowski):
- Clarified commit message so it describes the two MMIO register blocks rather than the driver's firmware mailbox IPC.
- Dropped unneeded | from description: and dropped the redundant second example in brcm,bcm2835-axiperf.yaml.
- Driver & Documentation (Patches 2 & 3, per Dom Cobley):
- Reset event->hw.prev_count to 0 in rpi_axi_pmu_start() for level counters (*max and rpend), and documented in rpi-axi-pmu.rst that level counters are only meaningful when not multiplexed.
- Renamed BCM2712 C0 and D0 System buses after the BCM2712 block each
port serves: `display_top` -> `display`, `rp1` -> `pcie_02`,
`argon_top` -> `argon`, and `sdio_wifi` -> `emmc2`.v16: https://lore.kernel.org/r/[email protected]
- Addressed Sashiko review feedback on v15 (Patch 2):
- Returned early from rpi_axi_pmu__validate_group() when leader == event to avoid dereferencing leader->ctx (which is NULL during event_init for standalone events and group leaders) inside for_each_sibling_event() when CONFIG_PROVE_LOCKING=y.
- Enforced RPI_AXI_MAX_EVENTS (66) during group validation in
`rpi_axi_pmu__validate_event()`.
- Dropped depends on !RPI_AXIPERF from drivers/perf/Kconfig as RPI_AXIPERF is only defined in the downstream Raspberry Pi kernel tree.
v15: https://lore.kernel.org/r/[email protected]
- Device Tree Bindings & MAINTAINERS (Patch 1):
- Dropped [email protected] from maintainers:, sorted compatible: alphabetically, and required both reg items (System monitor registers and VPU monitor registers) across all SoCs per Krzysztof Kozlowski.
- Added MAINTAINERS entry and noted distinction from
`brcm,bcm5301x-axi-pmu`.
- Driver & Hardware Validation Fixes (Patches 2 & 3, co-developed with Dom Cobley on https://github.com/raspberrypi/linux/pull/7671):
- Added Documentation/admin-guide/perf/rpi-axi-pmu.rst.
- Masked *wait/*max deltas to 28 bits (GENMASK(27, 0)) and rpend to 8 bits (GENMASK(7, 0)), and implemented per-read-interval watermark tracking (counter_is_level()) for *max and rpend with prev_count reset under pmu->lock in rpi_axi_pmu_read().
- Removed non-existent ratrans on BCM2835 and BCM2711, and corrected
the BCM2835 VPU bus table (`0..13` matching BCM2711 plus `14 = sdram`).
- Re-enabled the BCM2712 VPU monitor (`0x7ee00000`) via the firmware
mailbox, added probe-time `rpi_axi_pmu_vpu_accessible()` verification,
and hid `vpu_*` sysfs events via `.is_visible` when firmware support is
unavailable.
- Replaced per-event VPU mailbox reads with a single 44-word bulk read
(`rpi_axi_pmu_vpu_read_watchers()`) with `__le32` endianness
conversions (`cpu_to_le32()` / `le32_to_cpu()`) and `config_gen[]`
tracking, and defaulted `hrtimer_interval_ms` to 1000 ms when the VPU
mailbox is used.
- Used `rpi_firmware_find_node()` to locate the firmware node.
- Corrected BCM2712 sparse AXI master ID filter numbering
(`BCM2712_FLT_MAX = 64`), added BCM2712 D0 runtime stepping detection
(`pmu->axi_id_mask`), D0 System/VPU filter mask encoding, the 10-port
D0 System bus table, and renamed `bstm_top`/`arb3`/`src`.v14: https://lore.kernel.org/r/[email protected]
- Removed firmware phandle property from brcm,bcm2835-axiperf.yaml per Krzysztof Kozlowski.
- Removed LINUX_VERSION_CODE checks per Uwe Kleine-Koenig and Florian Fainelli.
- Separated BCM2835, BCM2711, and BCM2712 bus and filter tables, exposed all counter metrics per bus without synthetic Bytes scaling, and added bus-watcher reference counting and group validation.
v13: https://lore.kernel.org/r/[email protected]
- Added allOf/if block in brcm,bcm2835-axiperf.yaml and cleaned up sysfs attribute definitions and comments.
v12: https://lore.kernel.org/r/[email protected]
- Added Device Tree binding patch (brcm,bcm2835-axiperf.yaml), split per-chip attr_groups, and returned -EPROBE_DEFER when firmware is not yet ready.
v11: https://lore.kernel.org/r/[email protected]
- Added READ_ONCE()/WRITE_ONCE() on enabled[idx] and restored flush_work() in rpi_axi_pmu__exit() so queued VPU watcher disables complete on module unload.
v10: https://lore.kernel.org/r/[email protected]
- Removed unused num_started state variable from struct rpi_axi_hw_events.
v9: https://lore.kernel.org/r/[email protected]
- Adjusted PMU and CPU hotplug registration order in probe() and simplified BCM2712 sysfs event visibility.
v8: https://lore.kernel.org/r/[email protected]
- Switched pmu->lock to raw_spinlock_t for PREEMPT_RT compatibility and reduced RPI_AXI_PMU_TIMER_INTERVAL from 2000 ms to 100 ms.
v7: https://lore.kernel.org/r/[email protected]
- Isolated all BCM2712 definitions into Patch 2 and initialized vpu_disable_pending on watcher allocation.
v6: https://lore.kernel.org/r/[email protected]
- Fixed Kconfig RASPBERRYPI_FIRMWARE dependency, added vpu_disable_pending for VPU watcher teardown, and let the hrtimer self-terminate when active_events == 0.
v5: https://lore.kernel.org/r/[email protected]
- Added monitor_running tracking, deferred VPU watcher disablement to vpu_work, and protected event->hw.state updates under pmu->lock.
v4: https://lore.kernel.org/r/[email protected]
- Avoided global monitor reset when other watchers are active and fixed error handling on mailbox read failures.
v3: https://lore.kernel.org/r/[email protected]
- Switched hrtimer to HRTIMER_MODE_REL_SOFT, set .suppress_bind_attrs = true, and cleaned up probe error unwinding.
v2: https://lore.kernel.org/r/[email protected]
- Added of_device_get_match_data() chip selection, CPU affinity check in event_init(), and counter wrap delta masking.
v1: https://lore.kernel.org/r/[email protected]
- Initial submission.
Ian Rogers (3):
dt-bindings: perf: Add Broadcom Raspberry Pi AXI PMU definition
perf: Add Raspberry Pi BCM2835 AXI PMU driver
perf: Add Raspberry Pi 5 (BCM2712) AXI PMU support
Documentation/admin-guide/perf/index.rst | 1 + .../admin-guide/perf/rpi-axi-pmu.rst | 167 + .../bindings/perf/brcm,bcm2835-axiperf.yaml | 44 + MAINTAINERS | 9 + drivers/perf/Kconfig | 13 + drivers/perf/Makefile | 2 + drivers/perf/rpi_axi_pmu.c | 4161 +++++++++++++++++ 7 files changed, 4397 insertions(+) create mode 100644 Documentation/admin-guide/perf/rpi-axi-pmu.rst create mode 100644 Documentation/devicetree/bindings/perf/brcm,bcm2835-axiperf.yaml create mode 100644 drivers/perf/rpi_axi_pmu.c
base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
Signature · 1 line
2.56.0.455.g6c5a503b38-goog
PATCH v19 1/3 dt-bindings: perf: Add Broadcom Raspberry Pi AXI PMU definition
Add device tree bindings for the Broadcom Raspberry Pi AXI PMU block found on BCM2835, BCM2711, and BCM2712 SoCs.
The hardware exposes two MMIO register blocks: the primary monitor evaluates the System fabric and the secondary monitor evaluates the VideoCore VPU fabric.
--- .../bindings/perf/brcm,bcm2835-axiperf.yaml | 44 +++++++++++++++++++ MAINTAINERS | 7 +++ 2 files changed, 51 insertions(+) create mode 100644 Documentation/devicetree/bindings/perf/brcm,bcm2835-axiperf.yaml
Documentation/devicetree/bindings/perf/brcm,bcm2835-axiperf.yaml new file +44 -0
@@ -0,0 +1,44 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/perf/brcm,bcm2835-axiperf.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Broadcom BCM2835/2711/2712 AXI Performance Monitor + +maintainers: + - Ian Rogers <[email protected]> + +description: + The Broadcom BCM2835 series (including BCM2711 and BCM2712) features hardware + performance monitors on the AXI bus for evaluating memory bandwidth and + system traffic. Two monitor register blocks are present, with the primary + monitor evaluating the System fabric and the secondary monitor evaluating the + VideoCore VPU fabric. This block is distinct from the BCM5301X AXI Trace + Module. + +properties: + compatible: + enum: + - brcm,bcm2711-axiperf + - brcm,bcm2712-axiperf + - brcm,bcm2835-axiperf + + reg: + items: + - description: System monitor registers + - description: VPU monitor registers + +required: + - compatible + - reg + +additionalProperties: false + +examples: + - | + pmu@7e009800 { + compatible = "brcm,bcm2835-axiperf"; + reg = <0x7e009800 0x100>, + <0x7ee08000 0x100>; + };
MAINTAINERS +7 -0
@@ -5338,6 +5338,13 @@ N: bcm113* N: bcm216* N: kona +BROADCOM BCM2835 AXI PMU DRIVER +M: Ian Rogers <[email protected]> +L: [email protected] +L: [email protected] (moderated for non-subscribers) +S: Maintained +F: Documentation/devicetree/bindings/perf/brcm,bcm2835-axiperf.yaml + BROADCOM BCM2835 CAMERA DRIVERS M: Raspberry Pi Kernel Maintenance <[email protected]> L: [email protected]
Signature · 1 line
2.56.0.455.g6c5a503b38-goog
[email protected]
AI reviewRe: [PATCH v19 1/3] dt-bindings: perf: Add Broadcom Raspberry Pi AXI PMU definition
Sashiko has reviewed this patch and found no issues.
Quoted 10 lines
Add device tree bindings for the Broadcom Raspberry Pi AXI PMU block found on BCM2835, BCM2711, and BCM2712 SoCs.
The hardware exposes two MMIO register blocks: the primary monitor evaluates the System fabric and the secondary monitor evaluates the VideoCore VPU fabric.
Co-developed-by Dom Cobley <[email protected]>Signed-off-by Dom Cobley <[email protected]>Signed-off-by Ian Rogers <[email protected]>
Sashiko has reviewed this patch and found no issues.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Re: [PATCH v19 1/3] dt-bindings: perf: Add Broadcom Raspberry Pi AXI PMU definition
In reply to Ian RogersQuoted 7 lines · Ian Rogers
Add device tree bindings for the Broadcom Raspberry Pi AXI PMU block found on BCM2835, BCM2711, and BCM2712 SoCs.
The hardware exposes two MMIO register blocks: the primary monitor evaluates the System fabric and the secondary monitor evaluates the VideoCore VPU fabric.
Quoted 9 lines
Co-developed-by Dom Cobley <[email protected]>Signed-off-by Dom Cobley <[email protected]>Signed-off-by Ian Rogers <[email protected]>--- .../bindings/perf/brcm,bcm2835-axiperf.yaml | 44 +++++++++++++++++++ MAINTAINERS | 7 +++ 2 files changed, 51 insertions(+) create mode 100644 Documentation/devicetree/bindings/perf/brcm,bcm2835-axiperf.yaml
Re: [PATCH v19 1/3] dt-bindings: perf: Add Broadcom Raspberry Pi AXI PMU definition
Quoted 20 lines · Rob Herring (Arm)
Quoted 7 lines · Ian Rogers
Add device tree bindings for the Broadcom Raspberry Pi AXI PMU block found on BCM2835, BCM2711, and BCM2712 SoCs.
The hardware exposes two MMIO register blocks: the primary monitor evaluates the System fabric and the secondary monitor evaluates the VideoCore VPU fabric.
Quoted 9 lines
Co-developed-by Dom Cobley <[email protected]>Signed-off-by Dom Cobley <[email protected]>Signed-off-by Ian Rogers <[email protected]>--- .../bindings/perf/brcm,bcm2835-axiperf.yaml | 44 +++++++++++++++++++ MAINTAINERS | 7 +++ 2 files changed, 51 insertions(+) create mode 100644 Documentation/devicetree/bindings/perf/brcm,bcm2835-axiperf.yaml
Quoted 1 line
Reviewed-by Rob Herring (Arm) <[email protected]>
Thanks Rob, and I appreciate the testing.
Ian
PATCH v19 2/3 perf: Add Raspberry Pi BCM2835 AXI PMU driver
In reply to Ian RogersAdd a PMU driver for the Raspberry Pi AXI performance monitors. It provides access to the System and VideoCore performance counters on Broadcom BCM2835 and BCM2711 platforms natively through the perf subsystem.
The driver implements bus-watcher refcounting, group validation, CPU hotplug migration, and sysfs event aliases mapping hardware-specific events to AXI pipelines (such as DMA, V3D, HVS, and ISP). Memory-mapped endpoints for the primary System bus are read synchronously, while the VideoCore VPU monitor is polled asynchronously in process context via a single bulk Raspberry Pi firmware mailbox read across all active bus watchers.
--- Documentation/admin-guide/perf/index.rst | 1 + .../admin-guide/perf/rpi-axi-pmu.rst | 137 + MAINTAINERS | 2 + drivers/perf/Kconfig | 13 + drivers/perf/Makefile | 2 + drivers/perf/rpi_axi_pmu.c | 2934 +++++++++++++++++ 6 files changed, 3089 insertions(+) create mode 100644 Documentation/admin-guide/perf/rpi-axi-pmu.rst create mode 100644 drivers/perf/rpi_axi_pmu.c
Documentation/admin-guide/perf/index.rst +1 -0
@@ -31,3 +31,4 @@ Performance monitor support ampere_cspmu mrvl-pem-pmu fujitsu_uncore_pmu + rpi-axi-pmu
Documentation/admin-guide/perf/rpi-axi-pmu.rst new file +137 -0
137 lines not on this page · raw message
MAINTAINERS +2 -0
@@ -5343,7 +5343,9 @@ M: Ian Rogers <[email protected]> L: [email protected] L: [email protected] (moderated for non-subscribers) S: Maintained +F: Documentation/admin-guide/perf/rpi-axi-pmu.rst F: Documentation/devicetree/bindings/perf/brcm,bcm2835-axiperf.yaml +F: drivers/perf/rpi_axi_pmu.c BROADCOM BCM2835 CAMERA DRIVERS M: Raspberry Pi Kernel Maintenance <[email protected]>
drivers/perf/Kconfig +13 -0
@@ -325,4 +325,17 @@ config NVIDIA_TEGRA410_C2C_PMU Enable perf support for counters in NVIDIA C2C interface of NVIDIA Tegra410 SoC. +config RPI_AXI_PMU + tristate "Raspberry Pi AXI Performance Monitor" + depends on ARCH_BCM2835 || COMPILE_TEST + depends on RASPBERRYPI_FIRMWARE || RASPBERRYPI_FIRMWARE=n + help + Enable support for the Raspberry Pi AXI Performance Monitor. + This provides access to the System and VideoCore performance + counters on Broadcom BCM2835 and BCM2711 platforms. + + The System monitor is read directly via MMIO, while the VideoCore + VPU monitor is polled every 100ms via the Raspberry Pi firmware + mailbox. + endmenu
drivers/perf/Makefile +2 -0
@@ -37,3 +37,5 @@ obj-$(CONFIG_MESON_DDR_PMU) += amlogic/ obj-$(CONFIG_CXL_PMU) += cxl_pmu.o obj-$(CONFIG_NVIDIA_TEGRA410_CMEM_LATENCY_PMU) += nvidia_t410_cmem_latency_pmu.o obj-$(CONFIG_NVIDIA_TEGRA410_C2C_PMU) += nvidia_t410_c2c_pmu.o +CONTEXT_ANALYSIS_rpi_axi_pmu.o := y +obj-$(CONFIG_RPI_AXI_PMU) += rpi_axi_pmu.o
drivers/perf/rpi_axi_pmu.c new file +2934 -0
2,828 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.56.0.455.g6c5a503b38-goog
Part of the diff is not shown here. View the raw message.
[email protected]
AI reviewRe: [PATCH v19 2/3] perf: Add Raspberry Pi BCM2835 AXI PMU driver
Sashiko has reviewed this patch and found no issues.
Quoted 13 lines
Add a PMU driver for the Raspberry Pi AXI performance monitors. It provides access to the System and VideoCore performance counters on Broadcom BCM2835 and BCM2711 platforms natively through the perf subsystem.
The driver implements bus-watcher refcounting, group validation, CPU hotplug migration, and sysfs event aliases mapping hardware-specific events to AXI pipelines (such as DMA, V3D, HVS, and ISP). Memory-mapped endpoints for the primary System bus are read synchronously, while the VideoCore VPU monitor is polled asynchronously in process context via a single bulk Raspberry Pi firmware mailbox read across all active bus watchers.
Quoted 4 lines
Co-developed-by Dom Cobley <[email protected]>Signed-off-by Dom Cobley <[email protected]>Tested-by Dom Cobley <[email protected]>Signed-off-by Ian Rogers <[email protected]>
Sashiko has reviewed this patch and found no issues.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
PATCH v19 3/3 perf: Add Raspberry Pi 5 (BCM2712) AXI PMU support
In reply to Ian RogersExtend the Raspberry Pi AXI PMU driver to support the Broadcom BCM2712 used in the Raspberry Pi 5.
As on earlier chips, the System monitor is accessed directly via MMIO and the VPU monitor via the firmware mailbox. BCM2712 has 6-bit AXI master IDs.
The System bus names in Broadcom's documentation describe the set-top box variant of the chip, so they were checked by measurement on C0 and D0 boards. PCIe2 (RP1) traffic appears on the port documented as BSTM_TOP, SD/eMMC with DMA0 and DMA1 on the one documented as SRC, and SD/eMMC2 (WiFi SDIO) on the one documented as ARB3; these are named pcie_02, sd_dma and emmc2 here, and the display_top and argon_top ports are named display and argon.
From BCM2712 D0, three System monitor ports (XPT, PCIE_01 and HVDP) are removed and the remaining ones renumbered, with the external PCIe moving to the Argon port. The bus watchers also match a full AXI ID under a
mask: 10-bit ID and mask fields on the System monitor, and 6-bit fields holding the master ID directly on the VPU monitor. D0 is detected at probe by whether the ID mask field is writable, and selects its own bus table and filter encoding.
--- .../admin-guide/perf/rpi-axi-pmu.rst | 34 +- drivers/perf/Kconfig | 2 +- drivers/perf/rpi_axi_pmu.c | 1231 ++++++++++++++++- 3 files changed, 1262 insertions(+), 5 deletions(-)
Documentation/admin-guide/perf/rpi-axi-pmu.rst +32 -2
@@ -4,8 +4,8 @@ Broadcom Raspberry Pi AXI Performance Monitoring Unit (PMU) ============================================================== -Broadcom BCM2835 and BCM2711 SoCs used in Raspberry Pi boards include two AXI -bus-watcher performance monitor blocks: +Broadcom BCM2835, BCM2711, and BCM2712 SoCs used in Raspberry Pi boards include +two AXI bus-watcher performance monitor blocks: - **System monitor** (``monitor=0``): Observes the primary System AXI fabric and is read directly via MMIO.
@@ -51,6 +51,7 @@ Counter Suffix Width Description 7 rtrans 32-bit Read data beats 8 rmax 28-bit Maximum read transaction latency (cycles) 9 rpend 8-bit Pending read transactions (instantaneous level) +10 ratrans 32-bit Read address transactions (BCM2712 only) ======= ======== ====== ======================================================= Level Counters (``*max`` and ``rpend``)
@@ -114,6 +115,35 @@ BCM2711 (8), ``PCIE`` (9), ``DMA2`` (18), ``GIGE`` (23), ``GISB_AXI`` (28), ``ARM`` (30), and ``EMMCSTB`` (31). +BCM2712 (C0 and D0) +------------------- + +BCM2712 D0 removes three unused set-top-box System fabric ports (``xpt``, +``pcie_01``, and ``hvdp``) and renumbers the remaining ports; the driver +detects D0 at probe time via the bus-watcher AXI ID mask field and exposes the +matching sysfs event table. + +- **BCM2712 C0 System buses (0..12):** ``vpu_uc`` (0), ``display`` (1), + ``v3d`` (2), ``arm`` (3), ``xpt`` (4), ``pcie_02`` (5), ``pcie_01`` (6), + ``argon`` (7), ``emmc2`` (8), ``sd_dma`` (9), ``hvdp`` (10), ``per`` (11), + ``system_l2`` (12). +- **BCM2712 D0 System buses (0..9):** ``vpu_uc`` (0), ``display`` (1), + ``v3d`` (2), ``arm`` (3), ``pcie_02`` (4), ``argon`` (5), ``emmc2`` (6), + ``sd_dma`` (7), ``per`` (8), ``system_l2`` (9). +- **VPU buses (0..13):** Same ``0..13`` layout as BCM2711. +- **6-bit AXI master ID filters (1..63):** ``VPU_UC0`` (1), ``VPU_IC0`` (2), + ``VPU_DC0`` (3), ``VPU_UC1`` (4), ``VPU_IC1`` (5), ``VPU_DC1`` (6), + ``VPU_L2`` (8), ``DMA2`` (9), ``VPU_DEBUG`` (10), ``ARM`` (11), + ``DMA0`` (12), ``DMA1`` (13), ``RAAGA`` (14), ``BBSI`` (16), ``PCIE0`` (18), + ``PCIE1`` (19), ``PCIE2`` (20, RP1), ``UMR`` (27), ``SAGE`` (28), + ``HVDP`` (29), ``BSP`` (30), ``HVS`` (32), ``HVS_WMK`` (33), ``MOP0`` (34), + ``MOP1`` (35), ``MBVN`` (36), ``DSI`` (37), ``XPT`` (38), ``EMMC0`` (39), + ``GENET`` (40), ``USB`` (41), ``ARGON`` (42), ``UNICAM`` (43), ``PISP`` (44), + ``PISPFE`` (45), ``JPEG`` (46), ``EMMC1`` (47), ``EMMC2`` (48), ``TRC`` (52), + ``BSTM0`` (53), ``BSTM1`` (54), ``BSTM0_SEC`` (55), ``BSTM1_SEC`` (56), + ``AIO`` (57), ``MAP`` (58), ``SYS_DMA`` (59), ``MMUCACHE0`` (60), + ``MMUCACHE1`` (61), ``MPUCACHE0`` (62), ``MPUCACHE1`` (63). + Examples ========
drivers/perf/Kconfig +1 -1
@@ -332,7 +332,7 @@ config RPI_AXI_PMU help Enable support for the Raspberry Pi AXI Performance Monitor. This provides access to the System and VideoCore performance - counters on Broadcom BCM2835 and BCM2711 platforms. + counters on Broadcom BCM2835, BCM2711, and BCM2712 platforms. The System monitor is read directly via MMIO, while the VideoCore VPU monitor is polled every 100ms via the Raspberry Pi firmware
drivers/perf/rpi_axi_pmu.c +1229 -2
1,319 lines not on this page · raw message
Signature · 1 line
2.56.0.455.g6c5a503b38-goog
[email protected]
AI reviewRe: [PATCH v19 3/3] perf: Add Raspberry Pi 5 (BCM2712) AXI PMU support
Sashiko has reviewed this patch and found no issues.
Quoted 23 lines
Extend the Raspberry Pi AXI PMU driver to support the Broadcom BCM2712 used in the Raspberry Pi 5.
As on earlier chips, the System monitor is accessed directly via MMIO and the VPU monitor via the firmware mailbox. BCM2712 has 6-bit AXI master IDs.
The System bus names in Broadcom's documentation describe the set-top box variant of the chip, so they were checked by measurement on C0 and D0 boards. PCIe2 (RP1) traffic appears on the port documented as
BSTM_TOP, SD/eMMC with DMA0 and DMA1 on the one documented as SRC, and SD/eMMC2 (WiFi SDIO) on the one documented as ARB3; these are namedpcie_02,sd_dmaand emmc2 here, and thedisplay_topandargon_topports are named display and argon.From BCM2712 D0, three System monitor ports (XPT,
PCIE_01and HVDP) are removed and the remaining ones renumbered, with the external PCIe moving to the Argon port. The bus watchers also match a full AXI ID under a
mask: 10-bit ID and mask fields on the System monitor, and 6-bit fields holding the master ID directly on the VPU monitor. D0 is detected at probe by whether the ID mask field is writable, and selects its own bus table and filter encoding.
Quoted 4 lines
Co-developed-by Dom Cobley <[email protected]>Signed-off-by Dom Cobley <[email protected]>Tested-by Dom Cobley <[email protected]>Signed-off-by Ian Rogers <[email protected]>
Sashiko has reviewed this patch and found no issues.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=3