Skip to contentSkip to conversation

arm/arm64: dts: allwinner: Add PMU nodes

PATCH Applied Andre Przywara 2 participants 6 messages Nov 21, 2019

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

cover arm/arm64: dts: allwinner: Add PMU nodes

Arm Cortex cores contain a Performance Monitoring Unit (PMU), that needs to be connected to the GIC distributor to be able to trigger interrupts. The actual interrupt IDs are an integration choice, so need to be advertised via the DT.

This series adds the DT nodes to the H3, H5 and H6 SoC .dtsi files. The interrupt IDs are not always as described in the manual (off by 4 for the A64 and H5), so the IRQs have been both tested in U-Boot and verified in Linux, using "perf record" (which requires working IRQs).

Cheers,
Andre.

Andre Przywara (3):
arm64: dts: allwinner: H6: Add PMU mode
arm64: dts: allwinner: H5: Add PMU node
arm: dts: allwinner: H3: Add PMU node

 arch/arm/boot/dts/sun8i-h3.dtsi              | 15 ++++++++++++---
 arch/arm64/boot/dts/allwinner/sun50i-h5.dtsi | 16 +++++++++++++---
 arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi | 10 ++++++++++
 3 files changed, 35 insertions(+), 6 deletions(-)
Signature · 1 line
2.14.5
#1 lore raw

PATCH 1/3 arm64: dts: allwinner: H6: Add PMU mode

Add the Performance Monitoring Unit (PMU) device tree node to the H6 .dtsi, which tells DT users which interrupts are triggered by PMU overflow events on each core. The numbers come from the manual and have been checked in U-Boot and with perf in Linux.

Tested with perf record and taskset on a Pine H64.

---
 arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi | 10 ++++++++++
 1 file changed, 10 insertions(+)
arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi +10 -0
index 29824081b43b..86a77b1734e0 100644
@@ -70,6 +70,16 @@
 		clock-output-names = "ext_osc32k";
 	};
 
+        pmu {
+		compatible = "arm,cortex-a53-pmu",
+			     "arm,armv8-pmuv3";
+		interrupts = <GIC_SPI 140 IRQ_TYPE_LEVEL_HIGH>,
+			     <GIC_SPI 141 IRQ_TYPE_LEVEL_HIGH>,
+			     <GIC_SPI 142 IRQ_TYPE_LEVEL_HIGH>,
+			     <GIC_SPI 143 IRQ_TYPE_LEVEL_HIGH>;
+		interrupt-affinity = <&cpu0>, <&cpu1>, <&cpu2>, <&cpu3>;
+	};
+
 	psci {
 		compatible = "arm,psci-0.2";
 		method = "smc";
Signature · 1 line
2.14.5
#2 lore raw

Re: [PATCH 1/3] arm64: dts: allwinner: H6: Add PMU mode

Quoted 8 lines · Andre Przywara

Add the Performance Monitoring Unit (PMU) device tree node to the H6 .dtsi, which tells DT users which interrupts are triggered by PMU overflow events on each core. The numbers come from the manual and have been checked in U-Boot and with perf in Linux.

Tested with perf record and taskset on a Pine H64.

Queued all three patches for 5.6, thanks for taking the time to do this.

arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi line 73

Quoted 13 lines
---
 arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi | 10 ++++++++++
 1 file changed, 10 insertions(+)
arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi +1 -0
index 29824081b43b..86a77b1734e0 100644
@@ -70,6 +70,16 @@
 		clock-output-names = "ext_osc32k";
 	};
 
+        pmu {

This was indented with spaces however, unlike the rest of the DT. I've fixed it while applying.

Maxime

#3 lore raw

Re: [PATCH 1/3] arm64: dts: allwinner: H6: Add PMU mode

On Thu, 21 Nov 2019 08:22:30 +0100
Maxime Ripard <[email protected]> wrote:

Hi,

Quoted 25 lines · Andre Przywara
Quoted 8 lines

Add the Performance Monitoring Unit (PMU) device tree node to the H6 .dtsi, which tells DT users which interrupts are triggered by PMU overflow events on each core. The numbers come from the manual and have been checked in U-Boot and with perf in Linux.

Tested with perf record and taskset on a Pine H64.

Queued all three patches for 5.6, thanks for taking the time to do this.

Quoted 12 lines
---
 arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi | 10 ++++++++++
 1 file changed, 10 insertions(+)
arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi +0 -0
index 29824081b43b..86a77b1734e0 100644
@@ -70,6 +70,16 @@
 		clock-output-names = "ext_osc32k";
 	};
 
Quoted 4 lines

arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi line 73

Quoted 1 line
arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi +1 -0
+        pmu {  

This was indented with spaces however, unlike the rest of the DT. I've fixed it while applying.

Shoot, thinks for fixing this up, also for queuing it!

Cheers,
Andre.

#4 lore raw

PATCH 2/3 arm64: dts: allwinner: H5: Add PMU node

In reply to Andre Przywara

Add the Performance Monitoring Unit (PMU) device tree node to the H5 .dtsi, which tells DT users which interrupts are triggered by PMU overflow events on each core.
As with the A64, the interrupt numbers from the manual were wrong (off by 4), the actual SPI IDs have been gathered in U-Boot, and were verified with perf in Linux.

Tested with perf record and taskset on an OrangePi PC2.

---
 arch/arm64/boot/dts/allwinner/sun50i-h5.dtsi | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)
arch/arm64/boot/dts/allwinner/sun50i-h5.dtsi +13 -3
index e92c4de5bf3b..7c775a918a4e 100644
@@ -54,21 +54,21 @@
 			enable-method = "psci";
 		};
 
-		cpu@1 {
+		cpu1: cpu@1 {
 			compatible = "arm,cortex-a53";
 			device_type = "cpu";
 			reg = <1>;
 			enable-method = "psci";
 		};
 
-		cpu@2 {
+		cpu2: cpu@2 {
 			compatible = "arm,cortex-a53";
 			device_type = "cpu";
 			reg = <2>;
 			enable-method = "psci";
 		};
 
-		cpu@3 {
+		cpu3: cpu@3 {
 			compatible = "arm,cortex-a53";
 			device_type = "cpu";
 			reg = <3>;
@@ -76,6 +76,16 @@
 		};
 	};
 
+	pmu {
+		compatible = "arm,cortex-a53-pmu",
+			     "arm,armv8-pmuv3";
+		interrupts = <GIC_SPI 116 IRQ_TYPE_LEVEL_HIGH>,
+			     <GIC_SPI 117 IRQ_TYPE_LEVEL_HIGH>,
+			     <GIC_SPI 118 IRQ_TYPE_LEVEL_HIGH>,
+			     <GIC_SPI 119 IRQ_TYPE_LEVEL_HIGH>;
+		interrupt-affinity = <&cpu0>, <&cpu1>, <&cpu2>, <&cpu3>;
+	};
+
 	psci {
 		compatible = "arm,psci-0.2";
 		method = "smc";
Signature · 1 line
2.14.5
#5 lore raw

PATCH 3/3 arm: dts: allwinner: H3: Add PMU node

In reply to Andre Przywara

Add the Performance Monitoring Unit (PMU) device tree node to the H3 .dtsi, which tells DT users which interrupts are triggered by PMU overflow events on each core. The numbers come from the manual and have been checked in U-Boot and with perf in Linux.

Tested with perf record and taskset on an OrangePi Zero.

---
 arch/arm/boot/dts/sun8i-h3.dtsi | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)
arch/arm/boot/dts/sun8i-h3.dtsi +12 -3
index fe773c72a69b..b4f1673df9ee 100644
@@ -80,7 +80,7 @@
 			#cooling-cells = <2>;
 		};
 
-		cpu@1 {
+		cpu1: cpu@1 {
 			compatible = "arm,cortex-a7";
 			device_type = "cpu";
 			reg = <1>;
@@ -90,7 +90,7 @@
 			#cooling-cells = <2>;
 		};
 
-		cpu@2 {
+		cpu2: cpu@2 {
 			compatible = "arm,cortex-a7";
 			device_type = "cpu";
 			reg = <2>;
@@ -100,7 +100,7 @@
 			#cooling-cells = <2>;
 		};
 
-		cpu@3 {
+		cpu3: cpu@3 {
 			compatible = "arm,cortex-a7";
 			device_type = "cpu";
 			reg = <3>;
@@ -111,6 +111,15 @@
 		};
 	};
 
+	pmu {
+		compatible = "arm,cortex-a7-pmu";
+		interrupts = <GIC_SPI 120 IRQ_TYPE_LEVEL_HIGH>,
+			     <GIC_SPI 121 IRQ_TYPE_LEVEL_HIGH>,
+			     <GIC_SPI 122 IRQ_TYPE_LEVEL_HIGH>,
+			     <GIC_SPI 123 IRQ_TYPE_LEVEL_HIGH>;
+		interrupt-affinity = <&cpu0>, <&cpu1>, <&cpu2>, <&cpu3>;
+	};
+
 	timer {
 		compatible = "arm,armv7-timer";
 		interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
Signature · 1 line
2.14.5