Blame SOURCES/kexec-tools-2.0.8-arm64-kdump-copy-dtb-file-into-crash-kernel-memory.patch

a6d77e
From 55cd3491542a0d696451611a4cae38db78f964dd Mon Sep 17 00:00:00 2001
a6d77e
Message-Id: <55cd3491542a0d696451611a4cae38db78f964dd.1431592766.git.panand@redhat.com>
a6d77e
In-Reply-To: <1fb6841aa15407dbf371589d7abca7bc2d35815c.1431592766.git.panand@redhat.com>
a6d77e
References: <1fb6841aa15407dbf371589d7abca7bc2d35815c.1431592766.git.panand@redhat.com>
a6d77e
From: AKASHI Takahiro <takahiro.akashi@linaro.org>
a6d77e
Date: Tue, 24 Feb 2015 15:48:29 +0900
a6d77e
Subject: [PATCH 10/17] arm64: kdump: copy dtb file into crash kernel memory
a6d77e
a6d77e
---
a6d77e
 kexec/arch/arm64/crashdump-arm64.c |  6 ++++++
a6d77e
 kexec/arch/arm64/crashdump-arm64.h |  1 +
a6d77e
 kexec/arch/arm64/kexec-arm64.c     | 15 +++++++++------
a6d77e
 3 files changed, 16 insertions(+), 6 deletions(-)
a6d77e
a6d77e
diff --git a/kexec/arch/arm64/crashdump-arm64.c b/kexec/arch/arm64/crashdump-arm64.c
a6d77e
index ec83cf0c0f38..80f5985c5d85 100644
a6d77e
--- a/kexec/arch/arm64/crashdump-arm64.c
a6d77e
+++ b/kexec/arch/arm64/crashdump-arm64.c
a6d77e
@@ -306,3 +306,9 @@ void set_crash_entry(struct mem_ehdr *ehdr, struct kexec_info *info)
a6d77e
 {
a6d77e
 	info->entry = (void *)crash_reserved_mem.start + arm64_mem.text_offset;
a6d77e
 }
a6d77e
+
a6d77e
+off_t locate_dtb_in_crashmem(struct kexec_info *info, off_t dtb_size)
a6d77e
+{
a6d77e
+	return locate_hole(info, dtb_size, 128UL * 1024,
a6d77e
+		crash_reserved_mem.start, crash_reserved_mem.end, -1);
a6d77e
+}
a6d77e
diff --git a/kexec/arch/arm64/crashdump-arm64.h b/kexec/arch/arm64/crashdump-arm64.h
a6d77e
index 3f8b38350841..d4fd3f2288c9 100644
a6d77e
--- a/kexec/arch/arm64/crashdump-arm64.h
a6d77e
+++ b/kexec/arch/arm64/crashdump-arm64.h
a6d77e
@@ -21,5 +21,6 @@ extern struct memory_ranges usablemem_rgns;
a6d77e
 int load_crashdump_segments(struct kexec_info *info, char **option);
a6d77e
 void modify_ehdr_for_crashmem(struct mem_ehdr *ehdr);
a6d77e
 void set_crash_entry(struct mem_ehdr *ehdr, struct kexec_info *info);
a6d77e
+off_t locate_dtb_in_crashmem(struct kexec_info *info, off_t dtb_size);
a6d77e
 
a6d77e
 #endif
a6d77e
diff --git a/kexec/arch/arm64/kexec-arm64.c b/kexec/arch/arm64/kexec-arm64.c
a6d77e
index 173631c66951..190037c75186 100644
a6d77e
--- a/kexec/arch/arm64/kexec-arm64.c
a6d77e
+++ b/kexec/arch/arm64/kexec-arm64.c
a6d77e
@@ -650,12 +650,15 @@ int arm64_load_other_segments(struct kexec_info *info,
a6d77e
 
a6d77e
 	dtb_max = dtb_2.size + 2 * 1024;
a6d77e
 
a6d77e
-	dtb_base = locate_hole(info, dtb_max, 128UL * 1024,
a6d77e
-		arm64_mem.memstart + arm64_mem.text_offset
a6d77e
-			+ arm64_mem.image_size,
a6d77e
-		_ALIGN_UP(arm64_mem.memstart + arm64_mem.text_offset,
a6d77e
-			512UL * 1024 * 1024),
a6d77e
-		1);
a6d77e
+	if (info->kexec_flags & KEXEC_ON_CRASH)
a6d77e
+		dtb_base = locate_dtb_in_crashmem(info, dtb_max);
a6d77e
+	else
a6d77e
+		dtb_base = locate_hole(info, dtb_max, 128UL * 1024,
a6d77e
+			arm64_mem.memstart + arm64_mem.text_offset
a6d77e
+				+ arm64_mem.image_size,
a6d77e
+			_ALIGN_UP(arm64_mem.memstart + arm64_mem.text_offset,
a6d77e
+				512UL * 1024 * 1024),
a6d77e
+			1);
a6d77e
 
a6d77e
 	dbgprintf("dtb:    base %lx, size %lxh (%ld)\n", dtb_base, dtb_2.size,
a6d77e
 		dtb_2.size);
a6d77e
-- 
a6d77e
2.1.0
a6d77e