Skip to content

Commit f736d65

Browse files
author
Marc Zyngier
committed
irqchip/gic-v3: Allow LPIs to be disabled from the command line
For most GICv3 implementations, enabling LPIs is a one way switch. Once they're on, there is no turning back, which completely kills kexec (pending tables will always be live, and we can't tell the secondary kernel where they are). This is really annoying if you plan to use Linux as a bootloader, as it pretty much guarantees that the secondary kernel won't be able to use MSIs, and may even see some memory corruption. Bad. A workaround for this unfortunate situation is to allow the kernel not to enable LPIs, even if the feature is present in the HW. This would allow Linux-as-a-bootloader to leave LPIs alone, and let the secondary kernel to do whatever it wants with them. Let's introduce a boolean "irqchip.gicv3_nolpi" command line option that serves that purpose. Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
1 parent d6062a6 commit f736d65

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

Documentation/admin-guide/kernel-parameters.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1743,6 +1743,14 @@
17431743
of a GICv2 controller even if the memory range
17441744
exposed by the device tree is too small.
17451745

1746+
irqchip.gicv3_nolpi=
1747+
[ARM, ARM64]
1748+
Force the kernel to ignore the availability of
1749+
LPIs (and by consequence ITSs). Intended for system
1750+
that use the kernel as a bootloader, and thus want
1751+
to let secondary kernels in charge of setting up
1752+
LPIs.
1753+
17461754
irqfixup [HW]
17471755
When an interrupt is not handled search all handlers
17481756
for it. Intended to get systems with badly broken

drivers/irqchip/irq-gic-v3.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -613,9 +613,17 @@ static void gic_cpu_sys_reg_init(void)
613613
pr_crit_once("RSS is required but GICD doesn't support it\n");
614614
}
615615

616+
static bool gicv3_nolpi;
617+
618+
static int __init gicv3_nolpi_cfg(char *buf)
619+
{
620+
return strtobool(buf, &gicv3_nolpi);
621+
}
622+
early_param("irqchip.gicv3_nolpi", gicv3_nolpi_cfg);
623+
616624
static int gic_dist_supports_lpis(void)
617625
{
618-
return !!(readl_relaxed(gic_data.dist_base + GICD_TYPER) & GICD_TYPER_LPIS);
626+
return !!(readl_relaxed(gic_data.dist_base + GICD_TYPER) & GICD_TYPER_LPIS) && !gicv3_nolpi;
619627
}
620628

621629
static void gic_cpu_init(void)

0 commit comments

Comments
 (0)