Skip to content

Commit a07a594

Browse files
mrutland-armctmarinas
authored andcommitted
arm64: smp: avoid NMI IPIs with broken MediaTek FW
Some MediaTek devices have broken firmware which corrupts some GICR registers behind the back of the OS, and pseudo-NMIs cannot be used on these devices. For more details see commit: 44bd78d ("irqchip/gic-v3: Disable pseudo NMIs on Mediatek devices w/ firmware issues") We did not take this problem into account in commit: 331a1b3 ("arm64: smp: Add arch support for backtrace using pseudo-NMI") Since that commit arm64's SMP code will try to setup some IPIs as pseudo-NMIs, even on systems with broken FW. The GICv3 code will (rightly) reject attempts to request interrupts as pseudo-NMIs, resulting in boot-time failures. Avoid the problem by taking the broken FW into account when deciding to request IPIs as pseudo-NMIs. The GICv3 driver maintains a static_key named "supports_pseudo_nmis" which is false on systems with broken FW, and we can consult this within ipi_should_be_nmi(). Fixes: 331a1b3 ("arm64: smp: Add arch support for backtrace using pseudo-NMI") Reported-by: Chen-Yu Tsai <wenst@chromium.org> Closes: https://issuetracker.google.com/issues/197061987#comment68 Signed-off-by: Mark Rutland <mark.rutland@arm.com> Reviewed-by: Douglas Anderson <dianders@chromium.org> Tested-by: Douglas Anderson <dianders@chromium.org> Reviewed-by: Marc Zyngier <maz@kernel.org> Tested-by: Chen-Yu Tsai <wenst@chromium.org> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
1 parent 62817d5 commit a07a594

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

arch/arm64/kernel/smp.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -964,7 +964,10 @@ static void smp_cross_call(const struct cpumask *target, unsigned int ipinr)
964964

965965
static bool ipi_should_be_nmi(enum ipi_msg_type ipi)
966966
{
967-
if (!system_uses_irq_prio_masking())
967+
DECLARE_STATIC_KEY_FALSE(supports_pseudo_nmis);
968+
969+
if (!system_uses_irq_prio_masking() ||
970+
!static_branch_likely(&supports_pseudo_nmis))
968971
return false;
969972

970973
switch (ipi) {

drivers/irqchip/irq-gic-v3.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ static DEFINE_STATIC_KEY_TRUE(supports_deactivate_key);
106106
* - Figure 4-7 Secure read of the priority field for a Non-secure Group 1
107107
* interrupt.
108108
*/
109-
static DEFINE_STATIC_KEY_FALSE(supports_pseudo_nmis);
109+
DEFINE_STATIC_KEY_FALSE(supports_pseudo_nmis);
110110

111111
DEFINE_STATIC_KEY_FALSE(gic_nonsecure_priorities);
112112
EXPORT_SYMBOL(gic_nonsecure_priorities);

0 commit comments

Comments
 (0)