Skip to contentSkip to conversation

arm64: tegra: fix PPI interrupt flag

PATCH In review Aniruddha Banerjee 3 participants 3 messages Apr 3, 2017

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

PATCH 1/1 arm64: tegra: fix PPI interrupt flag

The interrupt flag for PPI should not be set to any value, since the register is read-only. Fix the flags for the PPI interrupts to IRQ_TYPE_NONE, so that there is no write to the read-only register.

---
 arch/arm64/boot/dts/nvidia/tegra132.dtsi | 8 ++++----
 arch/arm64/boot/dts/nvidia/tegra186.dtsi | 8 ++++----
 arch/arm64/boot/dts/nvidia/tegra210.dtsi | 8 ++++----
 3 files changed, 12 insertions(+), 12 deletions(-)
arch/arm64/boot/dts/nvidia/tegra132.dtsi +4 -4
index 3f3a46a4bd01..219fb3c6a273 100644
@@ -1093,13 +1093,13 @@
 	timer {
 		compatible = "arm,armv7-timer";
 		interrupts = <GIC_PPI 13
-				(GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
+				(GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_NONE)>,
 			     <GIC_PPI 14
-				(GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
+				(GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_NONE)>,
 			     <GIC_PPI 11
-				(GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
+				(GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_NONE)>,
 			     <GIC_PPI 10
-				(GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>;
+				(GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_NONE)>;
 		interrupt-parent = <&gic>;
 	};
 };
arch/arm64/boot/dts/nvidia/tegra186.dtsi +4 -4
index 62fa85ae0271..e602299f7694 100644
@@ -390,13 +390,13 @@
 	timer {
 		compatible = "arm,armv8-timer";
 		interrupts = <GIC_PPI 13
-				(GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
+				(GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_NONE)>,
 			     <GIC_PPI 14
-				(GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
+				(GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_NONE)>,
 			     <GIC_PPI 11
-				(GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
+				(GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_NONE)>,
 			     <GIC_PPI 10
-				(GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>;
+				(GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_NONE)>;
 		interrupt-parent = <&gic>;
 	};
 };
arch/arm64/boot/dts/nvidia/tegra210.dtsi +4 -4
index 2f832df29da8..6f3060b40a40 100644
@@ -1214,13 +1214,13 @@
 	timer {
 		compatible = "arm,armv8-timer";
 		interrupts = <GIC_PPI 13
-				(GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
+				(GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_NONE)>,
 			     <GIC_PPI 14
-				(GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
+				(GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_NONE)>,
 			     <GIC_PPI 11
-				(GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
+				(GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_NONE)>,
 			     <GIC_PPI 10
-				(GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>;
+				(GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_NONE)>;
 		interrupt-parent = <&gic>;
 	};
 
Signature · 1 line
2.11.0
maintainer
#1 lore raw

Adding Marc ...

Quoted 3 lines · Aniruddha Banerjee

The interrupt flag for PPI should not be set to any value, since the register is read-only. Fix the flags for the PPI interrupts to IRQ_TYPE_NONE, so that there is no write to the read-only register.

If the below matches the h/w default, does this really cause a problem?

Note, we will not attempt to write the type if it matches the current programmed type.

I had thought that the in DT file, the type for the PPI should align with the h/w default in the case where it cannot be written. However, I guess this is not explicitly stated anywhere I have found, but at the same time the binding doc for the arm,gic.txt does not list "IRQ_TYPE_NONE" as an option.

Marc, what are your thoughts?

Quoted 62 lines
---
 arch/arm64/boot/dts/nvidia/tegra132.dtsi | 8 ++++----
 arch/arm64/boot/dts/nvidia/tegra186.dtsi | 8 ++++----
 arch/arm64/boot/dts/nvidia/tegra210.dtsi | 8 ++++----
 3 files changed, 12 insertions(+), 12 deletions(-)
arch/arm64/boot/dts/nvidia/tegra132.dtsi +4 -4
index 3f3a46a4bd01..219fb3c6a273 100644
@@ -1093,13 +1093,13 @@
 	timer {
 		compatible = "arm,armv7-timer";
 		interrupts = <GIC_PPI 13
-				(GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
+				(GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_NONE)>,
 			     <GIC_PPI 14
-				(GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
+				(GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_NONE)>,
 			     <GIC_PPI 11
-				(GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
+				(GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_NONE)>,
 			     <GIC_PPI 10
-				(GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>;
+				(GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_NONE)>;
 		interrupt-parent = <&gic>;
 	};
 };
arch/arm64/boot/dts/nvidia/tegra186.dtsi +4 -4
index 62fa85ae0271..e602299f7694 100644
@@ -390,13 +390,13 @@
 	timer {
 		compatible = "arm,armv8-timer";
 		interrupts = <GIC_PPI 13
-				(GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
+				(GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_NONE)>,
 			     <GIC_PPI 14
-				(GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
+				(GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_NONE)>,
 			     <GIC_PPI 11
-				(GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
+				(GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_NONE)>,
 			     <GIC_PPI 10
-				(GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>;
+				(GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_NONE)>;
 		interrupt-parent = <&gic>;
 	};
 };
arch/arm64/boot/dts/nvidia/tegra210.dtsi +1 -1
index 2f832df29da8..6f3060b40a40 100644
@@ -1214,13 +1214,13 @@
 	timer {
 		compatible = "arm,armv8-timer";
 		interrupts = <GIC_PPI 13
-				(GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
+				(GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_NONE)>,
 			     <GIC_PPI 14

arch/arm64/boot/dts/nvidia/tegra210.dtsi line 1225

Quoted 10 lines
arch/arm64/boot/dts/nvidia/tegra210.dtsi +3 -3
-				(GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
+				(GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_NONE)>,
 			     <GIC_PPI 11
-				(GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
+				(GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_NONE)>,
 			     <GIC_PPI 10
-				(GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>;
+				(GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_NONE)>;
 		interrupt-parent = <&gic>;
 	};

Cheers
Jon

Signature · 1 line
nvpublic
#2 lore raw
Quoted 12 lines · Jon Hunter

Adding Marc ...

Quoted 3 lines · Aniruddha Banerjee

The interrupt flag for PPI should not be set to any value, since the register is read-only. Fix the flags for the PPI interrupts to IRQ_TYPE_NONE, so that there is no write to the read-only register.

If the below matches the h/w default, does this really cause a problem?

Note, we will not attempt to write the type if it matches the current programmed type.

Quoted 7 lines

I had thought that the in DT file, the type for the PPI should align with the h/w default in the case where it cannot be written. However, I guess this is not explicitly stated anywhere I have found, but at the same time the binding doc for the arm,gic.txt does not list "IRQ_TYPE_NONE" as an option.

Marc, what are your thoughts?

My immediate answer is "Why?".

As you pointed out, we don't even try to program the GICD_ICFGR1 register if what we read from it is the right thing. Also, the GICv2 spec says in 4.3.13: "For PPIs, it is IMPLEMENTATION DEFINED whether the most significant bit of the Int_config field is programmable.".

So NONE is always wrong (because there is no such thing in the HW), and the DT should have a setting that matches the HW even GICD_ICFGR1 is RO (the OS may need to know how the triggering configuration anyhow).

Aniruddha: what problem are you trying to solve here? The DT you're touching seems just fine to me...

Thanks,

	M.
Signature · 1 line
Jazz is not dead. It just smells funny...