git: a312b0f77cee - stable/13 - powerpc64: make radix with superpages default

From: Leandro Lupori <luporl_at_FreeBSD.org>
Date: Tue, 04 Oct 2022 16:29:41 UTC
The branch stable/13 has been updated by luporl:

URL: https://cgit.FreeBSD.org/src/commit/?id=a312b0f77cee6ce382c743ca99d6264f1f828b40

commit a312b0f77cee6ce382c743ca99d6264f1f828b40
Author:     Leandro Lupori <luporl@FreeBSD.org>
AuthorDate: 2021-10-14 16:13:27 +0000
Commit:     Leandro Lupori <luporl@FreeBSD.org>
CommitDate: 2022-10-04 16:24:15 +0000

    powerpc64: make radix with superpages default
    
    As Radix MMU with superpages enabled is now stable, make it the
    default choice on supported hardware (POWER9 and above), since its
    performance is greater than that of HPT MMU.
    
    Reviewed by:            alfredo, jhibbits
    Sponsored by:           Instituto de Pesquisas Eldorado (eldorado.org.br)
    Differential Revision:  https://reviews.freebsd.org/D30797
    
    (cherry picked from commit 8ecf9a8bab608c26cb100f393b24e883a706ff03)
---
 stand/powerpc/ofw/cas.c             | 6 +++---
 sys/powerpc/aim/aim_machdep.c       | 4 +++-
 sys/powerpc/powerpc/pmap_dispatch.c | 2 +-
 3 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/stand/powerpc/ofw/cas.c b/stand/powerpc/ofw/cas.c
index eaf69566fca7..0a12f31d1a1a 100644
--- a/stand/powerpc/ofw/cas.c
+++ b/stand/powerpc/ofw/cas.c
@@ -234,10 +234,10 @@ ppc64_cas(void)
 		}
 	}
 
-	if (radix_mmu && (var = getenv("radix_mmu")) != NULL && var[0] != '0')
-		ov5[OV5_MMU_INDEX] = OV5_MMU_RADIX;
-	else
+	if ((var = getenv("radix_mmu")) != NULL && var[0] == '0')
 		radix_mmu = 0;
+	if (radix_mmu)
+		ov5[OV5_MMU_INDEX] = OV5_MMU_RADIX;
 
 	inst = OF_open("/");
 	if (inst == -1) {
diff --git a/sys/powerpc/aim/aim_machdep.c b/sys/powerpc/aim/aim_machdep.c
index 8600c1387e16..b8e797913408 100644
--- a/sys/powerpc/aim/aim_machdep.c
+++ b/sys/powerpc/aim/aim_machdep.c
@@ -586,8 +586,10 @@ pmap_early_io_map_init(void)
 {
 	if ((cpu_features2 & PPC_FEATURE2_ARCH_3_00) == 0)
 		radix_mmu = 0;
-	else
+	else {
+		radix_mmu = 1;
 		TUNABLE_INT_FETCH("radix_mmu", &radix_mmu);
+	}
 
 	/*
 	 * When using Radix, set the start and end of kva early, to be able to
diff --git a/sys/powerpc/powerpc/pmap_dispatch.c b/sys/powerpc/powerpc/pmap_dispatch.c
index a3c227bbde7d..00d4a2074327 100644
--- a/sys/powerpc/powerpc/pmap_dispatch.c
+++ b/sys/powerpc/powerpc/pmap_dispatch.c
@@ -83,7 +83,7 @@ int vm_level_0_order = 9;
 
 SYSCTL_NODE(_vm, OID_AUTO, pmap, CTLFLAG_RD, 0, "VM/pmap parameters");
 
-int superpages_enabled = 0;
+int superpages_enabled = 1;
 SYSCTL_INT(_vm_pmap, OID_AUTO, superpages_enabled, CTLFLAG_RDTUN,
     &superpages_enabled, 0, "Enable support for transparent superpages");