blob: 6c6c66d88516fdfae87a996f9a813e00e8caea25 [file] [log] [blame]
Brad Bishop6e60e8b2018-02-01 10:27:11 -05001From 78e497fb69950665e639cfab8f4fb50cc404a1eb Mon Sep 17 00:00:00 2001
2From: Haiqing Bai <Haiqing.Bai@windriver.com>
3Date: Mon, 9 Jan 2017 15:26:29 +0800
4Subject: [PATCH] kexec: ARM: Fix add_buffer_phys_virt() align issue
5
6When "CONFIG_ARM_LPAE" is enabled,3 level page table
7is used by MMU, the "SECTION_SIZE" is defined with
8(1 << 21), but 'add_buffer_phys_virt()' hardcode this
9to (1 << 20).
10
11Upstream-Status: Pending
12
13Suggested-By:fredrik.markstrom@gmail.com
14Signed-off-by: Haiqing Bai <Haiqing.Bai@windriver.com>
15---
16 kexec/arch/arm/crashdump-arm.c | 5 ++++-
17 1 file changed, 4 insertions(+), 1 deletion(-)
18
19diff --git a/kexec/arch/arm/crashdump-arm.c b/kexec/arch/arm/crashdump-arm.c
20index 245c21a..12139c3 100644
21--- a/kexec/arch/arm/crashdump-arm.c
22+++ b/kexec/arch/arm/crashdump-arm.c
23@@ -240,6 +240,7 @@ int load_crashdump_segments(struct kexec_info *info, char *mod_cmdline)
24 void *buf;
25 int err;
26 int last_ranges;
27+ unsigned short align_bit_shift = 20;
28
29 /*
30 * First fetch all the memory (RAM) ranges that we are going to pass to
31@@ -281,6 +282,7 @@ int load_crashdump_segments(struct kexec_info *info, char *mod_cmdline)
32
33 /* for support LPAE enabled kernel*/
34 elf_info.class = ELFCLASS64;
35+ align_bit_shift = 21;
36
37 err = crash_create_elf64_headers(info, &elf_info,
38 usablemem_rgns.ranges,
39@@ -302,8 +304,9 @@ int load_crashdump_segments(struct kexec_info *info, char *mod_cmdline)
40 * 1MB) so that available memory passed in kernel command line will be
41 * aligned to 1MB. This is because kernel create_mapping() wants memory
42 * regions to be aligned to SECTION_SIZE.
43+ * The SECTION_SIZE of LPAE kernel is '1UL << 21' defined in pgtable-3level.h
44 */
45- elfcorehdr = add_buffer_phys_virt(info, buf, bufsz, bufsz, 1 << 20,
46+ elfcorehdr = add_buffer_phys_virt(info, buf, bufsz, bufsz, 1 << align_bit_shift,
47 crash_kernel_mem.start,
48 crash_kernel_mem.end, -1, 0);
49
50--
511.9.1
52