Skip to contentSkip to conversation

irqchip/gic-v3: Add Altera Agilex5 address bus

PATCH In review [email protected] 2 participants 3 messages Jul 4, 2025

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

v2 cover irqchip/gic-v3: Add Altera Agilex5 address bus

From: Adrian Ng Ho Yin <[email protected]>

Agilex5 address bus width for the ACE-lite interface is only 32 bits. Hence the GIC600 SoC integration for Agilex5 can only access the first 32bit of the physical address space.

Add quirk to configure the gfp flag to allocate memory within 32bit addressable range. As the 0x0201743b GIC600 ID is not specific to Altera, of_machine_is_compatible() is added.

Add config in arm64 Kconfig to enable quirk.

change log:
v2: - Reworked implementation to reuse existing infrastructure as
requested by Marc Zyngier.

- Add new config in arm64 Kconfig to enable quirk.

- Dropped dt and binding changes.
---
v1: - https://lore.kernel.org/all/[email protected]/

Adrian Ng Ho Yin (1):
irqchip/gic-v3: Add Altera Agilex5 address bus width limitation
workaround

 arch/arm64/Kconfig               | 10 ++++++++++
 drivers/irqchip/irq-gic-v3-its.c | 18 ++++++++++++++++++
 2 files changed, 28 insertions(+)
Signature · 1 line
2.49.GIT
#1 lore raw

PATCH v2 1/1 irqchip/gic-v3: Add Altera Agilex5 address bus width limitation workaround

From: Adrian Ng Ho Yin <[email protected]>

Agilex5 address bus width for the ACE-lite interface is only 32 bits. Hence the GIC600 SoC integration for Agilex5 can only access the first 32bit of the physical address space.

Add quirk to configure the gfp flag to allocate memory within 32bit addressable range. As the 0x0201743b GIC600 ID is not specific to Altera, of_machine_is_compatible() is added.

---
 arch/arm64/Kconfig               | 10 ++++++++++
 drivers/irqchip/irq-gic-v3-its.c | 18 ++++++++++++++++++
 2 files changed, 28 insertions(+)
arch/arm64/Kconfig +10 -0
index 55fc331af337..2286b4d378e2 100644
@@ -1348,6 +1348,16 @@ config SOCIONEXT_SYNQUACER_PREITS
 
 	  If unsure, say Y.
 
+config ALTERA_AGILEX5_ADDR_BUS_WIDTH_LIMITATION
+	bool "Altera Agilex: GIC600 can not access physical addresses higher than 4GB"
+	default y
+	help
+	  Agilex5 address bus width for the ACE-lite interface is only 32 bits. Hence
+	  the GIC600 SoC integration for Agilex5 can only access the first 32bit of the
+	  physical address space.
+
+	  If unsure, say Y.
+
 endmenu # "ARM errata workarounds via the alternatives framework"
 
 choice
drivers/irqchip/irq-gic-v3-its.c +18 -0
index d54fa0638dc4..a2cf401568e7 100644
@@ -4901,6 +4901,16 @@ static bool __maybe_unused its_enable_rk3568002(void *data)
 	return true;
 }
 
+static bool __maybe_unused its_enable_agilex5(void *data)
+{
+	if (!of_machine_is_compatible("intel,socfpga-agilex5"))
+		return false;
+
+	gfp_flags_quirk |= GFP_DMA32;
+
+	return true;
+}
+
 static const struct gic_quirk its_quirks[] = {
 #ifdef CONFIG_CAVIUM_ERRATUM_22375
 	{
@@ -4975,6 +4985,14 @@ static const struct gic_quirk its_quirks[] = {
 		.mask   = 0xffffffff,
 		.init   = its_enable_rk3568002,
 	},
+#endif
+#ifdef ALTERA_AGILEX5_ADDR_BUS_WIDTH_LIMITATION
+	{
+		.desc   = "ITS: Altera Agilex5 address bus width limitation",
+		.iidr   = 0x0201743b,
+		.mask   = 0xffffffff,
+		.init   = its_enable_agilex5,
+	},
 #endif
 	{
 	}
Signature · 1 line
2.49.GIT
maintainer
#2 lore raw

Re: [PATCH v2 1/1] irqchip/gic-v3: Add Altera Agilex5 address bus width limitation workaround

Quoted 22 lines · On Fri, 04 Jul 2025 09:49:50 +0100, [email protected] wrote:

From: Adrian Ng Ho Yin <[email protected]>

Agilex5 address bus width for the ACE-lite interface is only 32 bits. Hence the GIC600 SoC integration for Agilex5 can only access the first 32bit of the physical address space.

Add quirk to configure the gfp flag to allocate memory within 32bit addressable range. As the 0x0201743b GIC600 ID is not specific to Altera, of_machine_is_compatible() is added.

---
 arch/arm64/Kconfig               | 10 ++++++++++
 drivers/irqchip/irq-gic-v3-its.c | 18 ++++++++++++++++++
 2 files changed, 28 insertions(+)
arch/arm64/Kconfig +0 -0
index 55fc331af337..2286b4d378e2 100644

arch/arm64/Kconfig config SOCIONEXT_SYNQUACER_PREITS · line 1357

Quoted 10 lines
arch/arm64/Kconfig +7 -0
@@ -1348,6 +1348,16 @@ config SOCIONEXT_SYNQUACER_PREITS
 
 	  If unsure, say Y.
 
+config ALTERA_AGILEX5_ADDR_BUS_WIDTH_LIMITATION
+	bool "Altera Agilex: GIC600 can not access physical addresses higher than 4GB"
+	default y
+	help
+	  Agilex5 address bus width for the ACE-lite interface is only 32 bits. Hence
+	  the GIC600 SoC integration for Agilex5 can only access the first 32bit of the
+	  physical address space.

You're describing it as a feature. But really, it's a bug, and it deserves an erratum number.

Quoted 32 lines
arch/arm64/Kconfig +3 -0
+
+	  If unsure, say Y.
+
 endmenu # "ARM errata workarounds via the alternatives framework"
 
 choice
drivers/irqchip/irq-gic-v3-its.c +11 -0
index d54fa0638dc4..a2cf401568e7 100644
@@ -4901,6 +4901,16 @@ static bool __maybe_unused its_enable_rk3568002(void *data)
 	return true;
 }
 
+static bool __maybe_unused its_enable_agilex5(void *data)
+{
+	if (!of_machine_is_compatible("intel,socfpga-agilex5"))
+		return false;
+
+	gfp_flags_quirk |= GFP_DMA32;
+
+	return true;
+}
+
 static const struct gic_quirk its_quirks[] = {
 #ifdef CONFIG_CAVIUM_ERRATUM_22375
 	{
@@ -4975,6 +4985,14 @@ static const struct gic_quirk its_quirks[] = {
 		.mask   = 0xffffffff,
 		.init   = its_enable_rk3568002,
 	},
+#endif

drivers/irqchip/irq-gic-v3-its.c static const struct gic_quirk its_quirks[] = { · line 4998

Quoted 10 lines
drivers/irqchip/irq-gic-v3-its.c +7 -0
+#ifdef ALTERA_AGILEX5_ADDR_BUS_WIDTH_LIMITATION
+	{
+		.desc   = "ITS: Altera Agilex5 address bus width limitation",
+		.iidr   = 0x0201743b,
+		.mask   = 0xffffffff,
+		.init   = its_enable_agilex5,
+	},
 #endif
 	{
 	}

Again, why do you need to reinvent the wheel? There is already *just above* an existing workaround that implements exactly the same thing.

The whole thing could look like the hack below.

	M.
drivers/irqchip/irq-gic-v3-its.c +12 -7
index d54fa0638dc44..7047408de3e37 100644
@@ -4890,10 +4890,17 @@ static bool __maybe_unused its_enable_quirk_hip09_162100801(void *data)
 	return true;
 }
 
-static bool __maybe_unused its_enable_rk3568002(void *data)
+static bool its_enable_32bit_disaster(void *data)
 {
-	if (!of_machine_is_compatible("rockchip,rk3566") &&
-	    !of_machine_is_compatible("rockchip,rk3568"))
+	static const char *broken[] = {
+#ifdef CONFIG_ROCKCHIP_ERRATUM_3568002
+		"rockchip,rk3566", "rockchip,rk3568",
+#endif
+		"intel,socfpga-agilex5",
+		NULL,
+	};
+
+	if (!of_machine_compatible_match(broken))
 		return false;
 
 	gfp_flags_quirk |= GFP_DMA32;
@@ -4968,14 +4975,12 @@ static const struct gic_quirk its_quirks[] = {
 		.property = "dma-noncoherent",
 		.init   = its_set_non_coherent,
 	},
-#ifdef CONFIG_ROCKCHIP_ERRATUM_3568002
 	{
-		.desc   = "ITS: Rockchip erratum RK3568002",
+		.desc   = "ITS: Broken GIC600 integration limited to 32bit",
 		.iidr   = 0x0201743b,
 		.mask   = 0xffffffff,
-		.init   = its_enable_rk3568002,
+		.init   = its_enable_32bit_disaster,
 	},
-#endif
 	{
 	}
 };
Signature · 1 line
Without deviation from the norm, progress is not possible.