Raspberry Pi support for AXI bus events in Linux perf tool - #7571
Raspberry Pi support for AXI bus events in Linux perf tool#7571captain5050 wants to merge 4 commits into
Conversation
Add Device Tree bindings for the Broadcom AXI PMU hardware blocks present in the Raspberry Pi SoC line (BCM2835, BCM2711, BCM2712). Depending on the SoC and security configuration, these PMUs support either direct MMIO access or routing via the Raspberry Pi firmware Mailbox IPC. The bindings support defining 1 or 2 backing MMIO regions natively map the system and VPU control surfaces. Assisted-by: Antigravity:gemini-3.6-flash Signed-off-by: Ian Rogers <irogers@google.com>
This commit adds a new performance monitoring driver for the Raspberry Pi AXI bus (BCM2835/2711), exposing system-level and VideoCore PMU hardware to the Linux perf subsystem natively via the VideoCore mailbox interface. Assisted-by: Antigravity:gemini-3.6-flash Signed-off-by: Ian Rogers <irogers@google.com>
Initialize MMIO-based AXI Performance Counters natively for the BCM2712 architecture, dynamically bypassing the legacy VideoCore VPU Mailbox IPC layer entirely for newer generation hardware loops. Sysfs topology definitions natively expand into dynamically evaluated legacy and modern mapping arrays, perfectly partitioning Pi 4 endpoints from Pi 5 natively during PMU registration without relying on internal legacy string visibility filters. Assisted-by: Antigravity:gemini-3.6-flash Signed-off-by: Ian Rogers <irogers@google.com>
Add RPI_AXI_PMU config value to build Raspberry Pi perf support. Signed-off-by: Ian Rogers <irogers@google.com>
d40d995 to
df71446
Compare
|
Thanks for this, I have been keeping an eye on the upstream submission. It looks like there are issues with 2711/2712 paths. Here is a Claude review that can compare things more precisely than I can: Thanks for putting this together — I've read through the whole driver, applied it to a clean SummaryExposing these counters through the perf subsystem is the right idea, and the perf-side plumbing is mostly well built: a proper However, the hardware description is substantially wrong for BCM2711 and BCM2712, and the firmware-mailbox address handling looks broken on BCM2835/2836/2837. The commits carry Blocking1. BCM2711 (Pi 4) is treated as identical to BCM2835The match table maps
This means the example in the PR description is mislabelled. The VPU table has the same problem. Downstream's 2711 VPU list drops 2. The BCM2712 system-bus table does not match the hardware
Every Pi 5 event alias except possibly PCIe therefore reads a different bus from the one its name claims. Notably, The block of 3. The firmware mailbox is given a translated ARM physical addressresource = platform_get_resource(pdev, IORESOURCE_MEM, i);
pmu->monitor[i].mailbox = (u32)resource->start;
of_property_read_u32_index(np, "reg", i * 2, (u32 *)(&state->monitor[i].base_address));because 4. Two platform drivers claim the same three compatibles
This needs either Relatedly, 5. Direct MMIO fallback to the VPU monitor will fault on Pi 1–3If the On BCM2712 the driver ioremaps Significant, but not blocking
Minor
Suggested path forwardThe structural work is worth keeping. What I'd want to see before this can go in:
Given that the tables appear to have been generated rather than sourced, I'd suggest re-deriving everything hardware-facing from the downstream driver or the vendor documentation, rather than spot-checking the current values. |
Sent to LKML in:
https://lore.kernel.org/linux-perf-users/20260811083828.2057695-1-irogers@google.com/
An example Raspberry Pi 4 use: