Skip to contentSkip to conversation

perf: Arm system PMU and BMU drivers

PATCH In review Robin Murphy 2 participants 11 messages Nov 6

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v4 cover perf: Arm system PMU and BMU drivers

Previously:
https://lore.kernel.org/linux-perf-users/222d98feab5ca2836fdef69fee9113f6f860167d.1791209460.git.robin.murphy@arm.com/
https://lore.kernel.org/linux-perf-users/c936505c43275f434bce924b7657e42bfb25579c.1789652832.git.robin.murphy@arm.com/

As promised, this a resend of the new drivers which missed the boat last cycle. No material changes since the respective v3s, just rebasing, and I decided I may as well post them together as a series to pre-resolve the Kconfig/Makefile conflicts. I've also revived the BMU DT patches from v2, as some interest has been expressed from within Arm, but again they can still be considered somewhat optional as it's only the first two which the AGI CPU folks are clamouring for right now.

Cheers,
Robin.

Robin Murphy (4):
perf/arm_cspmu: Add Arm system PMU
perf: Add Arm Bus Monitor Unit driver
dt-bindings: perf: Add Arm Bus Monitor Unit
perf/arm-bmu: Add Devicetree support

 .../bindings/perf/arm,bus-monitor-unit.yaml   |  41 ++
 drivers/perf/arm_cspmu/Kconfig                |  13 +
 drivers/perf/arm_cspmu/Makefile               |   3 +
 drivers/perf/arm_cspmu/arm-bmu.c              | 541 ++++++++++++++++++
 drivers/perf/arm_cspmu/arm_cspmu.c            |   7 +
 drivers/perf/arm_cspmu/arm_cspmu.h            |   1 +
 drivers/perf/arm_cspmu/arm_syspmu.c           |  67 +++
 7 files changed, 673 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/perf/arm,bus-monitor-unit.yaml
 create mode 100644 drivers/perf/arm_cspmu/arm-bmu.c
 create mode 100644 drivers/perf/arm_cspmu/arm_syspmu.c
Signature · 1 line
2.54.0.dirty
#1 lore raw

PATCH v4 1/4 perf/arm_cspmu: Add Arm system PMU

Arm's latest Compute Subsystems and SoCs are using a common PMU block in various places which can mostly just be driven as a generic 64-bit CoreSight PMU, but does have an IMP-DEF register for additional filtering. The details of event and filter encodings depend on the particular PMU instance, so are left to the higher level Arm Telemetry Solution tooling.

---
 drivers/perf/arm_cspmu/Kconfig      |  7 +++
 drivers/perf/arm_cspmu/Makefile     |  1 +
 drivers/perf/arm_cspmu/arm_cspmu.c  |  7 +++
 drivers/perf/arm_cspmu/arm_cspmu.h  |  1 +
 drivers/perf/arm_cspmu/arm_syspmu.c | 67 +++++++++++++++++++++++++++++
 5 files changed, 83 insertions(+)
 create mode 100644 drivers/perf/arm_cspmu/arm_syspmu.c
drivers/perf/arm_cspmu/Kconfig +7 -0
index 6f4e28fc84a2..25bd55f036a4 100644
@@ -27,3 +27,10 @@ config AMPERE_CORESIGHT_PMU_ARCH_SYSTEM_PMU
 
 	  In the first phase, the driver enables support on MCU PMU used in
 	  AmpereOne SoC family.
+
+config ARM_SYSTEM_PMU
+	tristate "Arm System PMU"
+	depends on ARM_CORESIGHT_PMU_ARCH_SYSTEM_PMU
+	help
+	  Support additional event filtering attributes for the CoreSight-based
+	  PMU blocks found in various parts of Arm Compute Subsystems and SoCs.
drivers/perf/arm_cspmu/Makefile +1 -0
index 220a734efd54..90c3cd710157 100644
@@ -8,3 +8,4 @@ arm_cspmu_module-y := arm_cspmu.o
 
 obj-$(CONFIG_NVIDIA_CORESIGHT_PMU_ARCH_SYSTEM_PMU) += nvidia_cspmu.o
 obj-$(CONFIG_AMPERE_CORESIGHT_PMU_ARCH_SYSTEM_PMU) += ampere_cspmu.o
+obj-$(CONFIG_ARM_SYSTEM_PMU) += arm_syspmu.o
drivers/perf/arm_cspmu/arm_cspmu.c +7 -0
index 912f03ce3ef5..9f298ea1a974 100644
@@ -358,6 +358,13 @@ static struct arm_cspmu_impl_match impl_match[] = {
 		.module		= NULL,
 		.impl_init_ops	= NULL,
 	},
+	{
+		.module_name	= "arm_syspmu",
+		.pmiidr_val	= ARM_CSPMU_IMPL_ID_ARM,
+		.pmiidr_mask	= PMIIDR_IMPLEMENTER,
+		.module		= NULL,
+		.impl_init_ops	= NULL,
+	},
 	{
 		.module_name	= "ampere_cspmu",
 		.pmiidr_val	= ARM_CSPMU_IMPL_ID_AMPERE,
drivers/perf/arm_cspmu/arm_cspmu.h +1 -0
index 93d5b062de8b..86b62c236a4b 100644
@@ -149,6 +149,7 @@
 
 /* JEDEC-assigned JEP106 identification code */
 #define ARM_CSPMU_IMPL_ID_NVIDIA	0x36B
+#define ARM_CSPMU_IMPL_ID_ARM		0x43B
 #define ARM_CSPMU_IMPL_ID_AMPERE	0xA16
 
 /* PMDEVARCH */
drivers/perf/arm_cspmu/arm_syspmu.c new file +67 -0

67 lines not on this page · raw message

Signature · 1 line
2.54.0.dirty
#2 lore raw

Re: [PATCH v4 1/4] perf/arm_cspmu: Add Arm system PMU

Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Medium] perf/arm_cspmu: arm_cspmu_init_impl_ops() defers probe when ARM_SYSTEM_PMU=n --

Thank you for your contribution! Sashiko AI review found 1 potential issue to consider:
- [Medium] perf/arm_cspmu: arm_cspmu_init_impl_ops() defers probe when ARM_SYSTEM_PMU=n
--

commit ae4570e49b496427e88dd55c46f9506b33a8b68e
Author: Robin Murphy <[email protected]>

perf/arm_cspmu: Add Arm system PMU

This commit adds the arm_syspmu backend module to support an additional 64-bit event filter register (PMEVFILT3R) on Arm system PMUs with product ID 0x9c3.

Quoted 8 lines
drivers/perf/arm_cspmu/arm_cspmu.c +0 -0
index 912f03ce3ef5f..9f298ea1a9745 100644
@@ -358,6 +358,13 @@ static struct arm_cspmu_impl_match impl_match[] = {
 		.module		= NULL,
 		.impl_init_ops	= NULL,
 	},

drivers/perf/arm_cspmu/arm_cspmu.c static struct arm_cspmu_impl_match impl_match[] = { · line 370

Quoted 10 lines
drivers/perf/arm_cspmu/arm_cspmu.c +7 -0
+	{
+		.module_name	= "arm_syspmu",
+		.pmiidr_val	= ARM_CSPMU_IMPL_ID_ARM,
+		.pmiidr_mask	= PMIIDR_IMPLEMENTER,
+		.module		= NULL,
+		.impl_init_ops	= NULL,
+	},
 	{
 		.module_name	= "ampere_cspmu",
 		.pmiidr_val	= ARM_CSPMU_IMPL_ID_AMPERE,

[Severity: Medium]
Does adding an unconditional impl_match[] entry for ARM_CSPMU_IMPL_ID_ARM cause arm_cspmu_init_impl_ops() to defer probing indefinitely when CONFIG_ARM_SYSTEM_PMU is disabled?

Previously, CoreSight PMUs with Arm's implementer ID did not match any entry in impl_match[] and probed using the generic ops. With this entry present, arm_cspmu_init_impl_ops() requires the arm_syspmu module to register match->impl_init_ops:

drivers/perf/arm_cspmu/arm_cspmu.c:arm_cspmu_init_impl_ops() {
    ...
		if (match->impl_init_ops) {
    ...
		} else {
			request_module_nowait(match->module_name);
			ret = dev_err_probe(cspmu->dev, -EPROBE_DEFER,
					    "Waiting for module %s to load\n",
					    match->module_name);
		}
    ...
}

Because CONFIG_ARM_SYSTEM_PMU has no default in Kconfig, existing configs with CONFIG_ARM_CORESIGHT_PMU_ARCH_SYSTEM_PMU enabled will have CONFIG_ARM_SYSTEM_PMU=n, leaving every Arm-implemented CoreSight PMU (including non-0x9c3 devices where arm_syspmu_init_ops() is a no-op) permanently stuck in -EPROBE_DEFER.

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

Re: [PATCH v4 1/4] perf/arm_cspmu: Add Arm system PMU

Quoted 57 lines · On 2026-11-06 6:17 pm, [email protected] wrote:

Thank you for your contribution! Sashiko AI review found 1 potential issue to consider:
- [Medium] perf/arm_cspmu: arm_cspmu_init_impl_ops() defers probe when ARM_SYSTEM_PMU=n
--

commit ae4570e49b496427e88dd55c46f9506b33a8b68e
Author: Robin Murphy <[email protected]>

perf/arm_cspmu: Add Arm system PMU

This commit adds the arm_syspmu backend module to support an additional 64-bit event filter register (PMEVFILT3R) on Arm system PMUs with product ID 0x9c3.

Quoted 8 lines
drivers/perf/arm_cspmu/arm_cspmu.c +0 -0
index 912f03ce3ef5f..9f298ea1a9745 100644
@@ -358,6 +358,13 @@ static struct arm_cspmu_impl_match impl_match[] = {
  		.module		= NULL,
  		.impl_init_ops	= NULL,
  	},

drivers/perf/arm_cspmu/arm_cspmu.c static struct arm_cspmu_impl_match impl_match[] = { · line 370

Quoted 10 lines
drivers/perf/arm_cspmu/arm_cspmu.c +7 -0
+	{
+		.module_name	= "arm_syspmu",
+		.pmiidr_val	= ARM_CSPMU_IMPL_ID_ARM,
+		.pmiidr_mask	= PMIIDR_IMPLEMENTER,
+		.module		= NULL,
+		.impl_init_ops	= NULL,
+	},
  	{
  		.module_name	= "ampere_cspmu",
  		.pmiidr_val	= ARM_CSPMU_IMPL_ID_AMPERE,

[Severity: Medium]
Does adding an unconditional impl_match[] entry for ARM_CSPMU_IMPL_ID_ARM cause arm_cspmu_init_impl_ops() to defer probing indefinitely when CONFIG_ARM_SYSTEM_PMU is disabled?

Previously, CoreSight PMUs with Arm's implementer ID did not match any entry in impl_match[] and probed using the generic ops. With this entry present, arm_cspmu_init_impl_ops() requires the arm_syspmu module to register match->impl_init_ops:

drivers/perf/arm_cspmu/arm_cspmu.c:arm_cspmu_init_impl_ops() {
     ...
		if (match->impl_init_ops) {
     ...
		} else {
			request_module_nowait(match->module_name);
			ret = dev_err_probe(cspmu->dev, -EPROBE_DEFER,
					    "Waiting for module %s to load\n",
					    match->module_name);
		}
     ...
}
Quoted 5 lines

Because CONFIG_ARM_SYSTEM_PMU has no default in Kconfig, existing configs with CONFIG_ARM_CORESIGHT_PMU_ARCH_SYSTEM_PMU enabled will have CONFIG_ARM_SYSTEM_PMU=n, leaving every Arm-implemented CoreSight PMU (including non-0x9c3 devices where arm_syspmu_init_ops() is a no-op) permanently stuck in -EPROBE_DEFER.

Sure, let me know what other Arm Ltd. PMU implementations those are, and I'll get back to you with how much I care...

Plus there's nothing here that's any different from the existing Ampere and NVIDIA cases. Perhaps we could #ifdef the impl_match entries if anyone really thought it mattered, but that would be a general matter for the arm_cspmu framework itself, not this patch.

Thanks,
Robin.

#4 lore raw

PATCH v4 2/4 perf: Add Arm Bus Monitor Unit driver

In reply to Robin Murphy

Arm's Bus Monitor Unit is a low-level performance analysis tool for matching and counting transactions at interconnect interfaces. Each BMU consists of a number of "interface monitoring units", with some global controls to synchronise them and so permit accurate calculation of cross-interface metrics. Each IMU contains, among other things, its own PMU largely based on the CoreSight PMU architecture, but with some functional incompatibilities due to the nature of how much per-event filtering needs to be crammed in to categorise AXI/CHI transactions at the protocol level. As such it gets an honorary home in arm_cspmu/ in order to share the common register definitions, but for simplicity does not try to bend the functional abstraction to fit.

---
 drivers/perf/arm_cspmu/Kconfig   |   6 +
 drivers/perf/arm_cspmu/Makefile  |   2 +
 drivers/perf/arm_cspmu/arm-bmu.c | 528 +++++++++++++++++++++++++++++++
 3 files changed, 536 insertions(+)
 create mode 100644 drivers/perf/arm_cspmu/arm-bmu.c
drivers/perf/arm_cspmu/Kconfig +6 -0
index 25bd55f036a4..48c2a3ac7fab 100644
@@ -34,3 +34,9 @@ config ARM_SYSTEM_PMU
 	help
 	  Support additional event filtering attributes for the CoreSight-based
 	  PMU blocks found in various parts of Arm Compute Subsystems and SoCs.
+
+config ARM_BMU
+	tristate "ARM Bus Monitor Unit"
+	depends on (ARM64 && ACPI) || COMPILE_TEST
+	help
+	  Support perf event counting on Arm Bus Monitor Unit devices.
drivers/perf/arm_cspmu/Makefile +2 -0
index 90c3cd710157..4e0b420a2b55 100644
@@ -9,3 +9,5 @@ arm_cspmu_module-y := arm_cspmu.o
 obj-$(CONFIG_NVIDIA_CORESIGHT_PMU_ARCH_SYSTEM_PMU) += nvidia_cspmu.o
 obj-$(CONFIG_AMPERE_CORESIGHT_PMU_ARCH_SYSTEM_PMU) += ampere_cspmu.o
 obj-$(CONFIG_ARM_SYSTEM_PMU) += arm_syspmu.o
+
+obj-$(CONFIG_ARM_BMU) += arm-bmu.o
drivers/perf/arm_cspmu/arm-bmu.c new file +528 -0

528 lines not on this page · raw message

Signature · 1 line
2.54.0.dirty
#5 lore raw

Re: [PATCH v4 2/4] perf: Add Arm Bus Monitor Unit driver

Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Medium] perf: arm-bmu: driver omitted when ARM_CORESIGHT_PMU_ARCH_SYSTEM_PMU is n or m --

Thank you for your contribution! Sashiko AI review found 1 potential issue to consider:
- [Medium] perf: arm-bmu: driver omitted when ARM_CORESIGHT_PMU_ARCH_SYSTEM_PMU is n or m
--

commit 0be62f2184bd603abec9ec13cdc4790db8588fea
Author: Robin Murphy <[email protected]>

perf: Add Arm Bus Monitor Unit driver

This commit adds a perf driver for Arm's Bus Monitor Unit in drivers/perf/arm_cspmu/ to support transaction matching and counting across interface monitoring units.

Quoted 19 lines
drivers/perf/arm_cspmu/Kconfig +6 -0
index 25bd55f036a4f..48c2a3ac7fab5 100644
@@ -34,3 +34,9 @@ config ARM_SYSTEM_PMU
 	help
 	  Support additional event filtering attributes for the CoreSight-based
 	  PMU blocks found in various parts of Arm Compute Subsystems and SoCs.
+
+config ARM_BMU
+	tristate "ARM Bus Monitor Unit"
+	depends on (ARM64 && ACPI) || COMPILE_TEST
+	help
+	  Support perf event counting on Arm Bus Monitor Unit devices.
drivers/perf/arm_cspmu/Makefile +0 -0
index 90c3cd7101577..4e0b420a2b55f 100644

drivers/perf/arm_cspmu/Makefile arm_cspmu_module-y := arm_cspmu.o · line 13

Quoted 5 lines
drivers/perf/arm_cspmu/Makefile +2 -0
@@ -9,3 +9,5 @@ arm_cspmu_module-y := arm_cspmu.o
 obj-$(CONFIG_NVIDIA_CORESIGHT_PMU_ARCH_SYSTEM_PMU) += nvidia_cspmu.o
 obj-$(CONFIG_AMPERE_CORESIGHT_PMU_ARCH_SYSTEM_PMU) += ampere_cspmu.o
 obj-$(CONFIG_ARM_SYSTEM_PMU) += arm_syspmu.o
+
+obj-$(CONFIG_ARM_BMU) += arm-bmu.o

[Severity: Medium]
Will arm-bmu.o be skipped during the build when CONFIG_ARM_CORESIGHT_PMU_ARCH_SYSTEM_PMU is disabled or modular?

Unlike the other drivers in this directory, CONFIG_ARM_BMU does not depend on CONFIG_ARM_CORESIGHT_PMU_ARCH_SYSTEM_PMU, but drivers/perf/Makefile only descends into arm_cspmu/ via:

drivers/perf/Makefile:

	obj-$(CONFIG_ARM_CORESIGHT_PMU_ARCH_SYSTEM_PMU) += arm_cspmu/

When CONFIG_ARM_CORESIGHT_PMU_ARCH_SYSTEM_PMU=n, Kbuild never enters drivers/perf/arm_cspmu/ and arm-bmu.o is not built at all; when CONFIG_ARM_CORESIGHT_PMU_ARCH_SYSTEM_PMU=m and CONFIG_ARM_BMU=y, arm_cspmu/ is only visited for modules and the built-in arm-bmu driver is omitted from vmlinux.

drivers/perf/Makefile should also add arm_cspmu/ for CONFIG_ARM_BMU (or use obj-y += arm_cspmu/).

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

Re: [PATCH v4 2/4] perf: Add Arm Bus Monitor Unit driver

Quoted 51 lines · On 2026-11-06 6:23 pm, [email protected] wrote:

Thank you for your contribution! Sashiko AI review found 1 potential issue to consider:
- [Medium] perf: arm-bmu: driver omitted when ARM_CORESIGHT_PMU_ARCH_SYSTEM_PMU is n or m
--

commit 0be62f2184bd603abec9ec13cdc4790db8588fea
Author: Robin Murphy <[email protected]>

perf: Add Arm Bus Monitor Unit driver

This commit adds a perf driver for Arm's Bus Monitor Unit in drivers/perf/arm_cspmu/ to support transaction matching and counting across interface monitoring units.

Quoted 19 lines
drivers/perf/arm_cspmu/Kconfig +6 -0
index 25bd55f036a4f..48c2a3ac7fab5 100644
@@ -34,3 +34,9 @@ config ARM_SYSTEM_PMU
  	help
  	  Support additional event filtering attributes for the CoreSight-based
  	  PMU blocks found in various parts of Arm Compute Subsystems and SoCs.
+
+config ARM_BMU
+	tristate "ARM Bus Monitor Unit"
+	depends on (ARM64 && ACPI) || COMPILE_TEST
+	help
+	  Support perf event counting on Arm Bus Monitor Unit devices.
drivers/perf/arm_cspmu/Makefile +0 -0
index 90c3cd7101577..4e0b420a2b55f 100644

drivers/perf/arm_cspmu/Makefile arm_cspmu_module-y := arm_cspmu.o · line 13

Quoted 5 lines
drivers/perf/arm_cspmu/Makefile +2 -0
@@ -9,3 +9,5 @@ arm_cspmu_module-y := arm_cspmu.o
  obj-$(CONFIG_NVIDIA_CORESIGHT_PMU_ARCH_SYSTEM_PMU) += nvidia_cspmu.o
  obj-$(CONFIG_AMPERE_CORESIGHT_PMU_ARCH_SYSTEM_PMU) += ampere_cspmu.o
  obj-$(CONFIG_ARM_SYSTEM_PMU) += arm_syspmu.o
+
+obj-$(CONFIG_ARM_BMU) += arm-bmu.o

[Severity: Medium]
Will arm-bmu.o be skipped during the build when CONFIG_ARM_CORESIGHT_PMU_ARCH_SYSTEM_PMU is disabled or modular?

Unlike the other drivers in this directory, CONFIG_ARM_BMU does not depend on CONFIG_ARM_CORESIGHT_PMU_ARCH_SYSTEM_PMU, but drivers/perf/Makefile only descends into arm_cspmu/ via:

drivers/perf/Makefile:

	obj-$(CONFIG_ARM_CORESIGHT_PMU_ARCH_SYSTEM_PMU) += arm_cspmu/
Quoted 9 lines

When CONFIG_ARM_CORESIGHT_PMU_ARCH_SYSTEM_PMU=n, Kbuild never enters drivers/perf/arm_cspmu/ and arm-bmu.o is not built at all; when CONFIG_ARM_CORESIGHT_PMU_ARCH_SYSTEM_PMU=m and CONFIG_ARM_BMU=y, arm_cspmu/ is only visited for modules and the built-in arm-bmu driver is omitted from vmlinux.

drivers/perf/Makefile should also add arm_cspmu/ for CONFIG_ARM_BMU (or use obj-y += arm_cspmu/).

Unlikely to be an issue in practice for the moment, as the users who want arm-bmu also want arm_syspmu anyway (did you notice I sent them together as a series?). However the existing double-conditional compilation does seem a bit silly in general, so I've sent a quick patch to clean that up separately.

Thanks,
Robin.

#7 lore raw

PATCH v4 3/4 dt-bindings: perf: Add Arm Bus Monitor Unit

In reply to Robin Murphy

Arm's Bus Monitor Unit is a low-level performance analysis tool for matching and counting transactions at interconnect interfaces. Typical platforms will have multiple BMUs each measuring multiple interfaces in various parts of the system, hence for the sake of usability we make it mandatory for the platform to label each instance such that the end user can correlate with platform documentation to know what's what.

---
 .../bindings/perf/arm,bus-monitor-unit.yaml   | 41 +++++++++++++++++++
 1 file changed, 41 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/perf/arm,bus-monitor-unit.yaml
Documentation/devicetree/bindings/perf/arm,bus-monitor-unit.yaml new file +41 -0
new file mode 100644
index 000000000000..3da59e5447e0
@@ -0,0 +1,41 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/perf/arm,bus-monitor-unit.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Arm Bus Monitor Unit
+
+maintainers:
+  - Robin Murphy <[email protected]>
+
+properties:
+  compatible:
+    const: arm,bus-monitor-unit
+
+  reg:
+    items:
+      - description: Full BMU register space
+
+  interrupts:
+    items:
+      - description: PMU overflow interrupt
+
+  label:
+    description: BMU instance identifier (same as ACPI _UID), per the
+      platform optimisation guide
+
+required:
+  - compatible
+  - reg
+  - label
+
+additionalProperties: false
+
+examples:
+  - |
+    pmu@12340000 {
+        compatible = "arm,bus-monitor-unit";
+        reg = <0x12340000 0x40000>;
+        label = "ddr_ch_1_2";
+    };
Signature · 1 line
2.54.0.dirty
#8 lore raw

Re: [PATCH v4 3/4] dt-bindings: perf: Add Arm Bus Monitor Unit

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

Arm's Bus Monitor Unit is a low-level performance analysis tool for matching and counting transactions at interconnect interfaces. Typical platforms will have multiple BMUs each measuring multiple interfaces in various parts of the system, hence for the sake of usability we make it mandatory for the platform to label each instance such that the end user can correlate with platform documentation to know what's what.

Sashiko has reviewed this patch and found no issues.

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

PATCH v4 4/4 perf/arm-bmu: Add Devicetree support

In reply to Robin Murphy

Initial production BMU users will be ACPI-based, but DT consumers will almost certainly come along sooner or later.

---
 drivers/perf/arm_cspmu/Kconfig   |  2 +-
 drivers/perf/arm_cspmu/arm-bmu.c | 15 ++++++++++++++-
 2 files changed, 15 insertions(+), 2 deletions(-)
drivers/perf/arm_cspmu/Kconfig +1 -1
index 48c2a3ac7fab..8ce05bbe6b9a 100644
@@ -37,6 +37,6 @@ config ARM_SYSTEM_PMU
 
 config ARM_BMU
 	tristate "ARM Bus Monitor Unit"
-	depends on (ARM64 && ACPI) || COMPILE_TEST
+	depends on ARM64 || COMPILE_TEST
 	help
 	  Support perf event counting on Arm Bus Monitor Unit devices.
drivers/perf/arm_cspmu/arm-bmu.c +14 -1
index fe25954ac836..aa4ccbdae7a2 100644
@@ -6,6 +6,7 @@
 #include <linux/interrupt.h>
 #include <linux/io-64-nonatomic-lo-hi.h>
 #include <linux/module.h>
+#include <linux/of.h>
 #include <linux/perf_event.h>
 #include <linux/platform_device.h>
 #include <linux/property.h>
@@ -409,7 +410,10 @@ static int arm_bmu_probe(struct platform_device *pdev)
 		.read = arm_bmu_event_read,
 	};
 
-	name = acpi_device_uid(ACPI_COMPANION(dev));
+	if (has_acpi_companion(dev))
+		name = acpi_device_uid(ACPI_COMPANION(dev));
+	else
+		device_property_read_string(dev, "label", &name);
 
 	if (name)
 		name = devm_kasprintf(dev, GFP_KERNEL, "arm_bmu_%s", name);
@@ -440,6 +444,14 @@ static void arm_bmu_remove(struct platform_device *pdev)
 	cpuhp_state_remove_instance_nocalls(arm_bmu_cpuhp_state, &bmu->cpuhp_node);
 }
 
+#ifdef CONFIG_OF
+static const struct of_device_id arm_bmu_of_match[] = {
+	{ .compatible = "arm,bus-monitor-unit" },
+	{}
+};
+MODULE_DEVICE_TABLE(of, arm_bmu_of_match);
+#endif
+
 #ifdef CONFIG_ACPI
 static const struct acpi_device_id arm_bmu_acpi_match[] = {
 	{ "ARMHB001" },
@@ -451,6 +463,7 @@ MODULE_DEVICE_TABLE(acpi, arm_bmu_acpi_match);
 static struct platform_driver arm_bmu_driver = {
 	.driver = {
 		.name = "arm-bmu",
+		.of_match_table = of_match_ptr(arm_bmu_of_match),
 		.acpi_match_table = ACPI_PTR(arm_bmu_acpi_match),
 		.suppress_bind_attrs = true,
 	},
Signature · 1 line
2.54.0.dirty
#10 lore raw

Re: [PATCH v4 4/4] perf/arm-bmu: Add Devicetree support

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

Initial production BMU users will be ACPI-based, but DT consumers will almost certainly come along sooner or later.

Sashiko has reviewed this patch and found no issues.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=4