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(-)

-- 
2.51.0


Reply via email to