Hi Huacai, Pratyush, Thanks for the direction. You were both right that the v3 approach was the wrong shape, and I have dropped it.
Let me restate the constraint and report what I did. > But LoongArch is different, the efistub doesn't create a FDT, instead > it passes the EFI system table and command line to the core kernel > directly. So LoongArch has no boot FDT, and the arm64 /chosen path does not apply. My v3 synthesized an FDT and rewrote the DEVICE_TREE_GUID entry only to reuse the generic reader. That was the hacky part, and it is gone. I followed the x86 model instead. x86 has no boot FDT either; it carries the KHO pointer in setup_data (struct kho_data) and calls kho_populate() directly. LoongArch has no setup_data, but it does pass the EFI system table. So I use the EFI configuration table as the channel: - The first kernel builds a small handover struct (the KHO FDT and scratch addresses), adds a dedicated GUID entry pointing to it, and loads both as kexec segments. machine_kexec() switches the system table to the extended table before jumping. - The next kernel scans the configuration table for that GUID, reads the struct, and calls kho_populate() directly. There is no synthesized FDT, no DEVICE_TREE_GUID rewrite, and nothing on the command line. I did not go back to the v1 command line because that exposes the addresses to unprivileged userspace through /proc/cmdline. I tested this on real LoongArch hardware (ACPI/UEFI) with the live update two-stage kexec test and the test passes: $ sudo ./luo_kexec_simple --stage 1 # [STAGE 1] Starting pre-kexec setup... # [STAGE 1] Creating state file for next stage (2)... # [STAGE 1] Creating session 'test-session' and preserving memfd... # [STAGE 1] Forking persistent child to hold sessions... # [STAGE 1] Child PID: 1242. Resources are pinned. # [STAGE 1] You may now perform kexec reboot. $ sudo kexec -l /boot/vmlinuz-7.1.0-rc6 --initrd=/boot/initramfs-7.1.0-rc6.img --reuse-cmdline $ sudo kexec -e $ sudo ./luo_kexec_simple --stage 2 # [STAGE 2] Starting post-kexec verification... # [STAGE 2] Retrieving session 'test-session'... # [STAGE 2] Restoring and verifying memfd (token 0x1a)... # [STAGE 2] Test data verified successfully. # [STAGE 2] Finalizing test session... # [STAGE 2] Finalizing state session... # --- SIMPLE KEXEC TEST PASSED --- $ sudo dmesg | grep kexec [ 0.000000] [ T0] KHO: found kexec handover data. I will send this as v4, folding in Mike's two selftest comments. If you see a problem with the EFI configuration table approach, please tell me before I post. Thanks, George

