diff options
| -rw-r--r-- | arch/x86/include/asm/nmi.h | 14 | ||||
| -rw-r--r-- | arch/x86/kernel/nmi_selftest.c | 4 |
2 files changed, 16 insertions, 2 deletions
diff --git a/arch/x86/include/asm/nmi.h b/arch/x86/include/asm/nmi.h index 0e3793b821ef..dc580c42851c 100644 --- a/arch/x86/include/asm/nmi.h +++ b/arch/x86/include/asm/nmi.h | |||
| @@ -54,6 +54,20 @@ struct nmiaction { | |||
| 54 | __register_nmi_handler((t), &fn##_na); \ | 54 | __register_nmi_handler((t), &fn##_na); \ |
| 55 | }) | 55 | }) |
| 56 | 56 | ||
| 57 | /* | ||
| 58 | * For special handlers that register/unregister in the | ||
| 59 | * init section only. This should be considered rare. | ||
| 60 | */ | ||
| 61 | #define register_nmi_handler_initonly(t, fn, fg, n) \ | ||
| 62 | ({ \ | ||
| 63 | static struct nmiaction fn##_na __initdata = { \ | ||
| 64 | .handler = (fn), \ | ||
| 65 | .name = (n), \ | ||
| 66 | .flags = (fg), \ | ||
| 67 | }; \ | ||
| 68 | __register_nmi_handler((t), &fn##_na); \ | ||
| 69 | }) | ||
| 70 | |||
| 57 | int __register_nmi_handler(unsigned int, struct nmiaction *); | 71 | int __register_nmi_handler(unsigned int, struct nmiaction *); |
| 58 | 72 | ||
| 59 | void unregister_nmi_handler(unsigned int, const char *); | 73 | void unregister_nmi_handler(unsigned int, const char *); |
diff --git a/arch/x86/kernel/nmi_selftest.c b/arch/x86/kernel/nmi_selftest.c index e31bf8d5c4d2..149b8d9c6ad4 100644 --- a/arch/x86/kernel/nmi_selftest.c +++ b/arch/x86/kernel/nmi_selftest.c | |||
| @@ -42,7 +42,7 @@ static int __init nmi_unk_cb(unsigned int val, struct pt_regs *regs) | |||
| 42 | static void __init init_nmi_testsuite(void) | 42 | static void __init init_nmi_testsuite(void) |
| 43 | { | 43 | { |
| 44 | /* trap all the unknown NMIs we may generate */ | 44 | /* trap all the unknown NMIs we may generate */ |
| 45 | register_nmi_handler(NMI_UNKNOWN, nmi_unk_cb, 0, "nmi_selftest_unk"); | 45 | register_nmi_handler_initonly(NMI_UNKNOWN, nmi_unk_cb, 0, "nmi_selftest_unk"); |
| 46 | } | 46 | } |
| 47 | 47 | ||
| 48 | static void __init cleanup_nmi_testsuite(void) | 48 | static void __init cleanup_nmi_testsuite(void) |
| @@ -64,7 +64,7 @@ static void __init test_nmi_ipi(struct cpumask *mask) | |||
| 64 | { | 64 | { |
| 65 | unsigned long timeout; | 65 | unsigned long timeout; |
| 66 | 66 | ||
| 67 | if (register_nmi_handler(NMI_LOCAL, test_nmi_ipi_callback, | 67 | if (register_nmi_handler_initonly(NMI_LOCAL, test_nmi_ipi_callback, |
| 68 | NMI_FLAG_FIRST, "nmi_selftest")) { | 68 | NMI_FLAG_FIRST, "nmi_selftest")) { |
| 69 | nmi_fail = FAILURE; | 69 | nmi_fail = FAILURE; |
| 70 | return; | 70 | return; |
