Re: [PATCH 2/2] ARM: bcm: support more than two CPUs on BCMBCA

From: Marc Zyngier

Date: Wed Dec 02 2026 - 07:02:25 EST


On Tue, 01 Dec 2026 15:26:06 +0000,
Linus Walleij <linusw@xxxxxxxxxx> wrote:
>
> On Tue, Dec 1, 2026 at 3:49 PM Jie Feng <hjf3108@xxxxxxxxx> wrote:
>
> > > Yes? And it wakes up the secondary core targeted by that IPI,
> > > right?
>
> > And all the other secondary cores too. arch_send_wakeup_ipi_mask(CPU1)
> > wakes up CPU2 and CPU3.
>
> Aha OK that's unfortunate :(
>
> > I tested what you had suggested, write
> > secondary_startup_arm into the mailbox before the IPI and the router
> > crashed on boot up.
> > The reason is because irq-gic's gic_cpu_map is 0xff, so IPIs get sent
> > to all CPUs. I am not sure how to solve this without a holding pen, or
> > bypassing irq-gic directly writing to the GIC registers.
>
> Actually I think it is 0xfe when we get here.
> irq-gic.c initializes each gic_cpu_map[] entry to 0xff, but CPU0 then
> discovers its own interface bit from the banked GICD_ITARGETSR0–7
> registers and clears it from every other entry.
>
> But yes it has the same effect that IPIs from CPU0 will get broadcast
> to CPU1, 2, 3. The idea is for CPU1 to mask itself from the mask
> once it starts, and if the IPI has the effect of sending a broadcast
> to all three secondary CPUs this causes problems of course :/
>
> We ask Marc Zyngier what is going on here and how
> to fix it.
>
> Marc is there a good way to direct IPIs to a specific CPU for
> secondary CPU startup in the arm,cortex-a7-gic? Or do we need
> to use the "pen" method of putting the three CPUs to a spin wait?

The main issue here is that this is using the GIC driver to talk to
CPUs that the GIC driver doesn't know about yet, and this results in
the wrong behaviour. Not exactly surprising.

We avoided this particular pitfall on arm64 by not using interrupts at
all for our "spin-table" method, and instead relying on data being
written at specific addresses with a WFE/SEV pairing.

I think your best bet is to generate the SGI as a raw access to the
GIC, without involving the driver. This also means that this code must
know about the matching of the GIC view of a CPU and the CPU you
actually want to boot (the equivalent of gic_cpu_map[]).

Thanks,

M.

--
Without deviation from the norm, progress is not possible.