From c8d16236f41c4236eaf1cf23597ddbd1d084b51d Mon Sep 17 00:00:00 2001 From: liuh Date: Tue, 7 May 2024 16:23:17 +0800 Subject: [PATCH] ARM: Fix add_buffer_phys_virt() align issue --- ...Fix-add_buffer_phys_virt-align-issue.patch | 49 +++++++++++++++++++ kexec-tools.spec | 6 ++- 2 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 ARM-Fix-add_buffer_phys_virt-align-issue.patch diff --git a/ARM-Fix-add_buffer_phys_virt-align-issue.patch b/ARM-Fix-add_buffer_phys_virt-align-issue.patch new file mode 100644 index 0000000..def0428 --- /dev/null +++ b/ARM-Fix-add_buffer_phys_virt-align-issue.patch @@ -0,0 +1,49 @@ +From 2a3e54e9f734ce08dee20b4ff1bdd5037f1b0193 Mon Sep 17 00:00:00 2001 +From: Haiqing Bai +Date: Wed, 24 Apr 2024 14:17:27 +0200 +Subject: [PATCH] ARM: Fix add_buffer_phys_virt() align issue + +When "CONFIG_ARM_LPAE" is enabled,3 level page table +is used by MMU, the "SECTION_SIZE" is defined with +(1 << 21), but 'add_buffer_phys_virt()' hardcode this +to (1 << 20). + +Suggested-By: fredrik.markstrom@gmail.com +Signed-off-by: Haiqing Bai +Signed-off-by: Alexander Kanavin +Signed-off-by: Simon Horman +--- + kexec/arch/arm/crashdump-arm.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/kexec/arch/arm/crashdump-arm.c b/kexec/arch/arm/crashdump-arm.c +index 1ec1826c..cc20f63c 100644 +--- a/kexec/arch/arm/crashdump-arm.c ++++ b/kexec/arch/arm/crashdump-arm.c +@@ -242,6 +242,7 @@ int load_crashdump_segments(struct kexec_info *info, char *mod_cmdline) + void *buf; + int err; + int last_ranges; ++ unsigned short align_bit_shift = 20; + + /* + * First fetch all the memory (RAM) ranges that we are going to pass to +@@ -283,6 +284,7 @@ int load_crashdump_segments(struct kexec_info *info, char *mod_cmdline) + + /* for support LPAE enabled kernel*/ + elf_info.class = ELFCLASS64; ++ align_bit_shift = 21; + + err = crash_create_elf64_headers(info, &elf_info, + usablemem_rgns.ranges, +@@ -304,8 +306,9 @@ int load_crashdump_segments(struct kexec_info *info, char *mod_cmdline) + * 1MB) so that available memory passed in kernel command line will be + * aligned to 1MB. This is because kernel create_mapping() wants memory + * regions to be aligned to SECTION_SIZE. ++ * The SECTION_SIZE of LPAE kernel is '1UL << 21' defined in pgtable-3level.h + */ +- elfcorehdr = add_buffer_phys_virt(info, buf, bufsz, bufsz, 1 << 20, ++ elfcorehdr = add_buffer_phys_virt(info, buf, bufsz, bufsz, 1 << align_bit_shift, + crash_kernel_mem.start, + crash_kernel_mem.end, -1, 0); + diff --git a/kexec-tools.spec b/kexec-tools.spec index ea846c9..1446a85 100644 --- a/kexec-tools.spec +++ b/kexec-tools.spec @@ -4,7 +4,7 @@ Name: kexec-tools Version: 2.0.26 -Release: 2 +Release: 3 License: GPLv2 Summary: The kexec/kdump userspace component URL: https://www.kernel.org/ @@ -72,6 +72,7 @@ Requires: systemd-udev%{?_isa} Patch0001: add-secure-compile-options-for-makedumpfile.patch Patch0002: kexec-Add-quick-kexec-support.patch Patch0003: kexec-Quick-kexec-implementation-for-arm64.patch +Patch0004: ARM-Fix-add_buffer_phys_virt-align-issue.patch %ifarch sw_64 Patch0004: sw_64.patch @@ -284,6 +285,9 @@ done %endif %changelog +* Tue May 7 2024 liuh - 2.0.26-3 +- sync patch from community + * Mon Jan 30 2023 chenhaixiang - 2.0.26-3 - update makedumpfile to makedumpfile-1.7.3 -- Gitee