Skip to contentSkip to conversation

Support for BCM5301X AXI trace PMUs

PATCH In review Florian Fainelli 4 participants 10 messages Oct 27 – Nov 19

Subsystems (4)
lore
Share & tools
lore

Florian Fainelli

author maintainer
#0 lore raw

v2 cover Support for BCM5301X AXI trace PMUs

This patch series adds support for the BCM5301x PMUs which are AXI trace engines present in the chip.

Changes in v2:

- addressed Sashiko's review by adding the appropriate title length and group validation

Florian Fainelli (3):
dt-bindings: perf: Describe the Broadcom BCM5301X AXI PMU
perf: Add Broadcom BCM5301X AXI Trace Module counters
ARM: dts: BCM5301X: Enable AXI PMUs

 .../admin-guide/perf/bcm5301x-axi-pmu.rst     |  92 ++++
 Documentation/admin-guide/perf/index.rst      |   1 +
 .../bindings/perf/brcm,bcm5301x-axi-pmu.yaml  |  43 ++
 MAINTAINERS                                   |   3 +
 arch/arm/boot/dts/broadcom/bcm5301x.dtsi      |  15 +
 drivers/perf/Kconfig                          |  12 +
 drivers/perf/Makefile                         |   1 +
 drivers/perf/bcm5301x_axi_pmu.c               | 452 ++++++++++++++++++
 8 files changed, 619 insertions(+)
 create mode 100644 Documentation/admin-guide/perf/bcm5301x-axi-pmu.rst
 create mode 100644 Documentation/devicetree/bindings/perf/brcm,bcm5301x-axi-pmu.yaml
 create mode 100644 drivers/perf/bcm5301x_axi_pmu.c
Signature · 1 line
2.53.0
author maintainer
#1 lore raw

PATCH v2 1/3 dt-bindings: perf: Describe the Broadcom BCM5301X AXI PMU

Describe one APB register window per AXI Trace Module. The counters are have no overflow IRQ.

---
 .../bindings/perf/brcm,bcm5301x-axi-pmu.yaml  | 43 +++++++++++++++++++
 MAINTAINERS                                   |  1 +
 2 files changed, 44 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/perf/brcm,bcm5301x-axi-pmu.yaml
Documentation/devicetree/bindings/perf/brcm,bcm5301x-axi-pmu.yaml new file +43 -0
new file mode 100644
index 000000000000..686b20d4cd29
@@ -0,0 +1,43 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/perf/brcm,bcm5301x-axi-pmu.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Broadcom BCM5301X AXI Trace Module performance monitor
+
+maintainers:
+  - Florian Fainelli <[email protected]>
+
+description: |
+  The BCM5301X ARM subsystem contains three AXI Trace Modules, monitoring the
+  two PL310 AXI master interfaces and the Accelerator Coherency Port (ACP).
+  Each module has its own APB register window and fixed performance counters
+  for commands, data beats, channel activity and stalls, latency, and cycles
+  with outstanding commands. Counters support local start, stop, and clear
+  commands. No counter overflow interrupt is provided.
+
+  Each node describes one module. The separate ATB trace output and its
+  CoreSight connections are outside the scope of this binding. This block
+  is distinct from the BCM2835 family AXI bus-watcher performance monitor.
+
+properties:
+  compatible:
+    const: brcm,bcm5301x-axi-pmu
+
+  reg:
+    maxItems: 1
+    description: APB register window of one AXI Trace Module.
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: false
+
+examples:
+  - |
+    pmu@19003000 {
+        compatible = "brcm,bcm5301x-axi-pmu";
+        reg = <0x19003000 0x1000>;
+    };
MAINTAINERS +1 -0
index f53047aa8d3c..b97f22107fbf 100644
@@ -5220,6 +5220,7 @@ M:	Rafał Miłecki <[email protected]>
 R:	Broadcom internal kernel review list <[email protected]>
 L:	[email protected] (moderated for non-subscribers)
 S:	Maintained
+F:	Documentation/devicetree/bindings/perf/brcm,bcm5301x-axi-pmu.yaml
 F:	arch/arm/boot/dts/broadcom/bcm-ns.dtsi
 F:	arch/arm/boot/dts/broadcom/bcm470*
 F:	arch/arm/boot/dts/broadcom/bcm5301*
Signature · 1 line
2.53.0
#2 lore raw

Re: [PATCH v2 1/3] dt-bindings: perf: Describe the Broadcom BCM5301X AXI PMU

Sashiko has reviewed this patch and found no issues.
Quoted 4 lines

Describe one APB register window per AXI Trace Module. The counters are have no overflow IRQ.

Sashiko has reviewed this patch and found no issues.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
maintainer Reviewed-by on v2 1/3
#3 lore raw

Re: [PATCH v2 1/3] dt-bindings: perf: Describe the Broadcom BCM5301X AXI PMU

In reply to Florian Fainelli
Quoted 10 lines · Florian Fainelli

Describe one APB register window per AXI Trace Module. The counters are have no overflow IRQ.

---
 .../bindings/perf/brcm,bcm5301x-axi-pmu.yaml  | 43 +++++++++++++++++++
 MAINTAINERS                                   |  1 +
 2 files changed, 44 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/perf/brcm,bcm5301x-axi-pmu.yaml
author maintainer
#4 lore raw

PATCH v2 2/3 perf: Add Broadcom BCM5301X AXI Trace Module counters

In reply to Florian Fainelli

Expose unfiltered fixed counters through system-wide perf events. Keep hardware free-running and use per-event baselines, locking, and periodic 32-bit delta accounting without resetting concurrent measurements.

---
 .../admin-guide/perf/bcm5301x-axi-pmu.rst     |  92 ++++
 Documentation/admin-guide/perf/index.rst      |   1 +
 MAINTAINERS                                   |   2 +
 drivers/perf/Kconfig                          |  12 +
 drivers/perf/Makefile                         |   1 +
 drivers/perf/bcm5301x_axi_pmu.c               | 452 ++++++++++++++++++
 6 files changed, 560 insertions(+)
 create mode 100644 Documentation/admin-guide/perf/bcm5301x-axi-pmu.rst
 create mode 100644 drivers/perf/bcm5301x_axi_pmu.c
Documentation/admin-guide/perf/bcm5301x-axi-pmu.rst new file +92 -0
new file mode 100644
index 000000000000..e2bf3b58a66e
@@ -0,0 +1,92 @@
+.. SPDX-License-Identifier: GPL-2.0-only
+
+Broadcom BCM5301X AXI Trace Module PMU
+======================================
+
+The BCM5301X AXI Trace Modules observe the two PL310 master interfaces and
+the Accelerator Coherency Port (ACP). Each instance registers a PMU named
+``bcm5301x_axi_<physical-base>``, for example ``bcm5301x_axi_19003000`` for
+PL310 M0, ``bcm5301x_axi_19004000`` for PL310 M1, and
+``bcm5301x_axi_19007000`` for ACP.
+
+Enable CONFIG_PERF_EVENTS and CONFIG_BCM5301X_AXI_PMU and provide an enabled
+device-tree node for each instance. Load ``bcm5301x_axi_pmu`` if built as a
+module. The driver owns the module exclusively; firmware or debug tools
+must not change its configuration while the driver is bound.
+
+Events and scope
+----------------
+
+The ``events`` and ``format`` directories under
+``/sys/bus/event_source/devices/bcm5301x_axi_*`` describe the ABI. Event IDs
+0 through 15 select fixed counters:
+
+==== ====================================
+ID   Event
+==== ====================================
+0    write_commands
+1    read_commands
+2    write_address_cycles
+3    read_address_cycles
+4    write_data_cycles
+5    read_data_cycles
+6    write_response_cycles
+7    write_address_stall_cycles
+8    read_address_stall_cycles
+9    write_data_stall_cycles
+10   read_data_stall_cycles
+11   write_response_stall_cycles
+12   write_beats
+13   read_beats
+14   write_outstanding_cycles
+15   read_outstanding_cycles
+==== ====================================
+
+Active channel cycles count VALID asserted; stall cycles count VALID
+asserted while READY is deasserted. Outstanding cycles count cycles with
+more than zero outstanding commands. These are cycle counts, not the sum
+of outstanding requests. Counts cover all traffic at the observed port;
+PL310 hits do not necessarily generate traffic at its master interfaces.
+ACP can remain idle unless an accelerator uses that interface.
+
+All measurements are unfiltered and system-wide. The ``cpumask`` file
+identifies the CPU managing each PMU, not a CPU traffic filter. Per-task
+counting, privilege exclusions, sampling, configurable AXI filters,
+latency measurements, and ATB transaction trace capture are unsupported.
+Beat counts are reported as beats, without assuming a byte conversion.
+
+Each fixed counter can be allocated once at a time. Duplicate requests
+in a single group are rejected; separate events can be multiplexed by
+perf. Different counters on one PMU can run together. Groups spanning
+different hardware PMUs are rejected.
+
+The hardware counters run continuously while the driver is bound, with
+per-event baselines excluding periods when an event is stopped. Starting
+one event does not reset another event's hardware counter. There is no
+overflow interrupt. A timer extends the wrapping 32-bit counters to 64 bits
+every 100 ms while events run. At 500 MHz a counter incrementing once per
+cycle wraps in about 8.6 seconds. Accuracy requires servicing the timer
+before a full wrap; long interrupt stalls and suspend intervals can lose
+counts. Stop measurements before suspending the system.
+
+Testing
+-------
+
+Check discovery and count commands and beats over a memory workload::
+
+  modprobe bcm5301x_axi_pmu
+  ls /sys/bus/event_source/devices/bcm5301x_axi_*
+  perf list | grep bcm5301x_axi
+  perf stat -a -e '{bcm5301x_axi_19003000/read_commands/,bcm5301x_axi_19003000/read_beats/}' -- sleep 10
+
+Repeat during a workload whose working set exceeds the PL310 cache, such
+as a memory stress test. Compare with idle, test M1 separately, and expect
+ACP activity only with an ACP user. Network DMA traffic alone need not
+cross the monitored PL310 ports. Use ``perf stat -a -I 1000`` for interval
+counts and run for at least a minute under load to exercise counter wrap.
+
+Check that adding or removing a second, different counter leaves the first
+counter accumulating. Two requests for the same event in one group must
+fail. ``perf record`` and per-task ``perf stat`` must fail. If CPU hotplug
+is available, offline the CPU listed in ``cpumask`` while counting and
+verify that management moves to another online CPU and counting continues.
Documentation/admin-guide/perf/index.rst +1 -0
index aa12708ddb96..6cf0010a3413 100644
@@ -31,3 +31,4 @@ Performance monitor support
    ampere_cspmu
    mrvl-pem-pmu
    fujitsu_uncore_pmu
+   bcm5301x-axi-pmu
MAINTAINERS +2 -0
index b97f22107fbf..460725721bc8 100644
@@ -5220,12 +5220,14 @@ M:	Rafał Miłecki <[email protected]>
 R:	Broadcom internal kernel review list <[email protected]>
 L:	[email protected] (moderated for non-subscribers)
 S:	Maintained
+F:	Documentation/admin-guide/perf/bcm5301x-axi-pmu.rst
 F:	Documentation/devicetree/bindings/perf/brcm,bcm5301x-axi-pmu.yaml
 F:	arch/arm/boot/dts/broadcom/bcm-ns.dtsi
 F:	arch/arm/boot/dts/broadcom/bcm470*
 F:	arch/arm/boot/dts/broadcom/bcm5301*
 F:	arch/arm/boot/dts/broadcom/bcm953012*
 F:	arch/arm/mach-bcm/bcm_5301x.c
+F:	drivers/perf/bcm5301x_axi_pmu.c
 
 BROADCOM BCM53573 ARM ARCHITECTURE
 M:	Florian Fainelli <[email protected]>
drivers/perf/Kconfig +12 -0
index 245e7bb763b9..69674cc3f31f 100644
@@ -6,6 +6,18 @@
 menu "Performance monitor support"
 	depends on PERF_EVENTS
 
+config BCM5301X_AXI_PMU
+	tristate "Broadcom BCM5301X AXI Trace Module PMU"
+	depends on ARCH_BCM_5301X || COMPILE_TEST
+	depends on OF
+	help
+	  Support system-wide perf counting on the BCM5301X AXI Trace Modules
+	  monitoring the PL310 master interfaces and ACP. Supports commands,
+	  beats, active/stall cycles, and outstanding-command cycles. Sampling
+	  and transaction trace capture are not supported.
+
+	  If compiled as a module, it will be called bcm5301x_axi_pmu.
+
 config ARM_CCI_PMU
 	tristate "ARM CCI PMU driver"
 	depends on (ARM && CPU_V7) || ARM64
drivers/perf/Makefile +1 -0
index eb8a022dad9a..2a51a963b692 100644
@@ -1,4 +1,5 @@
 # SPDX-License-Identifier: GPL-2.0
+obj-$(CONFIG_BCM5301X_AXI_PMU) += bcm5301x_axi_pmu.o
 obj-$(CONFIG_ARM_CCI_PMU) += arm-cci.o
 obj-$(CONFIG_ARM_CCN) += arm-ccn.o
 obj-$(CONFIG_ARM_CMN) += arm-cmn.o
drivers/perf/bcm5301x_axi_pmu.c new file +452 -0

452 lines not on this page · raw message

Signature · 1 line
2.53.0
#5 lore raw

Re: [PATCH v2 2/3] perf: Add Broadcom BCM5301X AXI Trace Module counters

Sashiko has reviewed this patch and found no issues.
Quoted 5 lines

Expose unfiltered fixed counters through system-wide perf events. Keep hardware free-running and use per-event baselines, locking, and periodic 32-bit delta accounting without resetting concurrent measurements.

Sashiko has reviewed this patch and found no issues.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
author maintainer
#6 lore raw

PATCH v2 3/3 ARM: dts: BCM5301X: Enable AXI PMUs

In reply to Florian Fainelli

Describe the three BCM5301X AXI Trace Modules and enable them on the BCM5301X base DTS file.

---
 arch/arm/boot/dts/broadcom/bcm5301x.dtsi | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
arch/arm/boot/dts/broadcom/bcm5301x.dtsi +15 -0
index f06a178a9240..dcae7cba37c4 100644
@@ -10,6 +10,21 @@
 
 / {
 	mpcore-bus@19000000 {
+		axi_pmu_m0: pmu@3000 {
+			compatible = "brcm,bcm5301x-axi-pmu";
+			reg = <0x3000 0x1000>;
+		};
+
+		axi_pmu_m1: pmu@4000 {
+			compatible = "brcm,bcm5301x-axi-pmu";
+			reg = <0x4000 0x1000>;
+		};
+
+		axi_pmu_acp: pmu@7000 {
+			compatible = "brcm,bcm5301x-axi-pmu";
+			reg = <0x7000 0x1000>;
+		};
+
 		a9pll: arm_clk@0 {
 			#clock-cells = <0>;
 			compatible = "brcm,nsp-armpll";
Signature · 1 line
2.53.0
#7 lore raw

Re: [PATCH v2 3/3] ARM: dts: BCM5301X: Enable AXI PMUs

Sashiko has reviewed this patch and found no issues.
Quoted 4 lines

Describe the three BCM5301X AXI Trace Modules and enable them on the BCM5301X base DTS file.

Sashiko has reviewed this patch and found no issues.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=3
author maintainer
#9 lore raw

Hi Will,

Quoted 11 lines · Will Deacon

Hi Florian,

Quoted 2 lines · Florian Fainelli

This patch series adds support for the BCM5301x PMUs which are AXI trace engines present in the chip.

Do these replace/interact/support the series from Ian at:

https://lore.kernel.org/r/[email protected]

?

This is a different piece of hardware, I was initially hoping we could cover it using Ian's PMU driver for 2835/2711/2712 but it's really much simpler and different on the BCM5301X SoCs. Thanks for checking though.

Signature · 1 line
Florian