Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame^] | 1 | From 78e497fb69950665e639cfab8f4fb50cc404a1eb Mon Sep 17 00:00:00 2001 |
| 2 | From: Haiqing Bai <Haiqing.Bai@windriver.com> |
| 3 | Date: Mon, 9 Jan 2017 15:26:29 +0800 |
| 4 | Subject: [PATCH] kexec: ARM: Fix add_buffer_phys_virt() align issue |
| 5 | |
| 6 | When "CONFIG_ARM_LPAE" is enabled,3 level page table |
| 7 | is used by MMU, the "SECTION_SIZE" is defined with |
| 8 | (1 << 21), but 'add_buffer_phys_virt()' hardcode this |
| 9 | to (1 << 20). |
| 10 | |
| 11 | Upstream-Status: Pending |
| 12 | |
| 13 | Suggested-By:fredrik.markstrom@gmail.com |
| 14 | Signed-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 | |
| 19 | diff --git a/kexec/arch/arm/crashdump-arm.c b/kexec/arch/arm/crashdump-arm.c |
| 20 | index 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 | -- |
| 51 | 1.9.1 |
| 52 | |