diff options
author | Nicholas Piggin <npiggin@gmail.com> | 2021-12-02 00:41:46 +1000 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2021-12-02 22:57:23 +1100 |
commit | ffbe5d21d10f9c7890c07fca17db772f941385bf (patch) | |
tree | 893cb1c0e436b566ae026161181d8cde562b34f5 | |
parent | f43d2ffb47c9e86f5ec24e1de6ce6da6808634a2 (diff) | |
download | lwn-ffbe5d21d10f9c7890c07fca17db772f941385bf.tar.gz lwn-ffbe5d21d10f9c7890c07fca17db772f941385bf.zip |
powerpc/64: pcpu setup avoid reading mmu_linear_psize on 64e or radix
Radix never sets mmu_linear_psize so it's always 4K, which causes pcpu
atom_size to always be PAGE_SIZE. 64e sets it to 1GB always.
Make paths for these platforms to be explicit about what value they set
atom_size to.
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20211201144153.2456614-12-npiggin@gmail.com
-rw-r--r-- | arch/powerpc/kernel/setup_64.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c index 6052f5d5ded3..9a493796ce66 100644 --- a/arch/powerpc/kernel/setup_64.c +++ b/arch/powerpc/kernel/setup_64.c @@ -880,14 +880,23 @@ void __init setup_per_cpu_areas(void) int rc = -EINVAL; /* - * Linear mapping is one of 4K, 1M and 16M. For 4K, no need - * to group units. For larger mappings, use 1M atom which - * should be large enough to contain a number of units. + * BookE and BookS radix are historical values and should be revisited. */ - if (mmu_linear_psize == MMU_PAGE_4K) + if (IS_ENABLED(CONFIG_PPC_BOOK3E)) { + atom_size = SZ_1M; + } else if (radix_enabled()) { atom_size = PAGE_SIZE; - else - atom_size = 1 << 20; + } else { + /* + * Linear mapping is one of 4K, 1M and 16M. For 4K, no need + * to group units. For larger mappings, use 1M atom which + * should be large enough to contain a number of units. + */ + if (mmu_linear_psize == MMU_PAGE_4K) + atom_size = PAGE_SIZE; + else + atom_size = SZ_1M; + } if (pcpu_chosen_fc != PCPU_FC_PAGE) { rc = pcpu_embed_first_chunk(0, dyn_size, atom_size, pcpu_cpu_distance, |