[PATCH] ARM: bcm: Send the BCMBCA CFE wakeup SGI directly

Jie Feng hjf3108 at gmail.com
Wed Dec 2 08:49:39 PST 2026


On Wed, 2 Dec 2026 at 21:22, Linus Walleij <linusw at kernel.org> wrote:
>
> The GICv2 driver learns a CPU's target bit when that CPU starts.
> Before then, its provisional target mask can address multiple CPU
> interfaces. CFE wakes the secondary when an interrupt arrives, so
> use an explicit target for this first SGI.
>
> Map the Cortex-A7 GIC distributor using the CPU node's interrupt
> parent in DeviceTree. On BCM6846, CPU1's hardware ID selects target
> bit 1. Keep the barrier that completes the CFE mailbox write before
> sending SGI 0 directly to that target.
>
> Suggested-by: Marc Zyngier <maz at kernel.org>
> Link: https://lore.kernel.org/linux-arm-kernel/20261123142203.3860616-3-hjf3108@gmail.com/
> Fixes: db4d1458f203 ("ARM: bcm: Add CFE SMP support for BCMBCA")
> Signed-off-by: Linus Walleij <linusw at kernel.org>
> ---
> An LLM assisted in authoring the patch.
>
> Jie can you test this on your hardware?
> ---
>  arch/arm/mach-bcm/board_bcmbca.c | 43 ++++++++++++++++++++++++++++++++++------
>  1 file changed, 37 insertions(+), 6 deletions(-)
>
> diff --git a/arch/arm/mach-bcm/board_bcmbca.c b/arch/arm/mach-bcm/board_bcmbca.c
> index 248b8bd77645..5b21629446c6 100644
> --- a/arch/arm/mach-bcm/board_bcmbca.c
> +++ b/arch/arm/mach-bcm/board_bcmbca.c
> @@ -1,8 +1,12 @@
>  // SPDX-License-Identifier: GPL-2.0-only
>  // Copyright (C) 2024 Linus Walleij <linus.walleij at linaro.org>
>
> +#include <linux/bits.h>
>  #include <linux/io.h>
> +#include <linux/irqchip/arm-gic.h>
>  #include <linux/of.h>
> +#include <linux/of_address.h>
> +#include <linux/of_irq.h>
>  #include <linux/smp.h>
>
>  #include <asm/mach/arch.h>
> @@ -29,15 +33,19 @@ static void __init bcmbca_map_io(void)
>  }
>
>  #ifdef CONFIG_SMP
> +#define BCMBCA_SGIR_TARGET_SHIFT       16
> +#define BCMBCA_WAKEUP_SGI      0
> +
>  static int bcmbca_boot_secondary(unsigned int cpu, struct task_struct *idle)
>  {
> -       struct device_node *np;
> -       void __iomem *mailbox;
> +       unsigned int hwid = cpu_logical_map(cpu);
> +       struct device_node *np, *gic_node;
> +       void __iomem *mailbox, *gic_dist;
>         u32 release_addr;
>         int ret;
>
>         /* CFE has already powered up CPU1 and left it waiting in WFI. */
> -       if (cpu_logical_map(cpu) != 1)
> +       if (hwid != 1)
>                 return -EINVAL;
This still prevents CPU2 and CPU3 from booting up.
>         np = of_get_cpu_node(cpu, NULL);
> @@ -45,15 +53,30 @@ static int bcmbca_boot_secondary(unsigned int cpu, struct task_struct *idle)
>                 return -ENODEV;
>
>         ret = of_property_read_u32(np, "cpu-release-addr", &release_addr);
> -       of_node_put(np);
>         if (ret) {
> +               of_node_put(np);
>                 pr_err("CPU%u: missing or invalid cpu-release-addr property\n", cpu);
>                 return ret;
>         }
>
> +       gic_node = of_irq_find_parent(np);
> +       of_node_put(np);
> +       if (!of_device_is_compatible(gic_node, "arm,cortex-a7-gic") ||
> +           !of_device_is_available(gic_node)) {
> +               of_node_put(gic_node);
> +               return -ENODEV;
> +       }
> +
> +       gic_dist = of_iomap(gic_node, 0);
> +       of_node_put(gic_node);
> +       if (!gic_dist)
> +               return -ENOMEM;
> +
>         mailbox = ioremap(release_addr, sizeof(u32));
> -       if (!mailbox)
> +       if (!mailbox) {
> +               iounmap(gic_dist);
>                 return -ENOMEM;
> +       }
>
>         /*
>          * The CFE stub reads GPIO GeneralPurpose after an interrupt and
> @@ -62,8 +85,16 @@ static int bcmbca_boot_secondary(unsigned int cpu, struct task_struct *idle)
>          */
>         writel(__pa_symbol(secondary_startup_arm) & ~1, mailbox);
CFE parks the cores in WFI. Since WFI may return spuriously, there is
a small window between writing it and the IPI for the secondary core
being sent. Unlikely to happen in practice I think.
>         dsb(sy);
> -       arch_send_wakeup_ipi_mask(cpumask_of(cpu));
> +
> +       /*
> +        * The integrated Cortex-A7 GIC uses CPU1's hardware ID as its
> +        * target bit. Linux has yet to discover that CPU's GIC target.
> +        * Use SGI 0, the same interrupt as the ARM GICv2 wakeup IPI.
> +        */
> +       writel_relaxed(BIT(BCMBCA_SGIR_TARGET_SHIFT + hwid) | BCMBCA_WAKEUP_SGI,
> +                      gic_dist + GIC_DIST_SOFTINT);
>         iounmap(mailbox);
> +       iounmap(gic_dist);
>
>         return 0;
>  }
>
Tested on BCM6755. All secondary cores are brought up without the hwid
!= 1 check.

You can put this after removing the if (hwid != 1) check:
Tested-by: Ho Jie Feng <hjf3108 at gmail.com>
> ---
> base-commit: 21f8531821461fa0c05e4605c01d8d56d28b514e
> change-id: 20261202-bcmbca-smp-gicv2-535b6d4c72cf
>
> Best regards,
> --
> Linus Walleij <linusw at kernel.org>
>

Best regards,
Ho Jie Feng



More information about the linux-arm-kernel mailing list