Skip to content

Commit 1fd6c02

Browse files
committed
powerpc/mm: Add a CONFIG option to choose if radix is used by default
Currently if the hardware supports the radix MMU we will use it, *unless* "disable_radix" is passed on the kernel command line. However some users would like the reverse semantics. ie. The kernel uses the hash MMU by default, unless radix is explicitly requested on the command line. So add a CONFIG option to choose whether we use radix by default or not, and expand the disable_radix command line option to allow "disable_radix=no" which *enables* radix. Signed-off-by: Michael Ellerman <[email protected]>
1 parent 4e00374 commit 1fd6c02

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

arch/powerpc/mm/init_64.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -368,10 +368,19 @@ EXPORT_SYMBOL_GPL(realmode_pfn_to_page);
368368
#endif /* CONFIG_SPARSEMEM_VMEMMAP */
369369

370370
#ifdef CONFIG_PPC_BOOK3S_64
371-
static bool disable_radix;
371+
static bool disable_radix = !IS_ENABLED(CONFIG_PPC_RADIX_MMU_DEFAULT);
372+
372373
static int __init parse_disable_radix(char *p)
373374
{
374-
disable_radix = true;
375+
bool val;
376+
377+
if (strlen(p) == 0)
378+
val = true;
379+
else if (kstrtobool(p, &val))
380+
return -EINVAL;
381+
382+
disable_radix = val;
383+
375384
return 0;
376385
}
377386
early_param("disable_radix", parse_disable_radix);

arch/powerpc/platforms/Kconfig.cputype

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,19 @@ config PPC_RADIX_MMU
304304
is only implemented by IBM Power9 CPUs, if you don't have one of them
305305
you can probably disable this.
306306

307+
config PPC_RADIX_MMU_DEFAULT
308+
bool "Default to using the Radix MMU when possible"
309+
depends on PPC_RADIX_MMU
310+
default y
311+
help
312+
When the hardware supports the Radix MMU, default to using it unless
313+
"disable_radix[=yes]" is specified on the kernel command line.
314+
315+
If this option is disabled, the Hash MMU will be used by default,
316+
unless "disable_radix=no" is specified on the kernel command line.
317+
318+
If you're unsure, say Y.
319+
307320
config ARCH_ENABLE_HUGEPAGE_MIGRATION
308321
def_bool y
309322
depends on PPC_BOOK3S_64 && HUGETLB_PAGE && MIGRATION

0 commit comments

Comments
 (0)