From: Sourabh Jain <sourabhjain@linux.ibm.com>
To: Hari Bathini <hbathini@linux.ibm.com>,
linuxppc-dev@lists.ozlabs.org, maddy@linux.ibm.com,
mpe@ellerman.id.au
Cc: npiggin@gmail.com, chleroy@kernel.org, ritesh.list@gmail.com,
shivangu@linux.ibm.com, mahesh@linux.ibm.com,
adityag@linux.ibm.com, venkat88@linux.ibm.com
Subject: Re: [PATCH v2 1/4] powerpc/mmu: do MMU type discovery before crashkernel reservation
Date: Mon, 3 Aug 2026 09:15:03 +0530 [thread overview]
Message-ID: <da03ca94-d602-42d3-a0ae-7c7ee63a6b38@linux.ibm.com> (raw)
In-Reply-To: <ad7e2f73-d3c6-4696-b596-9c1c1da05a9f@linux.ibm.com>
On 26/07/26 16:24, Hari Bathini wrote:
> Couple of minor nits below..
>
> On 08/07/26 8:03 pm, Sourabh Jain wrote:
>> Crashkernel reservation on high memory depends on the MMU type, so
>> finalize the MMU type before calling arch_reserve_crashkernel().
>>
>> With the changes introduced here, early_radix_enabled() becomes usable
>> and will be used in arch_reserve_crashkernel() in the upcoming patch.
>>
>> early_radix_enabled() depends on cur_cpu_spec->mmu_features to find
>> out if the radix MMU is enabled. The radix MMU bit in mmu_features is
>> discovered from the FDT and kernel configs. To make sure the MMU type is
>> finalized before arch_reserve_crashkernel() is called, the function that
>> scans the FDT and sets mmu_features, along with some bits from
>> mmu_early_type_finalize(), has been moved above
>> arch_reserve_crashkernel().
>>
>> Signed-off-by: Sourabh Jain <sourabhjain@linux.ibm.com>
>> ---
>> arch/powerpc/include/asm/book3s/64/mmu.h | 1 +
>> arch/powerpc/include/asm/mmu.h | 1 +
>> arch/powerpc/kernel/prom.c | 28 +++++++++++++-----------
>> arch/powerpc/mm/init_64.c | 27 ++++++++++++++---------
>> 4 files changed, 34 insertions(+), 23 deletions(-)
>>
>> diff --git a/arch/powerpc/include/asm/book3s/64/mmu.h
>> b/arch/powerpc/include/asm/book3s/64/mmu.h
>> index 48631365b48c..7a3b2ff02041 100644
>> --- a/arch/powerpc/include/asm/book3s/64/mmu.h
>> +++ b/arch/powerpc/include/asm/book3s/64/mmu.h
>> @@ -208,6 +208,7 @@ extern int mmu_vmemmap_psize;
>> /* MMU initialization */
>> void mmu_early_init_devtree(void);
>> +void mmu_early_type_finalize(void);
>> void hash__early_init_devtree(void);
>> void radix__early_init_devtree(void);
>> #ifdef CONFIG_PPC_PKEY
>> diff --git a/arch/powerpc/include/asm/mmu.h
>> b/arch/powerpc/include/asm/mmu.h
>> index 5f9c5d436e17..c40dc6349e55 100644
>> --- a/arch/powerpc/include/asm/mmu.h
>> +++ b/arch/powerpc/include/asm/mmu.h
>> @@ -384,6 +384,7 @@ extern void early_init_mmu_secondary(void);
>> extern void setup_initial_memory_limit(phys_addr_t
>> first_memblock_base,
>> phys_addr_t first_memblock_size);
>> static inline void mmu_early_init_devtree(void) { }
>> +static inline void mmu_early_type_finalize(void) { }
>> static inline void pkey_early_init_devtree(void) {}
>> diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
>> index 9ed9dde7d231..db1615f26075 100644
>> --- a/arch/powerpc/kernel/prom.c
>> +++ b/arch/powerpc/kernel/prom.c
>> @@ -853,6 +853,21 @@ void __init early_init_devtree(void *params)
>> if (PHYSICAL_START > MEMORY_START)
>> memblock_reserve(MEMORY_START, int_vector_size);
>> reserve_kdump_trampoline();
>> +
>> + DBG("Scanning CPUs ...\n");
>> +
>> + dt_cpu_ftrs_scan();
>> +
>> + /* Retrieve CPU related informations from the flat tree
>> + * (altivec support, boot CPU ID, ...)
>> + */
>> + of_scan_flat_dt(early_init_dt_scan_cpus, NULL);
>> + if (boot_cpuid < 0) {
>> + printk("Failed to identify boot CPU !\n");
>> + BUG();
>> + }
>> +
>
>> + mmu_early_type_finalize();
>> #if defined(CONFIG_FA_DUMP) || defined(CONFIG_PRESERVE_FA_DUMP)
>
> Please add a blank line here
>
>> /*
>> * If we fail to reserve memory for firmware-assisted dump then
>> @@ -884,19 +899,6 @@ void __init early_init_devtree(void *params)
>> * FIXME .. and the initrd too? */
>> move_device_tree();
>> - DBG("Scanning CPUs ...\n");
>> -
>> - dt_cpu_ftrs_scan();
>> -
>> - /* Retrieve CPU related informations from the flat tree
>> - * (altivec support, boot CPU ID, ...)
>> - */
>> - of_scan_flat_dt(early_init_dt_scan_cpus, NULL);
>> - if (boot_cpuid < 0) {
>> - printk("Failed to identify boot CPU !\n");
>> - BUG();
>> - }
>> -
>> save_fscr_to_task();
>> #if defined(CONFIG_SMP) && defined(CONFIG_PPC64)
>> diff --git a/arch/powerpc/mm/init_64.c b/arch/powerpc/mm/init_64.c
>> index 64f0df5bb5cd..2fd533bc17cc 100644
>> --- a/arch/powerpc/mm/init_64.c
>> +++ b/arch/powerpc/mm/init_64.c
>> @@ -614,8 +614,10 @@ static void __init
>> early_init_memory_block_size(void)
>> of_scan_flat_dt(probe_memory_block_size, &memory_block_size);
>> }
>> -void __init mmu_early_init_devtree(void)
>> +
>
>> +void __init mmu_early_type_finalize(void)
>> {
>> +
>
> Please remove this extra blank line
>
>> bool hvmode = !!(mfmsr() & MSR_HV);
>> /* Disable radix mode based on kernel command line. */
>> @@ -626,6 +628,20 @@ void __init mmu_early_init_devtree(void)
>> pr_warn("WARNING: Ignoring cmdline option
>> disable_radix\n");
>> }
>> + /*
>> + * Check /chosen/ibm,architecture-vec-5 if running as a guest.
>> + * When running bare-metal, we can use radix if we like
>> + * even though the ibm,architecture-vec-5 property created by
>> + * skiboot doesn't have the necessary bits set.
>> + */
>> + if (!hvmode)
>> + early_check_vec5();
>> +}
>> +
>> +void __init mmu_early_init_devtree(void)
>> +{
>> + bool hvmode = !!(mfmsr() & MSR_HV);
>> +
>> of_scan_flat_dt(dt_scan_mmu_pid_width, NULL);
>> if (hvmode && !mmu_lpid_bits) {
>> if (early_cpu_has_feature(CPU_FTR_ARCH_207S))
>> @@ -638,15 +654,6 @@ void __init mmu_early_init_devtree(void)
>> mmu_pid_bits = 20; /* POWER9-10 */
>> }
>> - /*
>> - * Check /chosen/ibm,architecture-vec-5 if running as a guest.
>> - * When running bare-metal, we can use radix if we like
>> - * even though the ibm,architecture-vec-5 property created by
>> - * skiboot doesn't have the necessary bits set.
>> - */
>> - if (!hvmode)
>> - early_check_vec5();
>> -
>> early_init_memory_block_size();
>> if (early_radix_enabled()) {
I will address the above comments in the next version.
Thanks for the review Hari.
- Sourabh Jain
next prev parent reply other threads:[~2026-08-03 3:45 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-08 14:33 [PATCH v2 0/4] powerpc/kdump: Support high crashkernel reservation Sourabh Jain
2026-07-08 14:33 ` [PATCH v2 1/4] powerpc/mmu: do MMU type discovery before " Sourabh Jain
2026-07-10 2:44 ` Ritesh Harjani
2026-07-13 13:12 ` Sourabh Jain
2026-07-26 10:54 ` Hari Bathini
2026-08-03 3:45 ` Sourabh Jain [this message]
2026-07-08 14:33 ` [PATCH v2 2/4] powerpc: move to 64-bit RTAS Sourabh Jain
2026-07-26 10:55 ` Hari Bathini
2026-08-03 3:56 ` Sourabh Jain
2026-07-08 14:33 ` [PATCH v2 3/4] powerpc/kdump: consider high crashkernel memory if enabled Sourabh Jain
2026-07-08 14:33 ` [PATCH v2 4/4] powerpc/kdump: add support for high crashkernel reservation Sourabh Jain
2026-07-26 10:56 ` Hari Bathini
2026-08-03 4:09 ` Sourabh Jain
2026-07-26 11:23 ` Hari Bathini
2026-08-03 4:10 ` Sourabh Jain
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=da03ca94-d602-42d3-a0ae-7c7ee63a6b38@linux.ibm.com \
--to=sourabhjain@linux.ibm.com \
--cc=adityag@linux.ibm.com \
--cc=chleroy@kernel.org \
--cc=hbathini@linux.ibm.com \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=maddy@linux.ibm.com \
--cc=mahesh@linux.ibm.com \
--cc=mpe@ellerman.id.au \
--cc=npiggin@gmail.com \
--cc=ritesh.list@gmail.com \
--cc=shivangu@linux.ibm.com \
--cc=venkat88@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox