* [PATCH for-4.22] xen/arm: propagate secondary GIC initialization failures
@ 2026-07-10 10:20 Mykola Kvach
2026-07-13 7:43 ` Oleksii Kurochko
0 siblings, 1 reply; 2+ messages in thread
From: Mykola Kvach @ 2026-07-10 10:20 UTC (permalink / raw)
To: xen-devel
Cc: Stefano Stabellini, Julien Grall, Bertrand Marquis, Michal Orzel,
Volodymyr Babchuk
The GICv3 secondary_init() callback can fail while discovering or
waking a Redistributor, enabling LPIs, or setting up an ITS collection.
gic_init_secondary_cpu() currently discards that status. start_secondary()
then marks the CPU online even though its per-CPU GIC interface may be
unusable.
Return the callback status through the common GIC layer. Have
start_secondary() report the failure and stop the affected CPU before it
is added to cpu_online_map.
Fixes: bc183a0235e0 ("xen/arm: Add support for GIC v3")
Signed-off-by: Mykola Kvach <mykola_kvach@epam.com>
---
xen/arch/arm/gic.c | 10 ++++++++--
xen/arch/arm/include/asm/gic.h | 2 +-
xen/arch/arm/smpboot.c | 9 ++++++++-
3 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c
index ee75258fc3..078049e741 100644
--- a/xen/arch/arm/gic.c
+++ b/xen/arch/arm/gic.c
@@ -282,11 +282,17 @@ void smp_send_state_dump(unsigned int cpu)
}
/* Set up the per-CPU parts of the GIC for a secondary CPU */
-void gic_init_secondary_cpu(void)
+int gic_init_secondary_cpu(void)
{
- gic_hw_ops->secondary_init();
+ int rc = gic_hw_ops->secondary_init();
+
+ if ( rc )
+ return rc;
+
/* Clear LR mask for secondary cpus */
clear_cpu_lr_mask();
+
+ return 0;
}
/* Shut down the per-CPU GIC interface */
diff --git a/xen/arch/arm/include/asm/gic.h b/xen/arch/arm/include/asm/gic.h
index ff22dea40d..ee2c26adb4 100644
--- a/xen/arch/arm/include/asm/gic.h
+++ b/xen/arch/arm/include/asm/gic.h
@@ -291,7 +291,7 @@ extern void gic_preinit(void);
/* Bring up the interrupt controller, and report # cpus attached */
extern void gic_init(void);
/* Bring up a secondary CPU's per-CPU GIC interface */
-extern void gic_init_secondary_cpu(void);
+extern int gic_init_secondary_cpu(void);
/* Take down a CPU's per-CPU GIC interface */
extern void gic_disable_cpu(void);
/* setup the gic virtual interface for a guest */
diff --git a/xen/arch/arm/smpboot.c b/xen/arch/arm/smpboot.c
index ba5fd2dd52..5e23b0b6a9 100644
--- a/xen/arch/arm/smpboot.c
+++ b/xen/arch/arm/smpboot.c
@@ -319,6 +319,7 @@ smp_prepare_cpus(void)
void asmlinkage noreturn start_secondary(void)
{
unsigned int cpuid = init_data.cpuid;
+ int rc;
memset(get_cpu_info(), 0, sizeof (struct cpu_info));
@@ -373,7 +374,13 @@ void asmlinkage noreturn start_secondary(void)
*/
update_system_features(¤t_cpu_data);
- gic_init_secondary_cpu();
+ rc = gic_init_secondary_cpu();
+ if ( rc )
+ {
+ printk(XENLOG_ERR "CPU%u: Failed to initialize the GIC: %d\n",
+ cpuid, rc);
+ stop_cpu();
+ }
set_current(idle_vcpu[cpuid]);
--
2.43.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH for-4.22] xen/arm: propagate secondary GIC initialization failures
2026-07-10 10:20 [PATCH for-4.22] xen/arm: propagate secondary GIC initialization failures Mykola Kvach
@ 2026-07-13 7:43 ` Oleksii Kurochko
0 siblings, 0 replies; 2+ messages in thread
From: Oleksii Kurochko @ 2026-07-13 7:43 UTC (permalink / raw)
To: Mykola Kvach, xen-devel
Cc: Stefano Stabellini, Julien Grall, Bertrand Marquis, Michal Orzel,
Volodymyr Babchuk
On 7/10/26 12:20 PM, Mykola Kvach wrote:
> The GICv3 secondary_init() callback can fail while discovering or
> waking a Redistributor, enabling LPIs, or setting up an ITS collection.
> gic_init_secondary_cpu() currently discards that status. start_secondary()
> then marks the CPU online even though its per-CPU GIC interface may be
> unusable.
>
> Return the callback status through the common GIC layer. Have
> start_secondary() report the failure and stop the affected CPU before it
> is added to cpu_online_map.
>
> Fixes: bc183a0235e0 ("xen/arm: Add support for GIC v3")
> Signed-off-by: Mykola Kvach <mykola_kvach@epam.com>
> ---
This doesn't look release-critical. IIUC, the issue only occurs if
`gic_hw_ops->secondary_init()` fails, which itself appears to require an
abnormal condition (e.g. invalid DT data or a failure while initializing
the GIC Redistributor/LPI/ITS state). On correctly configured systems,
this path should never be taken. We've also been living with this
behavior for a long time, so unless the maintainers feel strongly that
it should go in now, I think we could postpone this patch until the 4.22
release.
Thanks.
~ Oleksii
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-07-13 7:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-10 10:20 [PATCH for-4.22] xen/arm: propagate secondary GIC initialization failures Mykola Kvach
2026-07-13 7:43 ` Oleksii Kurochko
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.