[PATCH 01/18] sparc32,leon: give the cross-call IRQ highest priority

From: Magnus Lindholm

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


A CPU can spin on cross_call_lock at PIL 15 while the lock holder
waits for it to acknowledge IRQ15. If firmware gives a lower-numbered
interrupt higher priority in IRQMP, that interrupt can keep IRQ15 from
reaching the waiting CPU.

Put IRQ15 in IRQMP's high-priority group before enabling cross-calls.
IRQ15 wins within that group. Preserve the priorities of the other
interrupts.

Fixes: 8401707ff645 ("sparc,leon: Sparc-Leon SMP support")
Signed-off-by: Magnus Lindholm <linmag7@xxxxxxxxx>
---
arch/sparc/kernel/leon_smp.c | 9 +++++++++
1 file changed, 9 insertions(+)

diff --git a/arch/sparc/kernel/leon_smp.c b/arch/sparc/kernel/leon_smp.c
index 1ee393abc463..649f219e2b69 100644
--- a/arch/sparc/kernel/leon_smp.c
+++ b/arch/sparc/kernel/leon_smp.c
@@ -159,6 +159,7 @@ void __init leon_boot_cpus(void)
{
int nrcpu = leon_smp_nrcpus();
int me = smp_processor_id();
+ u32 level;

/* Setup IPI */
leon_ipi_init();
@@ -167,6 +168,14 @@ void __init leon_boot_cpus(void)
(unsigned int)nrcpu, (unsigned int)NR_CPUS,
(unsigned int)&(leon3_irqctrl_regs->mpstatus));

+ /*
+ * Cross-calls must reach a CPU even while it spins with PIL 15.
+ * A lower-numbered IRQ in IRQMP's high priority group can otherwise
+ * keep IRQ15 from reaching the CPU until that IRQ is serviced.
+ */
+ level = LEON3_BYPASS_LOAD_PA(&leon3_irqctrl_regs->ilevel);
+ LEON3_BYPASS_STORE_PA(&leon3_irqctrl_regs->ilevel,
+ level | BIT(LEON3_IRQ_CROSS_CALL));
leon_enable_irq_cpu(LEON3_IRQ_CROSS_CALL, me);
leon_enable_irq_cpu(LEON3_IRQ_TICKER, me);
leon_enable_irq_cpu(leon_ipi_irq, me);
--
2.43.0