diff mbox series

[RFC,08/12] riscv: Enable NMIs during irqs disabled context

Message ID 20231023082911.23242-9-luxu.kernel@bytedance.com (mailing list archive)
State RFC
Headers show
Series riscv: Introduce Pseudo NMI | expand

Checks

Context Check Description
conchuod/vmtest-for-next-PR fail PR summary
conchuod/patch-8-test-1 success .github/scripts/patches/build_rv32_defconfig.sh
conchuod/patch-8-test-2 success .github/scripts/patches/build_rv64_clang_allmodconfig.sh
conchuod/patch-8-test-3 success .github/scripts/patches/build_rv64_gcc_allmodconfig.sh
conchuod/patch-8-test-4 success .github/scripts/patches/build_rv64_nommu_k210_defconfig.sh
conchuod/patch-8-test-5 success .github/scripts/patches/build_rv64_nommu_virt_defconfig.sh
conchuod/patch-8-test-6 success .github/scripts/patches/checkpatch.sh
conchuod/patch-8-test-7 success .github/scripts/patches/dtb_warn_rv64.sh
conchuod/patch-8-test-8 success .github/scripts/patches/header_inline.sh
conchuod/patch-8-test-9 success .github/scripts/patches/kdoc.sh
conchuod/patch-8-test-10 success .github/scripts/patches/module_param.sh
conchuod/patch-8-test-11 success .github/scripts/patches/verify_fixes.sh
conchuod/patch-8-test-12 success .github/scripts/patches/verify_signedoff.sh

Commit Message

Xu Lu Oct. 23, 2023, 8:29 a.m. UTC
This commit allows NMIs to happen even when irqs are disabled. When
disabling irqs, we mask all normal irqs via clearing corresponding bits
in CSR_IE while leaving NMI bits alone.

Signed-off-by: Xu Lu <luxu.kernel@bytedance.com>
---
 arch/riscv/include/asm/irqflags.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/arch/riscv/include/asm/irqflags.h b/arch/riscv/include/asm/irqflags.h
index 9700a17a003a..42f7803582df 100644
--- a/arch/riscv/include/asm/irqflags.h
+++ b/arch/riscv/include/asm/irqflags.h
@@ -54,13 +54,13 @@  static inline void arch_local_irq_enable(void)
 /* unconditionally disable interrupts */
 static inline void arch_local_irq_disable(void)
 {
-	csr_clear(CSR_IE, irqs_enabled_ie);
+	csr_clear(CSR_IE, ~ALLOWED_NMI_MASK);
 }
 
 /* get status and disable interrupts */
 static inline unsigned long arch_local_irq_save(void)
 {
-	return csr_read_clear(CSR_IE, irqs_enabled_ie);
+	return csr_read_clear(CSR_IE, ~ALLOWED_NMI_MASK);
 }
 
 /* test flags */