mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Magnus Lindholm <linmag7@gmail.com>
To: davem@davemloft.net, andreas@gaisler.com
Cc: sam@ravnborg.org, sparclinux@vger.kernel.org,
	linux-kernel@vger.kernel.org, linmag7@gmail.com
Subject: [PATCH 01/18] sparc32,leon: give the cross-call IRQ highest priority
Date: Thu, 26 Nov 2026 10:30:06 +0100	[thread overview]
Message-ID: <20261126093106.1345825-2-linmag7@gmail.com> (raw)
In-Reply-To: <20261126093106.1345825-1-linmag7@gmail.com>

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@gmail.com>
---
 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


  reply	other threads:[~2026-11-26  9:31 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-26  9:30 [PATCH 00/18] sparc32: LEON SMP, timer accounting and legacy board support Magnus Lindholm
2026-11-26  9:30 ` Magnus Lindholm [this message]
2026-11-26  9:30 ` [PATCH 02/18] sparc32,leon: retain SMP TLB shootdowns Magnus Lindholm
2026-11-26  9:30 ` [PATCH 03/18] sparc32,leon: publish instruction updates across CPUs Magnus Lindholm
2026-11-26  9:30 ` [PATCH 04/18] sparc32,leon: avoid nested IRQ accounting in the timer handler Magnus Lindholm
2026-11-26  9:30 ` [PATCH 05/18] sparc32: preserve both LEON PROM character-output conventions Magnus Lindholm
2026-11-26  9:30 ` [PATCH 06/18] sparc32: tolerate firmware nodes without a name property Magnus Lindholm
2026-11-26  9:30 ` [PATCH 07/18] sparc32: skip unavailable PROM V0 console metadata Magnus Lindholm
2026-11-26  9:30 ` [PATCH 08/18] sparc32,leon: identify LEON before the firmware model lookup Magnus Lindholm
2026-11-26  9:30 ` [PATCH 09/18] sparc32,leon: preserve the Linux IRQ14 vector during startup Magnus Lindholm
2026-11-26  9:30 ` [PATCH 10/18] sparc32,leon: use ASI 1 for locks on the GR-LEON4-ITX Magnus Lindholm
2026-11-26  9:30 ` [PATCH 11/18] sparc32,leon: restore the kernel header offsets used by U-Boot Magnus Lindholm
2026-11-26  9:30 ` [PATCH 12/18] sparc32: recognize the legacy LEON firmware machine ID Magnus Lindholm
2026-11-26  9:30 ` [PATCH 13/18] sparc32,leon: discover AMBA devices for legacy U-Boot PROMs Magnus Lindholm
2026-11-26  9:30 ` [PATCH 14/18] sparc32,leon: describe legacy AMBA I2C controllers Magnus Lindholm
2026-11-26  9:30 ` [PATCH 15/18] sparc32,leon: skip the GR-LEON4-ITX PROM mapping import Magnus Lindholm
2026-11-26  9:30 ` [PATCH 16/18] sparc32,leon: use the upper SDRAM on the GR-LEON4-ITX Magnus Lindholm
2026-11-26  9:30 ` [PATCH 17/18] sparc32,leon: combine legacy GRPCI1 plug-and-play resources Magnus Lindholm
2026-11-26  9:30 ` [PATCH 18/18] sparc32,leon: describe the DS1672 on the GR-LEON4-ITX Magnus Lindholm

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261126093106.1345825-2-linmag7@gmail.com \
    --to=linmag7@gmail.com \
    --cc=andreas@gaisler.com \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sam@ravnborg.org \
    --cc=sparclinux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®