The first patch fixes the KHO scratch alignment check by moving it from
a compile-time static assertion to a runtime check. On powerpc,
CMA_MIN_ALIGNMENT_BYTES can depend on pageblock_order and it may not be a
compile-time constant with some configurations. The runtime check
allows KHO to be enabled for these configurations and disables KHO if
the required scratch alignment is not met.

The second patch enables KHO support for powerpc and adds the call to
early_init_dt_check_kho() from the powerpc architecture setup path,
where KHO information needs to be checked early during boot.
early_init_dt_check_kho() is also made public so that the powerpc code
can make use of it.

There is a generic issue with KHO scratch sizing when other memory
reservations, such as crashkernel, are made before the KHO scratch
reservation. Such reservations can be included when calculating the
scratch size and may cause the KHO scratch reservation to fail. This
will be addressed separately in a follow-up patch. To know more on
this [1]

Testing:
========
This series was tested in the following two environments with
CONFIG_TEST_KEXEC_HANDOVER enabled and the kho_test kernel module:

- pSeries LPAR
- pSeries guest running on PowerNV
- pSeries guest running on Pseries LPAR

The KHO test module successfully verified KHO state restoration:
> dmesg | grep -i kho

Linux version 7.3.0-rc4kho-ppc-upstream+ ([email protected]) 
(gcc (GCC) 15.3.1 20260722 (Red Hat 15.3.1-1), GNU ld version 2.45.1-5.fc43) #2 
SMP PREEMPT_DYNAMIC
KHO: found kexec handover data.
Kernel command line: 
BOOT_IMAGE=(ieee1275//vdevice/v-scsi@3000006b/disk@8100000000000000,gpt2)/vmlinuz-7.3.0-rc4kho-ppc-upstream+
 root=/dev/mapper/fedora_root ro rd.lvm.lv=fedora
KHO: exec from: 7.3.0-rc4kho-ppc-upstream+ (count 5)
test_kho: KHO restore succeeded

Changelog:
==========

RFC: 
https://lore.kernel.org/all/[email protected]/ 
[1]

v1:
- Drop the first patch from the RFC series, which added KEXEC_FILE as a
  dependency of KEXEC_HANDOVER, and use select instead.
- Replace the SCRATCH_ALIGNMENT_BYTES static assertion with a runtime
  check to fix the build failure on powerpc configurations where
  CMA_MIN_ALIGNMENT_BYTES is not a compile-time constant.
- Remove the CRASH_DUMP dependency from ARCH_SUPPORTS_KEXEC_HANDOVER.
- Reuse the existing early_init_dt_check_kho() function to process the
  KHO FDT properties.

Cc: Aditya Gupta <[email protected]>
Cc: Alexander Graf <[email protected]>
Cc: Andrew Morton <[email protected]>
Cc: Baoquan He <[email protected]>
Cc: Christophe Leroy (CS GROUP) <[email protected]>
Cc: Hari Bathini <[email protected]>
Cc: Madhavan Srinivasan <[email protected]>
Cc: Mahesh Salgaonkar <[email protected]>
Cc: Michael Ellerman <[email protected]>
Cc: Mike Rapoport <[email protected]>
Cc: Nicholas Piggin <[email protected]>
Cc: Pasha Tatashin <[email protected]>
Cc: Pratyush Yadav <[email protected]>
Cc: Ritesh Harjani (IBM) <[email protected]>
Cc: Shivang Upadhyay <[email protected]>
Cc: Shrikanth Hegde <[email protected]>
Cc: [email protected]
Cc: [email protected]

Sourabh Jain (2):
  kho: check scratch vs CMA alignment at runtime
  powerpc: add support for Kexec HandOver (KHO)

 arch/powerpc/Kconfig               |  3 +++
 arch/powerpc/kernel/setup-common.c |  2 ++
 drivers/of/fdt.c                   |  2 +-
 include/linux/of_fdt.h             |  1 +
 kernel/liveupdate/kexec_handover.c | 23 +++++++++++++++--------
 5 files changed, 22 insertions(+), 9 deletions(-)

-- 
2.55.0


Reply via email to