[PATCH 09/18] sparc32,leon: preserve the Linux IRQ14 vector during startup

From: Magnus Lindholm

Date: Thu Nov 26 2026 - 04:31:54 EST


When LEON uses IRQ14 for IPIs, copying the firmware IRQ14 handler
overwrites Linux's IPI vector, including during secondary CPU startup.
Firmware supplies the IPI level through ipi_num. Legacy AMBA discovery
selects the highest free level below 15, IRQ14 on GR-LEON4-ITX.

Skip the firmware save/copy on every LEON CPU, preserving the linked
and patched Linux vector. Preserve the firmware-vector handling used
by other SPARC implementations.

Signed-off-by: Magnus Lindholm <linmag7@xxxxxxxxx>
---
arch/sparc/kernel/head_32.S | 9 +++++++++
1 file changed, 9 insertions(+)

diff --git a/arch/sparc/kernel/head_32.S b/arch/sparc/kernel/head_32.S
index 97000e9dffd6..6547717aac20 100644
--- a/arch/sparc/kernel/head_32.S
+++ b/arch/sparc/kernel/head_32.S
@@ -148,6 +148,15 @@ already_mapped:

/* Copy over the Prom's level 14 clock handler. */
copy_prom_lvl14:
+#ifdef CONFIG_SPARC_LEON
+ /* LEON uses the Linux IRQ14 vector, potentially for IPIs.
+ * Secondary CPUs also pass here and share the trap table,
+ * so never replace its vector with the firmware's handler.
+ */
+ leon_psr_compare %g3
+ be copy_prom_done
+ nop
+#endif
#if 1
/* DJHR
* preserve our linked/calculated instructions
--
2.43.0