From: Linus Walleij <linusw@kernel.org>
To: "Ho Jie Feng" <hjf3108@gmail.com>,
"Marc Zyngier" <maz@kernel.org>,
"Florian Fainelli" <florian.fainelli@broadcom.com>,
"Broadcom internal kernel review list"
<bcm-kernel-feedback-list@broadcom.com>,
"William Zhang" <william.zhang@broadcom.com>,
"Anand Gore" <anand.gore@broadcom.com>,
"Kursad Oney" <kursad.oney@broadcom.com>,
"Rafał Miłecki" <rafal@milecki.pl>
Cc: linux-arm-kernel@lists.infradead.org, Linus Walleij <linusw@kernel.org>
Subject: [PATCH v2] ARM: bcm: Send the BCMBCA CFE wakeup SGI directly
Date: Wed, 02 Dec 2026 22:23:28 +0100 [thread overview]
Message-ID: <20261202-bcmbca-smp-gicv2-v2-1-da89fbb5dbb8@kernel.org> (raw)
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. Use the core ID from MPIDR affinity level 0 as
the target bit in the integrated Cortex-A7 GIC. Keep the barrier that
completes the CFE mailbox write before sending SGI 0 to that target.
Suggested-by: Marc Zyngier <maz@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")
Tested-by: Ho Jie Feng <hjf3108@gmail.com>
Signed-off-by: Linus Walleij <linusw@kernel.org>
---
An LLM assisted in authoring the patch.
---
Changes in v2:
- Remove the CPU1-only wakeup restriction.
- Collect Jie's Tested-by.
- Derive the SGI target from MPIDR affinity level 0. Should mean not
difference since BCMBCA doesn't use the cluster bits, but better
safe than sorry.
- Link to v1: https://patch.msgid.link/20261202-bcmbca-smp-gicv2-v1-1-782c02982a7c@kernel.org
---
arch/arm/mach-bcm/board_bcmbca.c | 46 ++++++++++++++++++++++++++++++++++------
1 file changed, 39 insertions(+), 7 deletions(-)
diff --git a/arch/arm/mach-bcm/board_bcmbca.c b/arch/arm/mach-bcm/board_bcmbca.c
index 248b8bd77645..e85dd48f3cca 100644
--- a/arch/arm/mach-bcm/board_bcmbca.c
+++ b/arch/arm/mach-bcm/board_bcmbca.c
@@ -1,10 +1,15 @@
// SPDX-License-Identifier: GPL-2.0-only
// Copyright (C) 2024 Linus Walleij <linus.walleij@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/cputype.h>
#include <asm/mach/arch.h>
#include <asm/mach/map.h>
#include <asm/smp_plat.h>
@@ -29,15 +34,19 @@ static void __init bcmbca_map_io(void)
}
#ifdef CONFIG_SMP
+#define BCMBCA_GIC_CPU_IFS 8
+#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 gic_cpu = MPIDR_AFFINITY_LEVEL(cpu_logical_map(cpu), 0);
+ 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 (gic_cpu >= BCMBCA_GIC_CPU_IFS)
return -EINVAL;
np = of_get_cpu_node(cpu, NULL);
@@ -45,15 +54,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 +86,16 @@ static int bcmbca_boot_secondary(unsigned int cpu, struct task_struct *idle)
*/
writel(__pa_symbol(secondary_startup_arm) & ~1, mailbox);
dsb(sy);
- arch_send_wakeup_ipi_mask(cpumask_of(cpu));
+
+ /*
+ * The integrated Cortex-A7 GIC uses the hardware core ID as its
+ * target bit. Linux has yet to discover the secondary's GIC target.
+ * Use SGI 0, the same interrupt as the ARM GICv2 wakeup IPI.
+ */
+ writel_relaxed(BIT(BCMBCA_SGIR_TARGET_SHIFT + gic_cpu) | BCMBCA_WAKEUP_SGI,
+ gic_dist + GIC_DIST_SOFTINT);
iounmap(mailbox);
+ iounmap(gic_dist);
return 0;
}
---
base-commit: 21f8531821461fa0c05e4605c01d8d56d28b514e
change-id: 20261202-bcmbca-smp-gicv2-535b6d4c72cf
Best regards,
--
Linus Walleij <linusw@kernel.org>
next reply other threads:[~2026-12-02 21:23 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-02 21:23 Linus Walleij [this message]
2026-12-03 4:12 ` [PATCH v2] ARM: bcm: Send the BCMBCA CFE wakeup SGI directly Jie Feng
2026-12-05 3:53 ` Florian Fainelli
2026-12-05 9:35 ` Marc Zyngier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261202-bcmbca-smp-gicv2-v2-1-da89fbb5dbb8@kernel.org \
--to=linusw@kernel.org \
--cc=anand.gore@broadcom.com \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=florian.fainelli@broadcom.com \
--cc=hjf3108@gmail.com \
--cc=kursad.oney@broadcom.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=maz@kernel.org \
--cc=rafal@milecki.pl \
--cc=william.zhang@broadcom.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox