Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/arm pmap_directbase is a failed experiment, nuke it.
details: https://anonhg.NetBSD.org/src/rev/90223102f3ab
branches: trunk
changeset: 338620:90223102f3ab
user: matt <matt%NetBSD.org@localhost>
date: Mon Jun 01 19:16:44 2015 +0000
description:
pmap_directbase is a failed experiment, nuke it.
diffstat:
sys/arch/arm/arm32/arm32_kvminit.c | 57 ++++---------------------------------
sys/arch/arm/arm32/pmap.c | 30 ++++++++-----------
sys/arch/arm/include/arm32/pmap.h | 5 +--
3 files changed, 22 insertions(+), 70 deletions(-)
diffs (213 lines):
diff -r 851d4e2e5c8e -r 90223102f3ab sys/arch/arm/arm32/arm32_kvminit.c
--- a/sys/arch/arm/arm32/arm32_kvminit.c Mon Jun 01 17:16:56 2015 +0000
+++ b/sys/arch/arm/arm32/arm32_kvminit.c Mon Jun 01 19:16:44 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: arm32_kvminit.c,v 1.34 2015/05/30 23:59:33 matt Exp $ */
+/* $NetBSD: arm32_kvminit.c,v 1.35 2015/06/01 19:16:44 matt Exp $ */
/*
* Copyright (c) 2002, 2003, 2005 Genetec Corporation. All rights reserved.
@@ -124,7 +124,7 @@
#include "opt_multiprocessor.h"
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: arm32_kvminit.c,v 1.34 2015/05/30 23:59:33 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: arm32_kvminit.c,v 1.35 2015/06/01 19:16:44 matt Exp $");
#include <sys/param.h>
#include <sys/device.h>
@@ -166,11 +166,6 @@
((paddr_t)((vaddr_t)(va) - KERNEL_BASE_VOFFSET))
#define KERN_PHYSTOV(bmi, pa) \
((vaddr_t)((paddr_t)(pa) + KERNEL_BASE_VOFFSET))
-#elif defined(ARM_MMU_EXTENDED) && defined(__HAVE_MM_MD_DIRECT_MAPPED_PHYS)
-#define KERN_VTOPHYS(bmi, va) \
- ((paddr_t)((vaddr_t)(va) - pmap_directbase + (bmi)->bmi_start))
-#define KERN_PHYSTOV(bmi, pa) \
- ((vaddr_t)((paddr_t)(pa) - (bmi)->bmi_start + pmap_directbase))
#else
#define KERN_VTOPHYS(bmi, va) \
((paddr_t)((vaddr_t)(va) - KERNEL_BASE + (bmi)->bmi_start))
@@ -233,26 +228,7 @@
*/
if (bmi->bmi_start < bmi->bmi_kernelstart) {
pv->pv_pa = bmi->bmi_start;
-#if defined(ARM_MMU_EXTENDED) && defined(__HAVE_MM_MD_DIRECT_MAPPED_PHYS)
- pv->pv_va = pmap_directbase;
-#else
- /*
- * If there's lots of memory the kernel could be placed far
- * from the start of RAM. If that's the case, don't map the
- * RAM that would have virtual addresses below KERNEL_BASE.
- */
- if (pv->pv_pa < KERN_VTOPHYS(bmi, KERNEL_BASE)) {
- psize_t size = KERN_VTOPHYS(bmi, KERNEL_BASE) - pv->pv_pa;
- bmi->bmi_freepages += size / PAGE_SIZE;
-#ifdef VERBOSE_INIT_ARM
- printf("%s: adding %lu free pages: [%#lx..%#lx]\n",
- __func__, size / PAGE_SIZE, pv->pv_va,
- pv->pv_pa + size - 1);
-#endif
- pv->pv_pa = KERN_VTOPHYS(bmi, KERNEL_BASE);
- }
- pv->pv_va = KERNEL_BASE;
-#endif
+ pv->pv_va = KERN_PHYSTOV(bmi, pv->pv_pa);
pv->pv_size = bmi->bmi_kernelstart - pv->pv_pa;
bmi->bmi_freepages += pv->pv_size / PAGE_SIZE;
#ifdef VERBOSE_INIT_ARM
@@ -431,24 +407,9 @@
KASSERT(mapallmem_p);
#ifdef ARM_MMU_EXTENDED
/*
- * We can only use address beneath kernel_vm_base to map physical
- * memory.
- */
- const psize_t physical_size =
- roundup(physical_end - physical_start, L1_SS_SIZE);
- KASSERT(kernel_vm_base >= physical_size);
- /*
- * If we don't have enough memory via TTBR1, we have use addresses
- * from TTBR0 to map some of the physical memory. But try to use as
- * much high memory space as possible.
+ * The direct map VA space ends at the start of the kernel VM space.
*/
pmap_directlimit = kernel_vm_base;
- if (kernel_vm_base - KERNEL_BASE < physical_size
- && kernel_vm_base - physical_size >= physical_start) {
- pmap_directbase -= KERNEL_BASE_VOFFSET;
- printf("%s: changing pmap_directbase to %#lx\n", __func__,
- pmap_directbase);
- }
#else
KASSERT(kernel_vm_base - KERNEL_BASE >= physical_end - physical_start);
#endif /* ARM_MMU_EXTENDED */
@@ -763,15 +724,12 @@
pv_addr_t *pv = SLIST_FIRST(&bmi->bmi_chunks);
if (!mapallmem_p || pv->pv_pa == bmi->bmi_start) {
cur_pv = *pv;
+ KASSERTMSG(cur_pv.pv_va >= KERNEL_BASE, "%#lx", cur_pv.pv_va);
pv = SLIST_NEXT(pv, pv_list);
} else {
-#if defined(ARM_MMU_EXTENDED) && defined(__HAVE_MM_MD_DIRECT_MAPPED_PHYS)
- cur_pv.pv_va = pmap_directbase;
-#else
cur_pv.pv_va = KERNEL_BASE;
-#endif
- cur_pv.pv_pa = bmi->bmi_start;
- cur_pv.pv_size = pv->pv_pa - bmi->bmi_start;
+ cur_pv.pv_pa = KERN_VTOPHYS(bmi, cur_pv.pv_va);
+ cur_pv.pv_size = pv->pv_pa - cur_pv.pv_pa;
cur_pv.pv_prot = VM_PROT_READ | VM_PROT_WRITE;
cur_pv.pv_cache = PTE_CACHE;
}
@@ -881,7 +839,6 @@
/*
* Now we map the stuff that isn't directly after the kernel
*/
-
if (map_vectors_p) {
/* Map the vector page. */
pmap_map_entry(l1pt_va, systempage.pv_va, systempage.pv_pa,
diff -r 851d4e2e5c8e -r 90223102f3ab sys/arch/arm/arm32/pmap.c
--- a/sys/arch/arm/arm32/pmap.c Mon Jun 01 17:16:56 2015 +0000
+++ b/sys/arch/arm/arm32/pmap.c Mon Jun 01 19:16:44 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.323 2015/05/30 23:59:33 matt Exp $ */
+/* $NetBSD: pmap.c,v 1.324 2015/06/01 19:16:44 matt Exp $ */
/*
* Copyright 2003 Wasabi Systems, Inc.
@@ -216,7 +216,7 @@
#include <arm/locore.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.323 2015/05/30 23:59:33 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.324 2015/06/01 19:16:44 matt Exp $");
//#define PMAP_DEBUG
#ifdef PMAP_DEBUG
@@ -514,9 +514,8 @@
#if defined(ARM_MMU_EXTENDED) && defined(__HAVE_MM_MD_DIRECT_MAPPED_PHYS)
/*
- * Start of direct-mapped memory
+ * Virtual end of direct-mapped memory
*/
-vaddr_t pmap_directbase = KERNEL_BASE;
vaddr_t pmap_directlimit;
#endif
@@ -7820,13 +7819,7 @@
*/
if (arm_poolpage_vmfreelist != VM_FREELIST_DEFAULT) {
return uvm_pagealloc_strat(NULL, 0, NULL, flags,
-#if defined(__HAVE_MM_MD_DIRECT_MAPPED_PHYS) && defined(ARM_MMU_EXTENDED)
- (pmap_directbase < KERNEL_BASE
- ? UVM_PGA_STRAT_ONLY
- : UVM_PGA_STRAT_FALLBACK),
-#else
UVM_PGA_STRAT_FALLBACK,
-#endif
arm_poolpage_vmfreelist);
}
@@ -7858,15 +7851,18 @@
{
bool ok = false;
if (physical_start <= pa && pa < physical_end) {
+#ifdef KERNEL_BASE_VOFFSET
+ const vaddr_t newva = pa + KERNEL_BASE_VOFFSET;
+#else
+ const vaddr_t newva = KERNEL_BASE + pa - physical_start;
+#endif
#ifdef ARM_MMU_EXTENDED
- const vaddr_t newva = pmap_directbase + pa - physical_start;
if (newva >= KERNEL_BASE && newva < pmap_directlimit) {
+#endif
va = newva;
ok = true;
+#ifdef ARM_MMU_EXTENDED
}
-#else
- va = KERNEL_BASE + pa - physical_start;
- ok = true;
#endif
}
KASSERT(ok_p);
@@ -7896,12 +7892,12 @@
pmap_unmap_poolpage(vaddr_t va)
{
KASSERT(va >= KERNEL_BASE);
-#if defined(ARM_MMU_EXTENDED)
- return va - pmap_directbase + physical_start;
-#else
#ifdef PMAP_CACHE_VIVT
cpu_idcache_wbinv_range(va, PAGE_SIZE);
#endif
+#if defined(KERNEL_BASE_VOFFSET)
+ return va - KERNEL_BASE_VOFFSET;
+#else
return va - KERNEL_BASE + physical_start;
#endif
}
diff -r 851d4e2e5c8e -r 90223102f3ab sys/arch/arm/include/arm32/pmap.h
--- a/sys/arch/arm/include/arm32/pmap.h Mon Jun 01 17:16:56 2015 +0000
+++ b/sys/arch/arm/include/arm32/pmap.h Mon Jun 01 19:16:44 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.h,v 1.140 2015/05/30 23:59:33 matt Exp $ */
+/* $NetBSD: pmap.h,v 1.141 2015/06/01 19:16:44 matt Exp $ */
/*
* Copyright (c) 2002, 2003 Wasabi Systems, Inc.
@@ -428,9 +428,8 @@
#if defined(ARM_MMU_EXTENDED) && defined(__HAVE_MM_MD_DIRECT_MAPPED_PHYS)
/*
- * Starting VA of direct mapped memory (usually KERNEL_BASE).
+ * Ending VA of direct mapped memory (usually KERNEL_VM_BASE).
*/
-extern vaddr_t pmap_directbase;
extern vaddr_t pmap_directlimit;
#endif
Home |
Main Index |
Thread Index |
Old Index