[PATCH v6 1/7] x86/kexec: Add CONFIG_KEXEC_DEBUG option

David Woodhouse posted 7 patches 2 weeks, 6 days ago
[PATCH v6 1/7] x86/kexec: Add CONFIG_KEXEC_DEBUG option
Posted by David Woodhouse 2 weeks, 6 days ago
From: David Woodhouse <dwmw@amazon.co.uk>

This does nothing yet. Support for x86_64 will follow in subsequent
commits, and an Arm64 version is also being worked on.

Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
---
 arch/x86/Kconfig.debug |  1 +
 kernel/Kconfig.kexec   | 11 +++++++++++
 2 files changed, 12 insertions(+)

diff --git a/arch/x86/Kconfig.debug b/arch/x86/Kconfig.debug
index 74777a97e394..c54cbd36c710 100644
--- a/arch/x86/Kconfig.debug
+++ b/arch/x86/Kconfig.debug
@@ -13,6 +13,7 @@ config X86_VERBOSE_BOOTUP
 
 config EARLY_PRINTK
 	bool "Early printk" if EXPERT
+	select HAVE_KEXEC_DEBUG if X86_64
 	default y
 	help
 	  Write kernel log output directly into the VGA buffer or to a serial
diff --git a/kernel/Kconfig.kexec b/kernel/Kconfig.kexec
index 4d111f871951..a65b49c083c9 100644
--- a/kernel/Kconfig.kexec
+++ b/kernel/Kconfig.kexec
@@ -17,6 +17,9 @@ config KEXEC_ELF
 config HAVE_IMA_KEXEC
 	bool
 
+config HAVE_KEXEC_DEBUG
+	bool
+
 config KEXEC
 	bool "Enable kexec system call"
 	depends on ARCH_SUPPORTS_KEXEC
@@ -95,6 +98,14 @@ config KEXEC_JUMP
 	  Jump between original kernel and kexeced kernel and invoke
 	  code in physical address mode via KEXEC
 
+config KEXEC_DEBUG
+	bool "Debug kexec transition"
+	depends on HAVE_KEXEC_DEBUG
+	help
+	  Faults during kexec can be difficult to debug. This installs exception
+	  handlers and attempts to report faults. On x86_64 this would use the
+	  serial port configured for earlyprintk.
+
 config CRASH_DUMP
 	bool "kernel crash dumps"
 	default ARCH_DEFAULT_CRASH_DUMP
-- 
2.47.0