Patrick Williams | 56b44a9 | 2024-01-19 08:49:29 -0600 | [diff] [blame] | 1 | From b62c1da8f8e641397add10367ee9c4cfdedb1cc0 Mon Sep 17 00:00:00 2001 |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 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> |
Patrick Williams | 56b44a9 | 2024-01-19 08:49:29 -0600 | [diff] [blame] | 15 | |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 16 | --- |
| 17 | kexec/arch/arm/crashdump-arm.c | 5 ++++- |
| 18 | 1 file changed, 4 insertions(+), 1 deletion(-) |
| 19 | |
| 20 | diff --git a/kexec/arch/arm/crashdump-arm.c b/kexec/arch/arm/crashdump-arm.c |
Patrick Williams | 56b44a9 | 2024-01-19 08:49:29 -0600 | [diff] [blame] | 21 | index 1ec1826..cc20f63 100644 |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 22 | --- a/kexec/arch/arm/crashdump-arm.c |
| 23 | +++ b/kexec/arch/arm/crashdump-arm.c |
Patrick Williams | 56b44a9 | 2024-01-19 08:49:29 -0600 | [diff] [blame] | 24 | @@ -242,6 +242,7 @@ int load_crashdump_segments(struct kexec_info *info, char *mod_cmdline) |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 25 | void *buf; |
| 26 | int err; |
| 27 | int last_ranges; |
| 28 | + unsigned short align_bit_shift = 20; |
| 29 | |
| 30 | /* |
| 31 | * First fetch all the memory (RAM) ranges that we are going to pass to |
Patrick Williams | 56b44a9 | 2024-01-19 08:49:29 -0600 | [diff] [blame] | 32 | @@ -283,6 +284,7 @@ int load_crashdump_segments(struct kexec_info *info, char *mod_cmdline) |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 33 | |
| 34 | /* for support LPAE enabled kernel*/ |
| 35 | elf_info.class = ELFCLASS64; |
| 36 | + align_bit_shift = 21; |
| 37 | |
| 38 | err = crash_create_elf64_headers(info, &elf_info, |
| 39 | usablemem_rgns.ranges, |
Patrick Williams | 56b44a9 | 2024-01-19 08:49:29 -0600 | [diff] [blame] | 40 | @@ -304,8 +306,9 @@ int load_crashdump_segments(struct kexec_info *info, char *mod_cmdline) |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 41 | * 1MB) so that available memory passed in kernel command line will be |
| 42 | * aligned to 1MB. This is because kernel create_mapping() wants memory |
| 43 | * regions to be aligned to SECTION_SIZE. |
| 44 | + * The SECTION_SIZE of LPAE kernel is '1UL << 21' defined in pgtable-3level.h |
| 45 | */ |
| 46 | - elfcorehdr = add_buffer_phys_virt(info, buf, bufsz, bufsz, 1 << 20, |
| 47 | + elfcorehdr = add_buffer_phys_virt(info, buf, bufsz, bufsz, 1 << align_bit_shift, |
| 48 | crash_kernel_mem.start, |
| 49 | crash_kernel_mem.end, -1, 0); |
| 50 | |