OpenSBI Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] lib: sbi: Clear all IPI devices when processing an IPI
@ 2026-09-08 13:00 Troy Mitchell
  2026-09-11  9:32 ` Bo Gan
  0 siblings, 1 reply; 4+ messages in thread
From: Troy Mitchell @ 2026-09-08 13:00 UTC (permalink / raw)
  To: opensbi; +Cc: Anup Patel, Nick Hu, Kevin Zhang, Troy Mitchell

Hart start sends wake-up IPIs through all registered IPI devices, but
sbi_ipi_process() only clears the preferred device. A notification from
another device can arrive after warm initialization has cleared it.

With both IMSIC and ACLINT MSWI, IMSIC is preferred and has no ipi_clear
callback: its interrupts are acknowledged through MTOPEI. A late ACLINT
notification therefore leaves MSIP asserted, trapping the hart in the
machine-mode interrupt handler and potentially timing out Linux CPU
bring-up.

Clear all registered IPI devices before consuming the software IPI event
bits so that late wake-up notifications are acknowledged too.

Fixes: 94f0f8465622 ("lib: sbi: Extends sbi_ipi_raw_send() to use all available IPI devices")
Signed-off-by: Troy Mitchell <troy.mitchell@linux.dev>
---
 lib/sbi/sbi_ipi.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/lib/sbi/sbi_ipi.c b/lib/sbi/sbi_ipi.c
index b04a5877..683d559d 100644
--- a/lib/sbi/sbi_ipi.c
+++ b/lib/sbi/sbi_ipi.c
@@ -263,7 +263,12 @@ void sbi_ipi_process(void)
 			sbi_scratch_offset_ptr(scratch, ipi_data_off);
 
 	sbi_pmu_ctr_incr_fw(SBI_PMU_FW_IPI_RECVD);
-	sbi_ipi_raw_clear(false);
+	/*
+	 * A wake-up IPI is sent through all devices. A notification from a
+	 * non-preferred device can arrive after warm-boot initialization
+	 * cleared it, so acknowledge all devices when processing the IPI.
+	 */
+	sbi_ipi_raw_clear(true);
 
 	ipi_type = atomic_raw_xchg_ulong(&ipi_data->ipi_type, 0);
 	ipi_event = 0;

---
base-commit: 3593a5facc4c6938b90429a6973ba9ee21fc5899
change-id: 20260908-ipi-clear-all-54c3def85689

Best regards,
--  
Troy Mitchell <troy.mitchell@linux.dev>


-- 
opensbi mailing list
opensbi@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/opensbi

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-09-13 10:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-08 13:00 [PATCH] lib: sbi: Clear all IPI devices when processing an IPI Troy Mitchell
2026-09-11  9:32 ` Bo Gan
2026-09-12  9:09   ` Troy Mitchell
2026-09-13 10:04     ` Bo Gan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox