[PATCH 2/3] x86: Introduce Linux kernel specific E820_RESERVED_KDUMP e820 memory range type

Thomas Renninger
2013-01-30T16:08:26Z

This functionality will be picked up by later memmap= boot
parameter options. Originally E820_USABLE declared memory (used by the
productive, but crashed kernel) will get converted to the new
E820_RESERVED_KDUMP type.
The memory area where the kdump kernel resides (passed via memmap=X@Y
by kexec-tools) will be set usable again.

Also include a tiny whitespace to tab cleanup.

Signed-off-by: Thomas Renninger <trenn@suse.de>
---
arch/x86/include/uapi/asm/e820.h | 9 ++++++++-
arch/x86/kernel/e820.c | 14 +++++++++-----
2 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/arch/x86/include/uapi/asm/e820.h b/arch/x86/include/uapi/asm/e820.h
index bbae024..2171ca5 100644
--- a/arch/x86/include/uapi/asm/e820.h
+++ b/arch/x86/include/uapi/asm/e820.h
@@ -45,7 +45,14 @@
* included in the S3 integrity calculation and so should not include
* any memory that BIOS might alter over the S3 transition
*/
-#define E820_RESERVED_KERN 128
+#define E820_RESERVED_KERN 128
+
+/*
+ * Kdump kernel will use this type for formerly usable memory
+ * the crashed kernel used (and as defined by the original e820 map).
+ * It will then only set the memory area it resides in to usable memory
+ */
+#define E820_RESERVED_KDUMP 129

#ifndef __ASSEMBLY__
#include <linux/types.h>
diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c
index d32abea..e3c5b7f 100644
--- a/arch/x86/kernel/e820.c
+++ b/arch/x86/kernel/e820.c
@@ -149,6 +149,9 @@ static void __init e820_print_type(u32 type)
case E820_UNUSABLE:
printk(KERN_CONT "unusable");
break;
+ case E820_RESERVED_KDUMP:
+ printk(KERN_CONT "kdump reserved");
+ break;
default:
printk(KERN_CONT "type %u", type);
break;
@@ -911,11 +914,12 @@ static inline const char *e820_type_to_string(int e820_type)
{
switch (e820_type) {
case E820_RESERVED_KERN:
- case E820_RAM: return "System RAM";
- case E820_ACPI: return "ACPI Tables";
- case E820_NVS: return "ACPI Non-volatile Storage";
- case E820_UNUSABLE: return "Unusable memory";
- default: return "reserved";
+ case E820_RAM: return "System RAM";
+ case E820_ACPI: return "ACPI Tables";
+ case E820_NVS: return "ACPI Non-volatile Storage";
+ case E820_UNUSABLE: return "Unusable memory";
+ case E820_RESERVED_KDUMP: return "Kdump reserved";
+ default: return "reserved";
}
}