Add support for reserving crashkernel memory in higher address ranges
using the crashkernel=xxM,high command-line option.

With this feature, most of the crashkernel memory for kdump is reserved
in high memory regions, while only a small portion (64 MB) is reserved
in low memory for RTAS usage. This helps free up low memory for other
components that require allocations in that region.

For example, if crashkernel=2G,high is specified, the kernel reserves
2 GB of crashkernel memory near the end of system RAM and an additional
64 MB of low memory (below 1 GB) for RTAS to function properly.

Currently, this feature is supported only on PPC64 systems with:
64-bit RTAS support
Radix MMU enabled

HASH MMU is currently not supported because kexec segments are loaded
into higher memory by default when using high crashkernel reservation,
and HASH MMU does not support booting kernels loaded at higher memory
addresses.

To support this feature:

- CPU feature discovery is moved before crashkernel reservation so the
  MMU type is known before selecting crashkernel regions. (Patch 01/04)
- RTAS argument handling, allowing RTAS to correctly return to kernel
  addresses above 4 GB. (Patch 02/04)

This patch series leverages the new firmware capability property
("ibm,rtas-64-capable") to enable 64-bit RTAS support and significantly
changes RTAS call handling. Feedback is requested, particularly on the
overall approach and implementation of the 64-bit RTAS support.

- The approach used for enabling 64-bit RTAS support
- The handling and conversion of RTAS arguments for 64-bit RTAS calls
- The RTAS call flow and MSR handling in 64-bit mode

The new DT property "ibm,rtas-64-capable" is currently not described in
PAPR.

Changes since v1:
https://lore.kernel.org/all/[email protected]/

- Detect 64-bit RTAS capability using "ibm,rtas-64-capable" instead of
  relying on instantiate-rtas-64 failure handling
- Add proper 64-bit RTAS argument structure conversion and return value
  handling
- Add dedicated 64-bit RTAS entry path
- Read the actual "linux,rtas-64" DT property value instead of checking
  only property presence
- Simplify rtas_64 initialization and tracking

Sourabh Jain (4):
  powerpc/mmu: do MMU type discovery before crashkernel reservation
  powerpc: move to 64-bit RTAS
  powerpc/kdump: consider high crashkernel memory if enabled
  powerpc/kdump: add support for high crashkernel reservation

 arch/powerpc/include/asm/book3s/64/mmu.h |  1 +
 arch/powerpc/include/asm/crash_reserve.h |  6 +++
 arch/powerpc/include/asm/kexec.h         |  1 +
 arch/powerpc/include/asm/mmu.h           |  1 +
 arch/powerpc/include/asm/rtas-types.h    |  8 ++++
 arch/powerpc/include/asm/rtas.h          | 11 ++++++
 arch/powerpc/kernel/prom.c               | 28 +++++++-------
 arch/powerpc/kernel/prom_init.c          | 20 ++++++++--
 arch/powerpc/kernel/rtas.c               | 48 ++++++++++++++++++++++--
 arch/powerpc/kernel/rtas_entry.S         | 17 ++++++++-
 arch/powerpc/kexec/core.c                | 45 ++++++++++++++++------
 arch/powerpc/kexec/elf_64.c              | 10 +++--
 arch/powerpc/kexec/file_load_64.c        |  5 ++-
 arch/powerpc/kexec/ranges.c              | 24 ++++++++++--
 arch/powerpc/mm/init_64.c                | 27 ++++++++-----
 15 files changed, 202 insertions(+), 50 deletions(-)

-- 
2.52.0


Reply via email to