[PATCH v2 05/14] arm64/asm: Introduce assembly macros for managing ALLINT

Mark Brown
2022-11-12T15:17:55Z

In order to allow assembly code to ensure that not even superpriorty
interrupts can preempt it provide macros for enabling and disabling
ALLINT.ALLINT. This is not integrated into the existing DAIF macros
since we do not always wish to manage ALLINT along with DAIF and the
use of DAIF in the naming of the existing macros might lead to surprises
if ALLINT is also managed.

Signed-off-by: Mark Brown <broonie@kernel.org>
---
arch/arm64/include/asm/assembler.h | 16 ++++++++++++++++
1 file changed, 16 insertions(+)

diff --git a/arch/arm64/include/asm/assembler.h b/arch/arm64/include/asm/assembler.h
index e5957a53be39..88d9779a83c0 100644
--- a/arch/arm64/include/asm/assembler.h
+++ b/arch/arm64/include/asm/assembler.h
@@ -34,6 +34,22 @@
wx\n .req w\n
.endr

+ .macro disable_allint
+#ifdef CONFIG_ARM64_NMI
+alternative_if ARM64_HAS_NMI
+ msr_s SYS_ALLINT_SET, xzr
+alternative_else_nop_endif
+#endif
+ .endm
+
+ .macro enable_allint
+#ifdef CONFIG_ARM64_NMI
+alternative_if ARM64_HAS_NMI
+ msr_s SYS_ALLINT_CLR, xzr
+alternative_else_nop_endif
+#endif
+ .endm
+
.macro save_and_disable_daif, flags
mrs \flags, daif
msr daifset, #0xf
--
2.30.2