File kexec-tools-proc-iomem-xen.diff of Package kexec-tools

From: Bernhard Walle <bwalle@suse.de>
Subject: [PATCH] Don't use /sys/firmware/memmap with Xen

On Xen (Dom0) kernels, the /sys/firmware/memmap is wrong. Just use the old
/proc/iomem there.


Signed-off-by: Bernhard Walle <bwalle@suse.de>

---
 kexec/arch/i386/kexec-x86-common.c |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

--- a/kexec/arch/i386/kexec-x86-common.c
+++ b/kexec/arch/i386/kexec-x86-common.c
@@ -147,7 +147,13 @@ int get_memory_ranges(struct memory_rang
 {
 	int ret, i;
 
-	if (have_sys_firmware_memmap())
+	/*
+	 * When using Xen, /sys/firmware/memmap (i.e., the E820 map) is
+	 * wrong, it just provides one large memory are and that cannot
+	 * be used for Kdump. Use always the /proc/iomem interface there
+	 * even if we have /sys/firmware/memmap.
+	 */
+	if (!xen_present() && have_sys_firmware_memmap())
 		ret = get_memory_ranges_sysfs(range, ranges);
 	else
 		ret = get_memory_ranges_proc_iomem(range, ranges);