[PATCH v1 13/18] arm64/kexec: Mask NMIs before starting new kernel

Mark Brown broonie at kernel.org
Fri Nov 4 16:54:48 PDT 2022


Before we jump into the new kernel we mask interrupts with DAIF so we don't
attempt to handle anything very early in init, if NMIs are enabled then do
the same for NMIs. The new kernel is responsible for initialising SCTLR to
a value it supports, this will include disabling NMIs if they are not in
use.

Signed-off-by: Mark Brown <broonie at kernel.org>
---
 arch/arm64/kernel/machine_kexec.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm64/kernel/machine_kexec.c b/arch/arm64/kernel/machine_kexec.c
index ce3d40120f72..6ae2a0b3c1df 100644
--- a/arch/arm64/kernel/machine_kexec.c
+++ b/arch/arm64/kernel/machine_kexec.c
@@ -20,6 +20,7 @@
 #include <asm/memory.h>
 #include <asm/mmu.h>
 #include <asm/mmu_context.h>
+#include <asm/nmi.h>
 #include <asm/page.h>
 #include <asm/sections.h>
 #include <asm/trans_pgd.h>
@@ -190,6 +191,7 @@ void machine_kexec(struct kimage *kimage)
 	pr_info("Bye!\n");
 
 	local_daif_mask();
+	nmi_mask();
 
 	/*
 	 * Both restart and kernel_reloc will shutdown the MMU, disable data
-- 
2.30.2




More information about the linux-arm-kernel mailing list