Merge tag 'fbdev-for-6.4-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/deller...
[linux-block.git] / include / linux / panic.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _LINUX_PANIC_H
3 #define _LINUX_PANIC_H
4
5 #include <linux/compiler_attributes.h>
6 #include <linux/types.h>
7
8 struct pt_regs;
9
10 extern long (*panic_blink)(int state);
11 __printf(1, 2)
12 void panic(const char *fmt, ...) __noreturn __cold;
13 void nmi_panic(struct pt_regs *regs, const char *msg);
14 void check_panic_on_warn(const char *origin);
15 extern void oops_enter(void);
16 extern void oops_exit(void);
17 extern bool oops_may_print(void);
18
19 extern int panic_timeout;
20 extern unsigned long panic_print;
21 extern int panic_on_oops;
22 extern int panic_on_unrecovered_nmi;
23 extern int panic_on_io_nmi;
24 extern int panic_on_warn;
25
26 extern unsigned long panic_on_taint;
27 extern bool panic_on_taint_nousertaint;
28
29 extern int sysctl_panic_on_rcu_stall;
30 extern int sysctl_max_rcu_stall_to_panic;
31 extern int sysctl_panic_on_stackoverflow;
32
33 extern bool crash_kexec_post_notifiers;
34
35 /*
36  * panic_cpu is used for synchronizing panic() and crash_kexec() execution. It
37  * holds a CPU number which is executing panic() currently. A value of
38  * PANIC_CPU_INVALID means no CPU has entered panic() or crash_kexec().
39  */
40 extern atomic_t panic_cpu;
41 #define PANIC_CPU_INVALID       -1
42
43 /*
44  * Only to be used by arch init code. If the user over-wrote the default
45  * CONFIG_PANIC_TIMEOUT, honor it.
46  */
47 static inline void set_arch_panic_timeout(int timeout, int arch_default_timeout)
48 {
49         if (panic_timeout == arch_default_timeout)
50                 panic_timeout = timeout;
51 }
52
53 /* This cannot be an enum because some may be used in assembly source. */
54 #define TAINT_PROPRIETARY_MODULE        0
55 #define TAINT_FORCED_MODULE             1
56 #define TAINT_CPU_OUT_OF_SPEC           2
57 #define TAINT_FORCED_RMMOD              3
58 #define TAINT_MACHINE_CHECK             4
59 #define TAINT_BAD_PAGE                  5
60 #define TAINT_USER                      6
61 #define TAINT_DIE                       7
62 #define TAINT_OVERRIDDEN_ACPI_TABLE     8
63 #define TAINT_WARN                      9
64 #define TAINT_CRAP                      10
65 #define TAINT_FIRMWARE_WORKAROUND       11
66 #define TAINT_OOT_MODULE                12
67 #define TAINT_UNSIGNED_MODULE           13
68 #define TAINT_SOFTLOCKUP                14
69 #define TAINT_LIVEPATCH                 15
70 #define TAINT_AUX                       16
71 #define TAINT_RANDSTRUCT                17
72 #define TAINT_TEST                      18
73 #define TAINT_FLAGS_COUNT               19
74 #define TAINT_FLAGS_MAX                 ((1UL << TAINT_FLAGS_COUNT) - 1)
75
76 struct taint_flag {
77         char c_true;    /* character printed when tainted */
78         char c_false;   /* character printed when not tainted */
79         bool module;    /* also show as a per-module taint flag */
80 };
81
82 extern const struct taint_flag taint_flags[TAINT_FLAGS_COUNT];
83
84 enum lockdep_ok {
85         LOCKDEP_STILL_OK,
86         LOCKDEP_NOW_UNRELIABLE,
87 };
88
89 extern const char *print_tainted(void);
90 extern void add_taint(unsigned flag, enum lockdep_ok);
91 extern int test_taint(unsigned flag);
92 extern unsigned long get_taint(void);
93
94 #endif  /* _LINUX_PANIC_H */