Module Name:    src
Committed By:   skrll
Date:           Sat Jan 25 16:19:30 UTC 2020

Modified Files:
        src/sys/arch/arm/arm32: pmap.c

Log Message:
A fix and an optimisation to pmap_l1tt_free
- in the !__HAVE_MM_MD_DIRECT_MAPPED_PHYS case pass UVM_KMF_WIRED so that
  the mappings are removed and the KVA is released.  Fixes the KASSERT
  seen in the automated test runs.
- in the __HAVE_MM_MD_DIRECT_MAPPED_PHYS case we can work out pa much
  easier than caling pmap_extract.


To generate a diff of this commit:
cvs rdiff -u -r1.381 -r1.382 src/sys/arch/arm/arm32/pmap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/arm32/pmap.c
diff -u src/sys/arch/arm/arm32/pmap.c:1.381 src/sys/arch/arm/arm32/pmap.c:1.382
--- src/sys/arch/arm/arm32/pmap.c:1.381	Sun Jan 19 10:59:56 2020
+++ src/sys/arch/arm/arm32/pmap.c	Sat Jan 25 16:19:29 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.381 2020/01/19 10:59:56 skrll Exp $	*/
+/*	$NetBSD: pmap.c,v 1.382 2020/01/25 16:19:29 skrll Exp $	*/
 
 /*
  * Copyright 2003 Wasabi Systems, Inc.
@@ -221,7 +221,7 @@
 #include <arm/db_machdep.h>
 #endif
 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.381 2020/01/19 10:59:56 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.382 2020/01/25 16:19:29 skrll Exp $");
 
 //#define PMAP_DEBUG
 #ifdef PMAP_DEBUG
@@ -6627,12 +6627,13 @@ pmap_l1tt_free(struct pool *pp, void *v)
 	vaddr_t va = (vaddr_t)v;
 
 #if !defined( __HAVE_MM_MD_DIRECT_MAPPED_PHYS)
-	uvm_km_free(kernel_map, va, L1TT_SIZE, 0);
+	uvm_km_free(kernel_map, va, L1TT_SIZE, UVM_KMF_WIRED);
 #else
-	paddr_t pa;
-
-	bool ok = pmap_extract(pmap_kernel(), va, &pa);
-	KASSERT(ok);
+#if defined(KERNEL_BASE_VOFFSET)
+	paddr_t pa = va - KERNEL_BASE_VOFFSET;
+#else
+	paddr_t pa = va - KERNEL_BASE + physical_start;
+#endif
 	const paddr_t epa = pa + L1TT_SIZE;
 
 	for (; pa < epa; pa += PAGE_SIZE) {

Reply via email to