xref: /linux/arch/arm64/include/asm/nmi.h (revision 85cdaca6970028bf6f544c355c90035586836ddf)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __ASM_NMI_H
3 #define __ASM_NMI_H
4 
5 #include <linux/cpumask.h>
6 
7 struct pt_regs;
8 
9 /*
10  * Cross-CPU NMI provider hooks, consulted by the arm64 arch code before
11  * its regular-IRQ / pseudo-NMI IPI paths. The SDEI provider in
12  * drivers/firmware/arm_sdei_nmi.c implements them when active; a future
13  * FEAT_NMI provider could slot in here too. The stubs let callers stay
14  * unconditional when ARM_SDEI_NMI is off.
15  *
16  * sdei_nmi_active() lets a caller test for the service before committing
17  * to (and waiting on) the SDEI stop rung; sdei_nmi_stop_cpus() then signals
18  * the targets, which ack by going offline.
19  */
20 #ifdef CONFIG_ARM_SDEI_NMI
21 bool sdei_nmi_trigger_cpumask_backtrace(const cpumask_t *mask, int exclude_cpu);
22 bool sdei_nmi_active(void);
23 void sdei_nmi_stop_cpus(const cpumask_t *mask);
24 #else
25 static inline bool sdei_nmi_trigger_cpumask_backtrace(const cpumask_t *mask,
26 						      int exclude_cpu)
27 {
28 	return false;
29 }
30 
31 static inline bool sdei_nmi_active(void)
32 {
33 	return false;
34 }
35 
36 static inline void sdei_nmi_stop_cpus(const cpumask_t *mask) { }
37 #endif
38 
39 /*
40  * The common "stop this CPU" entry every arm64 stop path funnels through:
41  * the regular/pseudo-NMI stop IPI handlers, panic_smp_self_stop(), and the
42  * SDEI cross-CPU NMI handler. @die_on_crash powers the CPU off on the kdump
43  * crash path (IPI handlers) instead of parking it (SDEI / self-stop).
44  * Defined in arch/arm64/kernel/smp.c.
45  */
46 void __noreturn arm64_nmi_cpu_stop(struct pt_regs *regs, bool die_on_crash);
47 
48 #endif /* __ASM_NMI_H */
49