From: George Guo <dongtai.guo@linux.dev>
To: chenhuacai@kernel.org, rppt@kernel.org,
pasha.tatashin@soleen.com, pratyush@kernel.org, shuah@kernel.org,
ardb@kernel.org
Cc: guodongtai@kylinos.cn, kernel@xen0n.name, graf@amazon.com,
loongarch@lists.linux.dev, linux-kernel@vger.kernel.org,
kexec@lists.infradead.org, linux-mm@kvack.org,
linux-kselftest@vger.kernel.org, linux-efi@vger.kernel.org
Subject: [PATCH v4 0/4] LoongArch: add KHO support and selftests
Date: Fri, 7 Aug 2026 18:37:10 +0800 [thread overview]
Message-ID: <20260807103714.33074-1-dongtai.guo@linux.dev> (raw)
This series enables Kexec Handover (KHO) on LoongArch, making it the
third architecture (after x86 and arm64) to set
ARCH_SUPPORTS_KEXEC_HANDOVER. That is the only remaining gate for Live
Update (LUO) to run on LoongArch.
The hard part is the transport: how the first kernel hands the KHO state
(the KHO FDT and the scratch region) to the second kernel across kexec.
Why not the command line or an FDT
----------------------------------
LoongArch boots from EFI, but unlike arm64 and riscv its efistub does not
build a boot FDT. It passes the EFI system table and the command line
straight to the core kernel [1]. There is no /chosen node to carry the
blob, so the arm64 path (drivers/of/kexec.c:kho_add_chosen() writes
linux,kho-fdt and linux,kho-scratch; drivers/of/fdt.c:
early_init_dt_check_kho() reads them) does not apply.
Two earlier transports were tried and rejected:
* v1 put the handover addresses on the kernel command line. Pratyush
found that odd and asked for a DT-based alternative.
* v2/v3 synthesized an FDT and rewrote the DEVICE_TREE_GUID entry in the
EFI config table so the generic FDT reader would find it. Pratyush
called that "even more hacky" than the command line [2].
The v4 transport
----------------
v4 follows the x86 setup_data idea, in EFI terms. The first kernel packs
the KHO state into a small struct (linux_efi_kho_data: fdt addr/size and
scratch addr/size), appends a pointer to it under a dedicated
LINUX_EFI_KHO_TABLE_GUID entry in a new EFI config table, loads both as
kexec segments, and switches st->tables before jumping. The second kernel
scans the config table for that GUID in setup_arch() and calls
kho_populate() directly. This is the approach proposed in [3].
It addresses both objections: nothing is exposed on the command line, and
no FDT is synthesized. It also meets Huacai's constraint: it reuses the
EFI system table LoongArch already has, with no dependency on a boot FDT
the efistub never creates.
Patch layout
------------
Patches 1-2 implement the transport. Patch 1 adds the EFI config table
GUID and the handover struct to include/linux/efi.h. It is split out so
the EFI maintainers can review it on its own. Patch 2 wires up the
LoongArch side: ARCH_SUPPORTS_KEXEC_HANDOVER, the write side in
machine_kexec_file.c, the st->tables switch in machine_kexec(), and the
reader in setup_arch().
Patch 3 is a build fix for kernel/liveupdate/luo_session.c that the
series depends on under CONFIG_KFENCE=y on LoongArch. It was sent
standalone as v2 and acked by Mike. It is folded in here at his request
to send it along with this series [4].
Patch 4 adds LoongArch vmtest support to the KHO selftests and folds in
the two points Mike raised on v3 (use "VM" instead of the ad-hoc
"virt machine"; run every architecture under timeout(1), not only
LoongArch).
Patch 1 is aimed at the EFI tree. Patches 2-4 are aimed at the LoongArch
and KHO trees. I expect the whole series to go through the KHO tree with
Ard's and Huacai's acks.
Changes since v3
----------------
* Rework the transport: drop the synthesized FDT and the
DEVICE_TREE_GUID rewrite. Pass the KHO state through a dedicated EFI
configuration table GUID and call kho_populate() directly (patches
1, 2).
* Fold in the luo_session build fix (previously standalone v2, acked by
Mike) as patch 3, at his request.
* selftests: address Mike's v3 review (use "VM"; always run under
timeout(1)).
* Rebase onto v7.2-rc6.
[1] Huacai Chen: https://lore.kernel.org/r/CAAhV-H5B6Mj2-AffkstJ4f8EEmvvPOGXoDy2QNudKD2kSz2XkA@mail.gmail.com/
[2] Pratyush Yadav: https://lore.kernel.org/r/2vxzjyqzj8s2.fsf@kernel.org/
[3] https://lore.kernel.org/r/20260717071551.11904-1-dongtai.guo@linux.dev/
[4] Mike Rapoport: https://lore.kernel.org/r/ai5nYlbERQBXRHSp@kernel.org/
George Guo (4):
efi: add a KHO configuration table GUID
LoongArch: kexec: add KHO support
liveupdate: luo_session: include linux/mm.h for virt/phys translation
selftests/kho: add LoongArch vmtest support
arch/loongarch/Kconfig | 3 +
arch/loongarch/include/asm/kexec.h | 7 ++
arch/loongarch/kernel/machine_kexec.c | 16 +++
arch/loongarch/kernel/machine_kexec_file.c | 131 +++++++++++++++++++++
arch/loongarch/kernel/setup.c | 41 +++++++
include/linux/efi.h | 24 ++++
kernel/liveupdate/luo_session.c | 1 +
tools/testing/selftests/kho/loongarch.conf | 11 ++
tools/testing/selftests/kho/vmtest.sh | 22 ++--
9 files changed, 249 insertions(+), 7 deletions(-)
create mode 100644 tools/testing/selftests/kho/loongarch.conf
--
2.53.0
next reply other threads:[~2026-08-07 10:37 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-07 10:37 George Guo [this message]
2026-08-07 10:37 ` [PATCH v4 1/4] efi: add a KHO configuration table GUID George Guo
2026-08-09 4:18 ` Huacai Chen
2026-08-10 13:13 ` Ard Biesheuvel
2026-08-10 14:35 ` Huacai Chen
2026-08-10 16:19 ` Pratyush Yadav
2026-08-07 10:37 ` [PATCH v4 2/4] LoongArch: kexec: add KHO support George Guo
2026-08-10 14:42 ` Huacai Chen
2026-08-10 17:37 ` Pratyush Yadav
2026-08-07 10:37 ` [PATCH v4 3/4] liveupdate: luo_session: include linux/mm.h for virt/phys translation George Guo
2026-08-10 14:37 ` Huacai Chen
2026-08-10 17:39 ` Pratyush Yadav
2026-08-10 17:44 ` Pratyush Yadav
2026-08-07 10:37 ` [PATCH v4 4/4] selftests/kho: add LoongArch vmtest support George Guo
2026-08-09 4:16 ` Huacai Chen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260807103714.33074-1-dongtai.guo@linux.dev \
--to=dongtai.guo@linux.dev \
--cc=ardb@kernel.org \
--cc=chenhuacai@kernel.org \
--cc=graf@amazon.com \
--cc=guodongtai@kylinos.cn \
--cc=kernel@xen0n.name \
--cc=kexec@lists.infradead.org \
--cc=linux-efi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=loongarch@lists.linux.dev \
--cc=pasha.tatashin@soleen.com \
--cc=pratyush@kernel.org \
--cc=rppt@kernel.org \
--cc=shuah@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.