Blob Blame History Raw
From edc4648e608533e05f323b5682ab98ebd37eacca Mon Sep 17 00:00:00 2001
Message-Id: <edc4648e608533e05f323b5682ab98ebd37eacca.1469447235.git.panand@redhat.com>
From: Pratyush Anand <panand@redhat.com>
Date: Thu, 30 Jun 2016 23:16:18 +0530
Subject: [PATCH] arm64: prefer reading memory ranges from iomem over fdt

Some of the fdt might not have correct memory ranges defined in "memory"
nodes. For example: apm-mustang.dts expects boot loader to update "memory"
node with appropriate value.

Now, what if boot loader /firmware does not update it. Offcourse, its an
issue in firmware. But, since we will always have more updated memory
ranges in /proc/iomem, so prefer to read it from there.

Specifically, after kernel commit 500899c2cc3e3f06140373b587a69d30650f2d9d,
it becomes important to work kexec with such buggy firmware.

Signed-off-by: Pratyush Anand <panand@redhat.com>
---
 kexec/arch/arm64/kexec-arm64.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kexec/arch/arm64/kexec-arm64.c b/kexec/arch/arm64/kexec-arm64.c
index f936dd2de458..d1fdd64a60c2 100644
--- a/kexec/arch/arm64/kexec-arm64.c
+++ b/kexec/arch/arm64/kexec-arm64.c
@@ -1016,10 +1016,10 @@ int get_memory_ranges(struct memory_range **range, int *ranges,
 	unsigned int count;
 	int result;
 
-	result = get_memory_ranges_dt(array, &count);
+	result = get_memory_ranges_iomem(array, &count);
 
 	if (result)
-		result = get_memory_ranges_iomem(array, &count);
+		result = get_memory_ranges_dt(array, &count);
 
 	*range = result ? NULL : array;
 	*ranges = result ? 0 : count;
-- 
2.5.5