Re: [PATCH v2 4/4] powerpc/kdump: add support for high crashkernel reservation
Sourabh Jain <[email protected]> Mon, 3 Aug 2026 09:40:38 +0530
| Newsgroups | org.ozlabs.lists.linuxppc-dev |
|---|---|
| Message-ID | <[email protected]> |
On 26/07/26 16:53, Hari Bathini wrote: > > > On 08/07/26 8:03 pm, Sourabh Jain wrote: >> With this changes included crashkernel=xxM,high will be supported on >> powerpc. This allow user to allocated crashkernel memory on higer memory >> region and keeping the low memory allocation minimal. >> >> The low memory reservation is by default set to 64 MB and it is reserved >> below RTAS_INSTANTIATE_MAX (1G) to make sure rtas instantiation work >> properly. >> >> powerpc uses generic crashkernel parser and reserve functions and they >> are capable of handling high crashkernel reservtion so >> arch_reserve_crashkernel() is updated call generic crashkernel praser >> and reserve function with resptive options to make >> crashkernel=XXM,high prase and make crashkernel memory get reserved on >> higher memory regions. >> >> Note: High crashkernel is supported only on PPC 64-bit systems when >> 64-bit RTAS is instantiated and Radix MMU is enabled; otherwise, the >> crashkernel reservation falls back to the default, even if the kernel >> command includes crashkernel=XXM,high. >> >> Signed-off-by: Sourabh Jain <[email protected]> >> --- >> arch/powerpc/include/asm/crash_reserve.h | 6 ++++ >> arch/powerpc/include/asm/kexec.h | 1 + >> arch/powerpc/include/asm/rtas.h | 9 +++++ >> arch/powerpc/kexec/core.c | 45 +++++++++++++++++------- >> 4 files changed, 49 insertions(+), 12 deletions(-) >> >> diff --git a/arch/powerpc/include/asm/crash_reserve.h >> b/arch/powerpc/include/asm/crash_reserve.h >> index d1b570ddbf98..4f2096984736 100644 >> --- a/arch/powerpc/include/asm/crash_reserve.h >> +++ b/arch/powerpc/include/asm/crash_reserve.h >> @@ -2,6 +2,8 @@ >> #ifndef _ASM_POWERPC_CRASH_RESERVE_H >> #define _ASM_POWERPC_CRASH_RESERVE_H >> +#include <asm/rtas.h> >> + >> /* crash kernel regions are Page size agliged */ >> #define CRASH_ALIGN PAGE_SIZE >> @@ -12,5 +14,9 @@ static inline bool arch_add_crash_res_to_iomem(void) >> } >> #define arch_add_crash_res_to_iomem arch_add_crash_res_to_iomem >> #endif >> +#define DEFAULT_CRASH_KERNEL_LOW_SIZE SZ_64M >> + >> +#define CRASH_ADDR_LOW_MAX RTAS_INSTANTIATE_MAX >> +#define CRASH_ADDR_HIGH_MAX memblock_end_of_DRAM() >> #endif /* _ASM_POWERPC_CRASH_RESERVE_H */ >> diff --git a/arch/powerpc/include/asm/kexec.h >> b/arch/powerpc/include/asm/kexec.h >> index e02710d6a2e1..9e676bd3bf03 100644 >> --- a/arch/powerpc/include/asm/kexec.h >> +++ b/arch/powerpc/include/asm/kexec.h >> @@ -118,6 +118,7 @@ int setup_new_fdt_ppc64(const struct kimage >> *image, void *fdt, struct crash_mem >> int __init overlaps_crashkernel(unsigned long start, unsigned long >> size); >> extern void arch_reserve_crashkernel(void); >> extern void kdump_cma_reserve(void); >> +unsigned long long __init get_crash_base(unsigned long long >> crash_base); >> #else >> static inline void arch_reserve_crashkernel(void) {} >> static inline int overlaps_crashkernel(unsigned long start, >> unsigned long size) { return 0; } >> diff --git a/arch/powerpc/include/asm/rtas.h >> b/arch/powerpc/include/asm/rtas.h >> index aaa4c3bc1d61..d290437d8131 100644 >> --- a/arch/powerpc/include/asm/rtas.h >> +++ b/arch/powerpc/include/asm/rtas.h >> @@ -561,6 +561,14 @@ static inline int page_is_rtas_user_buf(unsigned >> long pfn) >> return 0; >> } >> +static inline bool is_rtas_high_crashkernel_capable(void) >> +{ >> + if (rtas_64) >> + return true; >> + >> + return false; >> +} >> + >> /* Not the best place to put pSeries_coalesce_init, will be fixed >> when we >> * move some of the rtas suspend-me stuff to pseries */ >> void pSeries_coalesce_init(void); >> @@ -569,6 +577,7 @@ void rtas_initialize(void); >> static inline int page_is_rtas_user_buf(unsigned long pfn) { return >> 0;} >> static inline void pSeries_coalesce_init(void) { } >> static inline void rtas_initialize(void) { } > >> +static inline bool is_rtas_high_crashkernel_capable(void) { return >> true; } > > Though !CONFIG_PPC_RTAS may imply radix MMU and high crashkernel > capable, is_rtas_high_crashkernel_capable() returning true for > !CONFIG_PPC_RTAS case seems counter-intuitive. > >> #endif >> #ifdef CONFIG_HV_PERF_CTRS >> diff --git a/arch/powerpc/kexec/core.c b/arch/powerpc/kexec/core.c >> index dc44f11be353..81fc437377c8 100644 >> --- a/arch/powerpc/kexec/core.c >> +++ b/arch/powerpc/kexec/core.c >> @@ -15,6 +15,7 @@ >> #include <linux/irq.h> >> #include <linux/ftrace.h> >> +#include <asm/rtas.h> >> #include <asm/kdump.h> >> #include <asm/machdep.h> >> #include <asm/pgalloc.h> >> @@ -64,7 +65,7 @@ void machine_kexec(struct kimage *image) >> static unsigned long long crashk_cma_size; >> -static unsigned long long __init get_crash_base(unsigned long long >> crash_base) >> +unsigned long long __init get_crash_base(unsigned long long crash_base) >> { >> #ifndef CONFIG_NONSTATIC_KERNEL >> @@ -104,35 +105,55 @@ static unsigned long long __init >> get_crash_base(unsigned long long crash_base) >> #endif >> } > >> +static bool high_crashkernel_supported(void) >> +{ >> +#if defined(CONFIG_PPC64) && (defined(CONFIG_PPC_PSERIES) || >> defined(CONFIG_PPC_POWERNV)) >> + if (early_radix_enabled() && is_rtas_high_crashkernel_capable()) >> + return true; >> +#endif >> + return false; >> +} > > Have this function that accounts for high crashkernel support in > different scenarios and drop is_rtas_high_crashkernel_capable()? Agree. - Sourabh Jain