From 62c9789faf5920d426759b0f0df158a585fc84e5 Mon Sep 17 00:00:00 2001 From: miod Date: Tue, 10 Jan 2023 17:38:10 +0000 Subject: [PATCH] In pmap_bootstrap, when importing the PROM translations into the kernel pmap, be sure to clear all software bits from the TTEs, for these bits will have different meanings in OpenBSD. Tested on a large set of sun4u and sun4v systems of different eras to not cause any regression, should be safe enough. --- sys/arch/sparc64/sparc64/pmap.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/sys/arch/sparc64/sparc64/pmap.c b/sys/arch/sparc64/sparc64/pmap.c index 3800557252a..2903f1a59ee 100644 --- a/sys/arch/sparc64/sparc64/pmap.c +++ b/sys/arch/sparc64/sparc64/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.106 2022/09/10 20:35:29 miod Exp $ */ +/* $OpenBSD: pmap.c,v 1.107 2023/01/10 17:38:10 miod Exp $ */ /* $NetBSD: pmap.c,v 1.107 2001/08/31 16:47:41 eeh Exp $ */ /* * @@ -1074,6 +1074,7 @@ remap_data: if (prom_map[i].vstart && ((prom_map[i].vstart>>32) == 0)) { for (j = 0; j < prom_map[i].vsize; j += NBPG) { int k; + uint64_t tte; for (k = 0; page_size_map[k].mask; k++) { if (((prom_map[i].vstart | @@ -1084,9 +1085,14 @@ remap_data: break; } /* Enter PROM map into pmap_kernel() */ + tte = prom_map[i].tte; + if (CPU_ISSUN4V) + tte &= ~SUN4V_TLB_SOFT_MASK; + else + tte &= ~(SUN4U_TLB_SOFT2_MASK | + SUN4U_TLB_SOFT_MASK); pmap_enter_kpage(prom_map[i].vstart + j, - (prom_map[i].tte + j)|data| - page_size_map[k].code); + (tte + j) | data | page_size_map[k].code); } } } -- 2.20.1