From: George Guo <[email protected]> WARNING: Prefer a maximum 75 chars per line (possible unwrapped commit description?) #26: containing only /chosen with the two KHO properties. Since DEVICE_TREE_GUID
ERROR: Invalid commit separator - some tools may have problems applying this #34: ------------------------------- total: 2 errors, 1 warnings, 0 lines checked > Date: Fri, 29 May 2026 21:54:01 +0800 Subject: [PATCH v2 0/4] LoongArch: add KHO support and selftests This series adds Kexec Handover (KHO) support for LoongArch and extends the KHO selftest infrastructure to run on LoongArch under QEMU. KHO passes metadata (the KHO state FDT and scratch area addresses) to the second kernel via the FDT /chosen node, using the linux,kho-fdt and linux,kho-scratch properties that drivers/of/kexec.c:kho_add_chosen() writes and drivers/of/fdt.c:early_init_dt_check_kho() reads. KHO support (patches 1-2): Patch 1 adds KHO support for FDT-based systems (initial_boot_params != NULL, e.g. QEMU virt without OVMF). kho_load_fdt() copies the running kernel's FDT, appends linux,kho-fdt and linux,kho-scratch to /chosen, and loads the result as a kexec segment. machine_kexec() updates the DEVICE_TREE_GUID entry in the EFI config table to point to this segment so the second kernel's fdt_setup() can find and parse it. Patch 2 adds KHO support for ACPI-only systems (initial_boot_params == NULL, e.g. LoongArch servers with UEFI or QEMU with OVMF). Because no system FDT is available, kho_load_fdt() builds a minimal FDT from scratch containing only /chosen with the two KHO properties. Since DEVICE_TREE_GUID is absent from the EFI config table on ACPI-only systems, a new extended config table is built with the entry appended and loaded as a kexec segment; machine_kexec() switches st->tables to point to it before jumping. The second kernel's fdt_setup() calls efi_fdt_pointer() to detect the KHO FDT and passes it to early_init_dt_check_kho(). Selftest support (patches 3-4): Patch 3 adds loongarch.conf and extends vmtest.sh to recognise loongarch64 as a build target. The LoongArch virt machine is FDT-only (no ACPI), so 'earlycon' must appear on the kernel cmdline or the console UART is never discovered. PS/2 input devices are also disabled since QEMU's LoongArch virt machine has no i8042 controller; the fallback port probe hits a page fault and panics before reaching userspace. Patch 4 handles QEMU not exiting after kexec on LoongArch. QEMU provides no EFI runtime services, so machine_restart() falls through to an infinite idle loop. QEMU_NEEDS_KILL=1 in loongarch.conf signals vmtest.sh to run QEMU in the background, poll the serial output for the test verdict, and kill QEMU once it appears, so the test completes unattended. George Guo (4): LoongArch: kexec: add KHO support for FDT-based systems LoongArch: kexec: add KHO support for ACPI-only systems selftests/kho: add LoongArch vmtest support selftests/kho: handle QEMU not exiting after kexec on LoongArch arch/loongarch/Kconfig | 3 + arch/loongarch/include/asm/kexec.h | 7 + arch/loongarch/kernel/machine_kexec.c | 38 +++ arch/loongarch/kernel/machine_kexec_file.c | 256 +++++++++++++++++++++ arch/loongarch/kernel/setup.c | 21 +- tools/testing/selftests/kho/loongarch.conf | 13 ++ tools/testing/selftests/kho/vmtest.sh | 35 ++- 7 files changed, 365 insertions(+), 8 deletions(-) create mode 100644 tools/testing/selftests/kho/loongarch.conf -- 2.25.1

