Skip to contentSkip to conversation

Fix and improve the LoongArch implementation

PATCH Applied Youling Tang 2 participants 12 messages Sep 16, 2025 – Sep 23, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v2 cover Fix and improve the LoongArch implementation

From: Youling Tang <[email protected]>

- Add kexec_file support for LoongArch.
- Fix and improve the LoongArch implementation.
- Fixed the handling of crashkernel parameters when using --reuse-cmdline.

Kernel support for kexec_file was introduced by the patch detailed in Link [1].

Link[1]:
https://lore.kernel.org/loongarch/[email protected]/T/#t

Changelog:
v2:
- Add kexec_file support for LoongArch.
- Correct email address and Signed-off-by.

Youling Tang (10):
kexec: Handle removal of multiple 'crashkernel' parameters
LoongArch: Fix comments
LoongArch: Terminate the cmdline string using '\0'
LoongArch: Enforce relocatable kernel check for crash dump
LoongArch: Change initrd allocation to top-down
LoongArch: Fix the use of loongarch_image_header in ELF format
LoongArch: Add pe_hdr->machine check for pei format images LoongArch/pez: Fix kernel_fd handling when kexec_file is supported
LoongArch: Add kexec_file_load syscall
LoongArch: Remove 'kexec_file' cmdline parameters when using
--reuse-cmdline option

 kexec/arch/loongarch/image-header.h        |  5 ++-
 kexec/arch/loongarch/kexec-elf-loongarch.c | 47 ++++++++++++++++++----
 kexec/arch/loongarch/kexec-loongarch.c     | 44 +++++++++++++++++++-
 kexec/arch/loongarch/kexec-loongarch.h     |  1 +
 kexec/arch/loongarch/kexec-pei-loongarch.c | 27 ++++++++++++-
 kexec/arch/loongarch/kexec-pez-loongarch.c | 14 ++++---
 kexec/kexec-syscall.h                      |  5 ++-
 kexec/kexec.c                              |  6 +++
 8 files changed, 130 insertions(+), 19 deletions(-)
Signature · 1 line
2.34.1
#1 lore raw

PATCH v2 1/10 kexec: Handle removal of multiple 'crashkernel' parameters

From: Youling Tang <[email protected]>

When the kernel command line contains multiple 'crashkernel' parameters (e.g., crashkernel=1G,high crashkernel=256M,low), the original remove_parameter() function only removed the first instance. This left residual parameters that caused conflicts during kexec operations.

---
 kexec/kexec.c | 6 ++++++
 1 file changed, 6 insertions(+)
kexec/kexec.c +6 -0
index 6bf12d7..c9e4bcb 100644
@@ -1153,6 +1153,7 @@ void remove_parameter(char *line, const char *param_name)
 	if (!start)
 		return;
 
+again:
 	/*
 	 * check if that's really the start of a parameter and not in
 	 * the middle of the word
@@ -1167,6 +1168,11 @@ void remove_parameter(char *line, const char *param_name)
 		memmove(start, end+1, strlen(end));
 		*(end + strlen(end)) = 0;
 	}
+
+	/* There may be multiple 'crashkernel' parameters, such as low and high */
+	start = strstr(line, param_name);
+	if (start)
+		goto again;
 }
 
 static ssize_t _read(int fd, void *buf, size_t count)
Signature · 1 line
2.34.1
#2 lore raw

PATCH v2 2/10 LoongArch: Fix comments

In reply to Youling Tang

From: Youling Tang <[email protected]>

loongarch_load_other_segments() mainly loads initrd and cmdline. Fix this annotation.

---
 kexec/arch/loongarch/kexec-pei-loongarch.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
kexec/arch/loongarch/kexec-pei-loongarch.c +2 -2
index 1a11103..f0e0d09 100644
@@ -102,10 +102,10 @@ int pei_loongarch_load(int argc, char **argv, const char *buf,
 	/* Load the kernel */
 	add_segment(info, buf, len, kernel_segment, loongarch_mem.image_size);
 
-	/* Prepare and load dtb and initrd data */
+	/* Prepare and load initrd and cmdline data */
 	result = loongarch_load_other_segments(info, hole_min);
 	if (result) {
-		fprintf(stderr, "kexec: Load dtb and initrd segments failed.\n");
+		fprintf(stderr, "kexec: Load initrd and cmdline segments failed.\n");
 		goto exit;
 	}
 
Signature · 1 line
2.34.1
#3 lore raw

PATCH v2 3/10 LoongArch: Terminate the cmdline string using '\0'

In reply to Youling Tang

From: Youling Tang <[email protected]>

Terminate the cmdline string using '\0' instead of 0, improve code readability.

---
 kexec/arch/loongarch/kexec-loongarch.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kexec/arch/loongarch/kexec-loongarch.c +1 -1
index ea0c316..c335e0b 100644
@@ -334,7 +334,7 @@ int loongarch_load_other_segments(struct kexec_info *info, unsigned long hole_mi
 		}
 	}
 
-	cmdline[sizeof(cmdline) - 1] = 0;
+	cmdline[sizeof(cmdline) - 1] = '\0';
 	add_buffer(info, cmdline, sizeof(cmdline), sizeof(cmdline),
 		sizeof(void *), _ALIGN_UP(hole_min, getpagesize()),
 		hole_max, 1);
Signature · 1 line
2.34.1
#4 lore raw

PATCH v2 4/10 LoongArch: Enforce relocatable kernel check for crash dump

In reply to Youling Tang

From: Youling Tang <[email protected]>

Without enabling the RELOCATABLE configuration, LoongArch is a non-PIE kernel and cannot be loaded to run at any appropriate address. So the CRASH_DUMP feature depends on RELOCATABLE.

$ cat arch/loongarch/Kconfig
config ARCH_SELECTS_CRASH_DUMP
        def_bool y
        depends on CRASH_DUMP
        select RELOCATABLE

The relocatable kernel is determined by checking if there is a la_abs section. Currently, only the elf format has been checked, while pei/pez is in the FIXME state.

---
 kexec/arch/loongarch/kexec-elf-loongarch.c | 32 ++++++++++++++++++++++
 kexec/arch/loongarch/kexec-pei-loongarch.c |  3 ++
 2 files changed, 35 insertions(+)
kexec/arch/loongarch/kexec-elf-loongarch.c +32 -0
index c87f022..44b63a9 100644
@@ -13,6 +13,7 @@
 #include <limits.h>
 #include <errno.h>
 #include <elf.h>
+#include <stdbool.h>
 
 #include "kexec.h"
 #include "kexec-elf.h"
@@ -47,6 +48,27 @@ out:
 	return result;
 }
 
+/*
+ * To determine whether it is a relocatable kernel based on the ".la_abs "section,
+ * the CRASH_DUMP feature depends on CONFIG_RELOCATABLE in LoongArch.
+ */
+static bool laabs_section(const struct mem_ehdr *ehdr)
+{
+	struct mem_shdr *shdr, *shdr_end;
+	unsigned char *strtab;
+
+	strtab = (unsigned char *)ehdr->e_shdr[ehdr->e_shstrndx].sh_data;
+	shdr_end = &ehdr->e_shdr[ehdr->e_shnum];
+	for (shdr = ehdr->e_shdr; shdr != shdr_end; shdr++) {
+		if (shdr->sh_size &&
+			strcmp((char *)&strtab[shdr->sh_name], ".la_abs") == 0) {
+			return true;
+		}
+	}
+
+	return false;
+}
+
 int elf_loongarch_load(int argc, char **argv, const char *kernel_buf,
 	off_t kernel_size, struct kexec_info *info)
 {
@@ -63,6 +85,16 @@ int elf_loongarch_load(int argc, char **argv, const char *kernel_buf,
 		goto exit;
 	}
 
+	if (info->kexec_flags & KEXEC_ON_CRASH) {
+		bool is_relocatable_kernel = laabs_section(&ehdr);
+		if (!is_relocatable_kernel) {
+			dbgprintf("%s: The non-relocation kernel cannot be loaded, "
+				   "CONFIG_RELOCATABLE needs to be enabled\n", __func__);
+			result = EFAILED;
+			goto exit;
+		}
+	}
+
 	/* Find and process the loongarch image header. */
 	for (i = 0; i < ehdr.e_phnum; i++) {
 		struct mem_phdr *phdr = &ehdr.e_phdr[i];
kexec/arch/loongarch/kexec-pei-loongarch.c +3 -0
index f0e0d09..1a19a39 100644
@@ -99,6 +99,9 @@ int pei_loongarch_load(int argc, char **argv, const char *buf,
 		}
 	}
 
+	/* Fixme: Loading a non-relocation kernel will cause the second kernel to fail
+	   to start in KEXEC_ON_CRASH */
+
 	/* Load the kernel */
 	add_segment(info, buf, len, kernel_segment, loongarch_mem.image_size);
 
Signature · 1 line
2.34.1
#5 lore raw

PATCH v2 5/10 LoongArch: Change initrd allocation to top-down

In reply to Youling Tang

From: Youling Tang <[email protected]>

When loading a secondary kernel with KASLR enabled, the randomized relocation of the kernel image may overlap the initrd memory region, causing data corruption and boot failure. This occurs because KASLR dynamically shifts the kernel's load address, which could accidentally target the initrd's pre-allocated space.

Modify the initrd allocation strategy from bottom-up to top-down within the reserved memory region. By placing the initrd at higher addresses first, we minimize the risk of the relocated kernel overwriting it.

---
 kexec/arch/loongarch/kexec-loongarch.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kexec/arch/loongarch/kexec-loongarch.c +1 -1
index c335e0b..32cd484 100644
@@ -317,7 +317,7 @@ int loongarch_load_other_segments(struct kexec_info *info, unsigned long hole_mi
 		initrd_base = add_buffer(info, initrd_buf, initrd_size,
 					initrd_size, sizeof(void *),
 					_ALIGN_UP(initrd_min,
-						pagesize), hole_max, 1);
+						pagesize), hole_max, -1);
 		dbgprintf("initrd_base: %lx, initrd_size: %lx\n", initrd_base, initrd_size);
 
 		cmdline_add_initrd(cmdline, initrd_base, initrd_size);
Signature · 1 line
2.34.1
#6 lore raw

PATCH v2 6/10 LoongArch: Fix the use of loongarch_image_header in ELF format

In reply to Youling Tang

From: Youling Tang <[email protected]>

loongarch_image_header should not be used in the ELF format. When the CONFIG_EFI_STUB configuration is turned off, the ELF kernel image will not add loongarch_image_heade processing, as can be seen from the kernel code arch/loongarch/kernel/head.S.

Thus, use the elf header content to fix this issue.

---
 kexec/arch/loongarch/image-header.h        |  2 +-
 kexec/arch/loongarch/kexec-elf-loongarch.c | 12 ++++--------
 2 files changed, 5 insertions(+), 9 deletions(-)
kexec/arch/loongarch/image-header.h +1 -1
index 223d81f..0db7615 100644
@@ -1,5 +1,5 @@
 /*
- * LoongArch binary image header.
+ * LoongArch binary image header. (for pei/pez format)
  */
 
 #if !defined(__LOONGARCH_IMAGE_HEADER_H)
kexec/arch/loongarch/kexec-elf-loongarch.c +4 -8
index 44b63a9..92fa9f8 100644
@@ -72,7 +72,6 @@ static bool laabs_section(const struct mem_ehdr *ehdr)
 int elf_loongarch_load(int argc, char **argv, const char *kernel_buf,
 	off_t kernel_size, struct kexec_info *info)
 {
-	const struct loongarch_image_header *header = NULL;
 	unsigned long kernel_segment;
 	struct mem_ehdr ehdr;
 	int result;
@@ -95,22 +94,19 @@ int elf_loongarch_load(int argc, char **argv, const char *kernel_buf,
 		}
 	}
 
-	/* Find and process the loongarch image header. */
 	for (i = 0; i < ehdr.e_phnum; i++) {
 		struct mem_phdr *phdr = &ehdr.e_phdr[i];
 
 		if (phdr->p_type != PT_LOAD)
 			continue;
 
-		header = (const struct loongarch_image_header *)(
-			kernel_buf + phdr->p_offset);
-
-		if (!loongarch_process_image_header(header))
-			break;
+		loongarch_mem.text_offset = virt_to_phys(phdr->p_paddr);
+		loongarch_mem.image_size = _ALIGN_UP(phdr->p_memsz, KiB(64));
+		break;
 	}
 
 	if (i == ehdr.e_phnum) {
-		dbgprintf("%s: Valid loongarch image header not found\n", __func__);
+		dbgprintf("%s: Valid loongarch phdr not found\n", __func__);
 		result = EFAILED;
 		goto exit;
 	}
Signature · 1 line
2.34.1
#7 lore raw

PATCH v2 7/10 LoongArch: Add pe_hdr->machine check for pei format images

In reply to Youling Tang

From: Youling Tang <[email protected]>

Add the pe_hdr->machine check to ensure that the kernel image is of the 64-bit LoongArch architecture.

---
 kexec/arch/loongarch/image-header.h        |  3 +++
 kexec/arch/loongarch/kexec-pei-loongarch.c | 17 +++++++++++++++++
 2 files changed, 20 insertions(+)
kexec/arch/loongarch/image-header.h +3 -0
index 0db7615..fc71ff2 100644
@@ -35,6 +35,9 @@ struct loongarch_image_header {
 static const uint8_t loongarch_image_pe_sig[2] = {'M', 'Z'};
 static const uint8_t loongarch_pe_machtype[6] = {'P','E', 0x0, 0x0, 0x64, 0x62};
 
+#define IMAGE_FILE_MACHINE_LOONGARCH64  0x6264 /* LoongArch 64-bit processor family */
+
+
 /**
  * loongarch_header_check_pe_sig - Helper to check the loongarch image header.
  *
kexec/arch/loongarch/kexec-pei-loongarch.c +17 -0
index 1a19a39..e0a82b6 100644
@@ -24,9 +24,20 @@
 #include "kexec-loongarch.h"
 #include "arch/options.h"
 
+#include <pe.h>
+
+static inline int loongarch_pe_check_machine(const struct pe_hdr *pe_hdr)
+{
+	if (!pe_hdr)
+		return 0;
+
+	return (pe_hdr->machine == IMAGE_FILE_MACHINE_LOONGARCH64);
+}
+
 int pei_loongarch_probe(const char *kernel_buf, off_t kernel_size)
 {
 	const struct loongarch_image_header *h;
+	const struct pe_hdr *pe_hdr;
 
 	if (kernel_size < sizeof(struct loongarch_image_header)) {
 		dbgprintf("%s: No loongarch image header.\n", __func__);
@@ -40,6 +51,12 @@ int pei_loongarch_probe(const char *kernel_buf, off_t kernel_size)
 		return -1;
 	}
 
+	pe_hdr = (const struct pe_hdr *)(kernel_buf + get_pehdr_offset(kernel_buf));
+	if (!loongarch_pe_check_machine(pe_hdr)) {
+		dbgprintf("%s: Bad loongarch pe_hdr machine.\n", __func__);
+		return -1;
+	}
+
 	return 0;
 }
 
Signature · 1 line
2.34.1
#8 lore raw

PATCH v2 8/10 LoongArch/pez: Fix kernel_fd handling when kexec_file is supported

In reply to Youling Tang

From: Youling Tang <[email protected]>

After the current pez kernel image is decompressed and loaded, this kernel_fd will be released. When kexec_file is added subsequently, the kernel detects that the content in kernel_fd is empty, causing the kernel loading to fail. Therefore, kernel_fd is rewritten for processing.

---
 kexec/arch/loongarch/kexec-pez-loongarch.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
kexec/arch/loongarch/kexec-pez-loongarch.c +9 -5
index 942a47c..e78909c 100644
@@ -64,13 +64,17 @@ int pez_loongarch_load(int argc, char **argv, const char *buf, off_t len,
 	if (kernel_fd > 0 && decompressed_size > 0) {
 		char *kbuf;
 		off_t nread;
+		int fd;
 
+		if (info->kernel_fd > 0)
+			close(info->kernel_fd);
 		info->kernel_fd = kernel_fd;
-		/*
-		 * slurp_fd will close kernel_fd, but it is safe here
-		 * due to no kexec_file_load support.
-		 */
-		kbuf = slurp_fd(kernel_fd, NULL, decompressed_size, &nread);
+		fd = dup(kernel_fd);
+		if (fd < 0) {
+			dbgprintf("%s: dup fd failed.\n", __func__);
+			return -1;
+		}
+		kbuf = slurp_fd(fd, NULL, decompressed_size, &nread);
 		if (!kbuf || nread != decompressed_size) {
 			dbgprintf("%s: slurp_fd failed.\n", __func__);
 			return -1;
Signature · 1 line
2.34.1
#9 lore raw

PATCH v2 9/10 LoongArch: Add kexec_file_load syscall

In reply to Youling Tang

From: Youling Tang <[email protected]>

Create prepare_kexec_file_options() function to prepare the options to kexec_file_load syscall, and it would be used in pei_loongarch_load().

Currently, pez(vmlinuz.efi), pei(vmlinux.efi) and elf(vmlinux) format images are supported.

---
 kexec/arch/loongarch/kexec-elf-loongarch.c |  3 ++
 kexec/arch/loongarch/kexec-loongarch.c     | 39 ++++++++++++++++++++++
 kexec/arch/loongarch/kexec-loongarch.h     |  1 +
 kexec/arch/loongarch/kexec-pei-loongarch.c |  3 ++
 kexec/kexec-syscall.h                      |  5 ++-
 5 files changed, 50 insertions(+), 1 deletion(-)
kexec/arch/loongarch/kexec-elf-loongarch.c +3 -0
index 92fa9f8..1cc6212 100644
@@ -77,6 +77,9 @@ int elf_loongarch_load(int argc, char **argv, const char *kernel_buf,
 	int result;
 	int i;
 
+	if (info->file_mode)
+		return prepare_kexec_file_options(info);
+
 	result = build_elf_exec_info(kernel_buf, kernel_size, &ehdr, 0);
 
 	if (result < 0) {
kexec/arch/loongarch/kexec-loongarch.c +39 -0
index 32cd484..eb60ef0 100644
@@ -10,12 +10,14 @@
 
 #include <assert.h>
 #include <errno.h>
+#include <fcntl.h>
 #include <getopt.h>
 #include <inttypes.h>
 #include <limits.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <sys/types.h>
 #include <sys/stat.h>
 #include <linux/elf-em.h>
 #include <elf.h>
@@ -29,6 +31,10 @@
 #include "mem_regions.h"
 #include "arch/options.h"
 
+#ifndef _O_BINARY
+#define _O_BINARY 0
+#endif
+
 #define CMDLINE_PREFIX "kexec "
 static char cmdline[COMMAND_LINE_SIZE] = CMDLINE_PREFIX;
 
@@ -201,6 +207,39 @@ struct arch_options_t arch_options = {
 	.core_header_type = CORE_TYPE_ELF64,
 };
 
+int prepare_kexec_file_options(struct kexec_info *info)
+{
+	int fd;
+	ssize_t result;
+	struct stat stats;
+
+	if (arch_options.command_line) {
+		info->command_line = (char *)arch_options.command_line;
+		info->command_line_len = strlen(info->command_line) + 1;
+	}
+
+	if (!arch_options.initrd_file) {
+		info->initrd_fd = -1;
+		return 0;
+	}
+
+	fd = open(arch_options.initrd_file, O_RDONLY | _O_BINARY);
+	if (fd < 0) {
+		fprintf(stderr, "Cannot open `%s': %s\n", arch_options.initrd_file,
+				strerror(errno));
+		return -EINVAL;
+	}
+	result = fstat(fd, &stats);
+	if (result < 0) {
+		close(fd);
+		fprintf(stderr, "Cannot stat: %s: %s\n", arch_options.initrd_file,
+				strerror(errno));
+		return -EINVAL;
+	}
+	info->initrd_fd = fd;
+	return 0;
+}
+
 int arch_process_options(int argc, char **argv)
 {
 	static const char short_options[] = KEXEC_ARCH_OPT_STR "";
kexec/arch/loongarch/kexec-loongarch.h +1 -0
index 2c7624f..2bffa47 100644
@@ -37,6 +37,7 @@ int loongarch_process_image_header(const struct loongarch_image_header *h);
 unsigned long loongarch_locate_kernel_segment(struct kexec_info *info);
 int loongarch_load_other_segments(struct kexec_info *info,
 	unsigned long hole_min);
+int prepare_kexec_file_options(struct kexec_info *info);
 
 struct arch_options_t {
 	char *command_line;
kexec/arch/loongarch/kexec-pei-loongarch.c +3 -0
index e0a82b6..10f79c1 100644
@@ -70,6 +70,9 @@ int pei_loongarch_load(int argc, char **argv, const char *buf,
 
 	header = (const struct loongarch_image_header *)(buf);
 
+	if (info->file_mode)
+		return prepare_kexec_file_options(info);
+
 	if (loongarch_process_image_header(header))
 		return EFAILED;
 
kexec/kexec-syscall.h +4 -1
index 9b17578..e9bb7de 100644
@@ -59,7 +59,7 @@
 #endif
 #endif /*ifndef __NR_kexec_load*/
 
-#if defined(__arm__) || defined(__loongarch__)
+#if defined(__arm__)
 #undef __NR_kexec_file_load
 #endif
 
@@ -83,6 +83,9 @@
 #if defined(__riscv__) || defined(__riscv)
 #define __NR_kexec_file_load	294
 #endif
+#ifdef __loongarch__
+#define __NR_kexec_file_load	294
+#endif
 
 #ifndef __NR_kexec_file_load
 /* system call not available for the arch */
Signature · 1 line
2.34.1
#10 lore raw

PATCH v2 10/10 LoongArch: Remove 'kexec_file' cmdline parameters when using --reuse-cmdline option

In reply to Youling Tang

From: Youling Tang <[email protected]>

On the LoongArch architecture, when loading the kernel via kexec_file, the 'kexec_file'prefix is automatically appended to the command line. Consequently, if the '--reuse-cmdline' option is used to inherit the current command line, this prefix must be detected and removed.

---
 kexec/arch/loongarch/kexec-loongarch.c | 1 +
 1 file changed, 1 insertion(+)
kexec/arch/loongarch/kexec-loongarch.c +1 -0
index eb60ef0..240202f 100644
@@ -260,6 +260,7 @@ int arch_process_options(int argc, char **argv)
 		case OPT_REUSE_CMDLINE:
 			cmdline = get_command_line();
 			remove_parameter(cmdline, "kexec");
+			remove_parameter(cmdline, "kexec_file");
 			remove_parameter(cmdline, "initrd");
 			break;
 		case OPT_INITRD:
Signature · 1 line
2.34.1
Applied
#11 lore raw
In reply to Youling Tang
Quoted 16 lines · Youling Tang

From: Youling Tang <[email protected]>

- Add kexec_file support for LoongArch.
- Fix and improve the LoongArch implementation.
- Fixed the handling of crashkernel parameters when using --reuse-cmdline.

Kernel support for kexec_file was introduced by the patch detailed in Link [1].

Link[1]:
https://lore.kernel.org/loongarch/[email protected]/T/#t

Changelog:
v2:
- Add kexec_file support for LoongArch.
- Correct email address and Signed-off-by.

Quoted 12 lines

Youling Tang (10):
kexec: Handle removal of multiple 'crashkernel' parameters
LoongArch: Fix comments
LoongArch: Terminate the cmdline string using '\0'
LoongArch: Enforce relocatable kernel check for crash dump
LoongArch: Change initrd allocation to top-down
LoongArch: Fix the use of loongarch_image_header in ELF format
LoongArch: Add pe_hdr->machine check for pei format images LoongArch/pez: Fix kernel_fd handling when kexec_file is supported
LoongArch: Add kexec_file_load syscall
LoongArch: Remove 'kexec_file' cmdline parameters when using
--reuse-cmdline option

Thanks, applied.

- LoongArch: Remove 'kexec_file' cmdline parameters when using --reuse-cmdline option
https://git.kernel.org/pub/scm/utils/kernel/kexec/kexec-tools.git/commit/?id=19d1b275c649
- LoongArch: Add kexec_file_load syscall
https://git.kernel.org/pub/scm/utils/kernel/kexec/kexec-tools.git/commit/?id=f1d66280a48b
- LoongArch/pez: Fix kernel_fd handling when kexec_file is supported
https://git.kernel.org/pub/scm/utils/kernel/kexec/kexec-tools.git/commit/?id=b7c35c42c3db
- LoongArch: Add pe_hdr->machine check for pei format images
https://git.kernel.org/pub/scm/utils/kernel/kexec/kexec-tools.git/commit/?id=13e701e72ecf
- LoongArch: Fix the use of loongarch_image_header in ELF format
https://git.kernel.org/pub/scm/utils/kernel/kexec/kexec-tools.git/commit/?id=919005b26c8f
- LoongArch: Change initrd allocation to top-down
https://git.kernel.org/pub/scm/utils/kernel/kexec/kexec-tools.git/commit/?id=2d3f8185f5d7
- LoongArch: Enforce relocatable kernel check for crash dump
https://git.kernel.org/pub/scm/utils/kernel/kexec/kexec-tools.git/commit/?id=024073e74dc7
- LoongArch: Terminate the cmdline string using '\0'
https://git.kernel.org/pub/scm/utils/kernel/kexec/kexec-tools.git/commit/?id=d9c82c188646
- LoongArch: Fix comments
https://git.kernel.org/pub/scm/utils/kernel/kexec/kexec-tools.git/commit/?id=e2bfd6df147c
- kexec: Handle removal of multiple 'crashkernel' parameters
https://git.kernel.org/pub/scm/utils/kernel/kexec/kexec-tools.git/commit/?id=39ba2bd288af