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

From: Linus Walleij

Date: Wed Nov 25 2026 - 16:01:06 EST


Hi Ho Jie,

thanks for your patch! It's nice to see others building on this
idea, for a while I thought I was the only person in the world
who care about BCMBCA upstream.

On Mon, Nov 23, 2026 at 3:22 PM Ho Jie Feng <hjf3108@xxxxxxxxx> wrote:

> +++ b/arch/arm/mach-bcm/bcmbca_headsmp.S

> +#include <linux/linkage.h>
> +#include <asm/assembler.h>
> +
> + .arm
> +ENTRY(bcmbca_secondary_startup)
> + ARM_BE8(setend be)

Are you aware about any people booting these platforms
in big endian? I don't think that works, just skip this.

> + THUMB( badr r9, 1f )
> + THUMB( bx r9 )
> + THUMB( .thumb )
> + THUMB(1: )

This code is for the CPU to switch from thumb mode to
ARM mode if it was booting in thumb mode. Does this
actually happen in practice? Else you can skip this too.
It just looks overly cautious.

Also the ordinary secondary_startup_arm does the same things already!

> + mrc p15, 0, r0, c0, c0, 5
> + bic r0, #0xff000000
> + adr_l r6, bcmbca_cpu_release
> +pen: ldr r7, [r6]
> + cmp r7, r0
> + bne pen
> +
> + b secondary_startup

And why are you first spinning on the GPIO address
and then spinning again in this "pen" (as a place for
livestock, such as CPUs ;) it was added to mach-versatile
to work around a CPU bug in early silicon.

As Russell King writes in 2018:
https://lore.kernel.org/linux-arm-kernel/20181213175952.GC26090@xxxxxxxxxxxxxxxxxxxxx/

> The "pen_release" thing was created for ARM Ltd development platforms
> where there was no way to individually control secondary CPUs leaving
> the boot loader - they all jumped to whatever physical code address
> was supplied at the same time. This made it necessary for _these_
> platforms to have a "holding pen" for the CPUs while the kernel
> initialised.

The "pen" is only needed if all CPUs jump to that address at the same
time. I don't think the BCMBCA platforms do that because you send
one IPI to each CPU?

So I would skip this assembly completely...
I don't understand why you're doing this other
than copy/paste?

> @@ -58,17 +76,27 @@ static int bcmbca_boot_secondary(unsigned int cpu, struct task_struct *idle)
> /*
> * The CFE stub reads GPIO GeneralPurpose after an interrupt and
> * branches to it in ARM state. Clear any Thumb function pointer
> - * tag and complete the MMIO write before sending the wakeup IPI.
> + * tag and complete the MMIO write before opening the pen and
> + * sending the wakeup IPI.
> */
> - writel(__pa_symbol(secondary_startup_arm) & ~1, mailbox);
> + writel(__pa_symbol(bcmbca_secondary_startup) & ~1, mailbox);
> dsb(sy);
> - arch_send_wakeup_ipi_mask(cpumask_of(cpu));

Have you actually tested *not* changing this code and see if
all CPUs just come up? It should just send each CPU in order to
secondary_startup_arm like we want?

Yours,
Linus Walleij