Skip to content

ppc64: Support kexec with initrd and DTB together

Shivang Upadhyay kexec 1 version Applied

Status from this message: Thanks, applied.

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 2 repliesApplied

Patches in v1 Applied

#Subject and filesSizeRepliesApplied
1/4ppc64: ensure /memreserve/ sections exist in user-provided FDTkexec/arch/ppc64/kexec-elf-ppc64.c+165 -00 replies
2/4ppc64: handle reboot CPU in case of user provided DTBkexec/arch/ppc64/kexec-elf-ppc64.c+86 -00 replies
3/4Add arch_do_unload hook for arch-specific cleanupkexec/arch/arm/kexec-arm.c kexec/arch/arm64/kexec-arm64.c kexec/arch/cris/kexec-cris.c +14 more+67 -00 replies
4/4ppc64: life the dtb and initrd restrictionkexec/arch/ppc64/kexec-elf-ppc64.c+6 -50 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH kexec-tools 0/4] ppc64: Support kexec with initrd and DTB together

Currently, on ppc64 systems, kexec cannot directly use a user-provided devicetreeblob (dtb) when booting a new kernel with an initrd. This limitation exists because the dtb must be modified at runtime — for example, to include the initrd’s memory location and size, and to add /memreserve/ entries based on the current system memory layout.

Previously, kexec handled this by generating a fresh dtb in memory from the running system’s /proc/device-tree directory. However, this approach prevents users from making intentional modifications to the dtb — such as changin boot arguments, enabling or disabling devices, or testing kernel changes that depend on specific device tree properties.

Adding support for user-provided dtb (with appropriate patching by kexec) allows more control for developers, particularly when experimenting with custom kernels or hardware configurations.

This patch series lifts this restriction and ensures that the necessary /memreserve/ sections are properly added to the new DTB. on ppc64, it is mandatory, for the rebooting cpu to be present in the new kernel’s dtb, so additional logic has been added to identify and mark one of available cpu as reboot cpu on currect system.

A new architecture-specific function, arch_do_unload(), has been introduced to perform the necessary cleanup during kexec unload. in ppc64, the reboot CPU changes due to kexec, and it gets reset back on kexec unload.

Shivang Upadhyay (4):
ppc64: ensure /memreserve/ sections exist in user-provided FDT
ppc64: handle reboot CPU in case of user provided DTB Add arch_do_unload hook for arch-specific cleanup
ppc64: life the dtb and initrd restriction

 kexec/arch/arm/kexec-arm.c             |   4 +
 kexec/arch/arm64/kexec-arm64.c         |   4 +
 kexec/arch/cris/kexec-cris.c           |   4 +
 kexec/arch/hppa/kexec-hppa.c           |   4 +
 kexec/arch/i386/kexec-x86.c            |   4 +
 kexec/arch/ia64/kexec-ia64.c           |   4 +
 kexec/arch/loongarch/kexec-loongarch.c |   4 +
 kexec/arch/m68k/kexec-m68k.c           |   4 +
 kexec/arch/mips/kexec-mips.c           |   4 +
 kexec/arch/ppc/kexec-ppc.c             |   4 +
 kexec/arch/ppc64/kexec-elf-ppc64.c     | 262 ++++++++++++++++++++++++-
 kexec/arch/ppc64/kexec-ppc64.c         |   8 +
 kexec/arch/riscv/kexec-riscv.c         |   4 +
 kexec/arch/s390/kexec-s390.c           |   4 +
 kexec/arch/sh/kexec-sh.c               |   4 +
 kexec/arch/x86_64/kexec-x86_64.c       |   5 +
 kexec/kexec.c                          |   1 +
 kexec/kexec.h                          |   1 +
 18 files changed, 324 insertions(+), 5 deletions(-)
Signature · 1 line
2.51.0