From fc9a4cf851c7ae534ff5a72c22da5a0951600e15 Mon Sep 17 00:00:00 2001 From: Youling Tang Date: Tue, 30 May 2023 15:29:01 +0800 Subject: [PATCH] LoongArch: Adjust kernel position alignment rules Signed-off-by: Youling Tang --- ...just-kernel-position-alignment-rules.patch | 38 +++++++++++++++++++ kexec-tools.spec | 7 +++- 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 LoongArch-Adjust-kernel-position-alignment-rules.patch diff --git a/LoongArch-Adjust-kernel-position-alignment-rules.patch b/LoongArch-Adjust-kernel-position-alignment-rules.patch new file mode 100644 index 0000000..fb17303 --- /dev/null +++ b/LoongArch-Adjust-kernel-position-alignment-rules.patch @@ -0,0 +1,38 @@ +From 0b8d4eb3e7b2dbd9f6c70de230170d49733bf11f Mon Sep 17 00:00:00 2001 +From: Youling Tang +Date: Tue, 30 May 2023 14:51:48 +0800 +Subject: [PATCH] LoongArch: Adjust kernel position alignment rules + +Adjust the kernel position to align with 16M to avoid possible conflicts +between the kernel and initrd positions. + +Signed-off-by: Youling Tang +--- + kexec/arch/loongarch/kexec-loongarch.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/kexec/arch/loongarch/kexec-loongarch.c b/kexec/arch/loongarch/kexec-loongarch.c +index f47c998..fd782b6 100644 +--- a/kexec/arch/loongarch/kexec-loongarch.c ++++ b/kexec/arch/loongarch/kexec-loongarch.c +@@ -255,7 +255,7 @@ unsigned long loongarch_locate_kernel_segment(struct kexec_info *info) + hole = (crash_reserved_mem[usablemem_rgns.size - 1].start < mem_min ? + mem_min : crash_reserved_mem[usablemem_rgns.size - 1].start) + + loongarch_mem.text_offset; +- hole = _ALIGN_UP(hole, MiB(1)); ++ hole = _ALIGN_UP(hole, MiB(16)); + hole_end = hole + loongarch_mem.text_offset + loongarch_mem.image_size; + + if ((hole_end > mem_max) || +@@ -266,7 +266,7 @@ unsigned long loongarch_locate_kernel_segment(struct kexec_info *info) + } else { + hole = locate_hole(info, + loongarch_mem.text_offset + loongarch_mem.image_size, +- MiB(1), 0, ULONG_MAX, 1); ++ MiB(16), 0, ULONG_MAX, 1); + + if (hole == ULONG_MAX) + dbgprintf("%s: locate_hole failed\n", __func__); +-- +2.33.0 + diff --git a/kexec-tools.spec b/kexec-tools.spec index b443126..d2622f5 100644 --- a/kexec-tools.spec +++ b/kexec-tools.spec @@ -4,7 +4,7 @@ Name: kexec-tools Version: 2.0.23 -Release: 11 +Release: 12 License: GPLv2 Summary: The kexec/kdump userspace component URL: https://www.kernel.org/ @@ -82,6 +82,7 @@ Patch00010: sw_64.patch Patch00011: makedumpfile-1.7.0-sw.patch Patch00012: kexec-add-loongarch64-support.patch Patch00013: add-loongarch64-support-for-makedumpfile.patch +Patch00014: LoongArch-Adjust-kernel-position-alignment-rules.patch %description kexec-tools provides /sbin/kexec binary that facilitates a new kernel to boot using the kernel's kexec feature either on a @@ -121,6 +122,7 @@ tar -z -x -v -f %{SOURCE19} %patch00012 -p1 %patch00013 -p1 +%patch00014 -p1 %build @@ -306,6 +308,9 @@ done %endif %changelog +* Tue May 30 2023 Youling Tang - 2.0.23-12 +- LoongArch: Adjust kernel position alignment rules + * Tue Mar 21 2023 Youling Tang - 2.0.23-11 - Reimplement loongarch64 support. -- Gitee