Blame SOURCES/kexec-tools-2.0.14-arm64-identify-PHYS_OFFSET-correctly.patch

23ef29
From 7a4381e2042e2be308c96bc927145bc39a0594cc Mon Sep 17 00:00:00 2001
23ef29
Message-Id: <7a4381e2042e2be308c96bc927145bc39a0594cc.1489676829.git.panand@redhat.com>
23ef29
In-Reply-To: <f85183096d31d865c97565614535d84943b12908.1489676829.git.panand@redhat.com>
23ef29
References: <f85183096d31d865c97565614535d84943b12908.1489676829.git.panand@redhat.com>
23ef29
From: AKASHI Takahiro <takahiro.akashi@linaro.org>
23ef29
Date: Wed, 15 Mar 2017 18:38:18 +0900
23ef29
Subject: [PATCH 04/10] arm64: identify PHYS_OFFSET correctly
23ef29
23ef29
Due to the kernel patch, commit e7cd190385d1 ("arm64: mark reserved
23ef29
memblock regions explicitly in iomem"), the current code will not be able
23ef29
to identify the correct value of PHYS_OFFSET if some "reserved" memory
23ef29
region, which is likely to be UEFI runtime services code/data, exists at
23ef29
an address below the first "System RAM" regions.
23ef29
23ef29
This patch fixes this issue.
23ef29
23ef29
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
23ef29
---
23ef29
 kexec/arch/arm64/iomem.h       |  7 +++++++
23ef29
 kexec/arch/arm64/kexec-arm64.c | 12 ++++++++++--
23ef29
 2 files changed, 17 insertions(+), 2 deletions(-)
23ef29
 create mode 100644 kexec/arch/arm64/iomem.h
23ef29
23ef29
diff --git a/kexec/arch/arm64/iomem.h b/kexec/arch/arm64/iomem.h
23ef29
new file mode 100644
23ef29
index 000000000000..7fd66eb063e1
23ef29
--- /dev/null
23ef29
+++ b/kexec/arch/arm64/iomem.h
23ef29
@@ -0,0 +1,7 @@
23ef29
+#ifndef IOMEM_H
23ef29
+#define IOMEM_H
23ef29
+
23ef29
+#define SYSTEM_RAM		"System RAM\n"
23ef29
+#define IOMEM_RESERVED		"reserved\n"
23ef29
+
23ef29
+#endif
23ef29
diff --git a/kexec/arch/arm64/kexec-arm64.c b/kexec/arch/arm64/kexec-arm64.c
23ef29
index 04fd3968bb52..d02b9dac3d33 100644
23ef29
--- a/kexec/arch/arm64/kexec-arm64.c
23ef29
+++ b/kexec/arch/arm64/kexec-arm64.c
23ef29
@@ -21,6 +21,7 @@
23ef29
 #include "crashdump-arm64.h"
23ef29
 #include "dt-ops.h"
23ef29
 #include "fs2dt.h"
23ef29
+#include "iomem.h"
23ef29
 #include "kexec-syscall.h"
23ef29
 #include "arch/options.h"
23ef29
 
23ef29
@@ -476,7 +477,14 @@ static int get_memory_ranges_iomem_cb(void *data, int nr, char *str,
23ef29
 		return -1;
23ef29
 
23ef29
 	r = (struct memory_range *)data + nr;
23ef29
-	r->type = RANGE_RAM;
23ef29
+
23ef29
+	if (!strncmp(str, SYSTEM_RAM, strlen(SYSTEM_RAM)))
23ef29
+		r->type = RANGE_RAM;
23ef29
+	else if (!strncmp(str, IOMEM_RESERVED, strlen(IOMEM_RESERVED)))
23ef29
+		r->type = RANGE_RESERVED;
23ef29
+	else
23ef29
+		return 1;
23ef29
+
23ef29
 	r->start = base;
23ef29
 	r->end = base + length - 1;
23ef29
 
23ef29
@@ -495,7 +503,7 @@ static int get_memory_ranges_iomem_cb(void *data, int nr, char *str,
23ef29
 static int get_memory_ranges_iomem(struct memory_range *array,
23ef29
 	unsigned int *count)
23ef29
 {
23ef29
-	*count = kexec_iomem_for_each_line("System RAM\n",
23ef29
+	*count = kexec_iomem_for_each_line(NULL,
23ef29
 		get_memory_ranges_iomem_cb, array);
23ef29
 
23ef29
 	if (!*count) {
23ef29
-- 
23ef29
2.9.3
23ef29