[PATCH v3 1/4] sparc64: skip the trap block in xcall_deliver() when there is no target

From: Imre Kaloz

Date: Wed Oct 21 2026 - 19:36:06 EST


xcall_deliver() writes the mondo data and the target CPU list through
the trap block's physical addresses before it knows whether any CPU is
targeted. These addresses stay zero until init_IRQ() sets them up, so a
cross call made earlier, while only the boot CPU is online, would write
starting at physical address 0.

Return before touching the trap block when no other online CPU is in
the mask.

Signed-off-by: Imre Kaloz <kaloz@xxxxxxxxxx>
---
arch/sparc/kernel/smp_64.c | 9 +++++++++
1 file changed, 9 insertions(+)

diff --git a/arch/sparc/kernel/smp_64.c b/arch/sparc/kernel/smp_64.c
index 371460e34484..4240c129c5fe 100644
--- a/arch/sparc/kernel/smp_64.c
+++ b/arch/sparc/kernel/smp_64.c
@@ -801,6 +801,15 @@ static void xcall_deliver(u64 data0, u64 data1, u64 data2, const cpumask_t *mask
local_irq_save(flags);

this_cpu = smp_processor_id();
+
+ /* The mondo block and cpu list are not set up until init_IRQ(),
+ * so do not touch them unless there is a cpu to send to.
+ */
+ if (cpumask_any_and_but(mask, cpu_online_mask, this_cpu) >= nr_cpu_ids) {
+ local_irq_restore(flags);
+ return;
+ }
+
tb = &trap_block[this_cpu];

mondo = __va(tb->cpu_mondo_block_pa);
--
2.47.3