Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/common/pmap/tlb Add support for PMAP_GROWKERNEL
details: https://anonhg.NetBSD.org/src/rev/c32167689791
branches: trunk
changeset: 779304:c32167689791
user: matt <matt%NetBSD.org@localhost>
date: Thu May 17 16:20:19 2012 +0000
description:
Add support for PMAP_GROWKERNEL
diffstat:
sys/common/pmap/tlb/pmap.c | 48 +++++++++++++++++++++++++++++++--------------
sys/common/pmap/tlb/pmap.h | 3 +-
2 files changed, 35 insertions(+), 16 deletions(-)
diffs (114 lines):
diff -r 95c315bb632e -r c32167689791 sys/common/pmap/tlb/pmap.c
--- a/sys/common/pmap/tlb/pmap.c Thu May 17 07:28:29 2012 +0000
+++ b/sys/common/pmap/tlb/pmap.c Thu May 17 16:20:19 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.12 2012/01/18 07:17:09 skrll Exp $ */
+/* $NetBSD: pmap.c,v 1.13 2012/05/17 16:20:19 matt Exp $ */
/*-
* Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.12 2012/01/18 07:17:09 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.13 2012/05/17 16:20:19 matt Exp $");
/*
* Manages physical address maps.
@@ -220,15 +220,6 @@
struct pmap_limits pmap_limits;
-#ifdef PMAP_POOLPAGE_DEBUG
-struct poolpage_info {
- vaddr_t base;
- vaddr_t size;
- vaddr_t hint;
- pt_entry_t *sysmap;
-} poolpage;
-#endif
-
#ifdef UVMHIST
static struct kern_history_ent pmapexechistbuf[10000];
static struct kern_history_ent pmaphistbuf[10000];
@@ -348,8 +339,34 @@
pmap_virtual_space(vaddr_t *vstartp, vaddr_t *vendp)
{
- *vstartp = VM_MIN_KERNEL_ADDRESS; /* kernel is in K0SEG */
- *vendp = trunc_page(pmap_limits.virtual_end); /* XXX need pmap_growkernel() */
+ *vstartp = VM_MIN_KERNEL_ADDRESS;
+ *vendp = VM_MAX_KERNEL_ADDRESS;
+}
+
+vaddr_t
+pmap_growkernel(vaddr_t maxkvaddr)
+{
+ vaddr_t virtual_end = pmap_limits.virtual_end;
+ maxkvaddr = pmap_round_seg(maxkvaddr) - 1;
+
+ /*
+ * Reserve PTEs for the new KVA space.
+ */
+ for (; virtual_end < maxkvaddr; virtual_end += NBSEG) {
+ pmap_pte_reserve(pmap_kernel(), virtual_end, 0);
+ }
+
+ /*
+ * Don't exceed VM_MAX_KERNEL_ADDRESS!
+ */
+ if (virtual_end == 0 || virtual_end > VM_MAX_KERNEL_ADDRESS)
+ virtual_end = VM_MAX_KERNEL_ADDRESS;
+
+ /*
+ * Update new end.
+ */
+ pmap_limits.virtual_end = virtual_end;
+ return virtual_end;
}
/*
@@ -414,7 +431,7 @@
sizeof(*seg) * (vm_nphysseg - bank));
}
- va = pmap_md_direct_map_paddr(pa);
+ va = pmap_md_map_poolpage(pa, size);
memset((void *)va, 0, size);
return va;
}
@@ -1828,7 +1845,7 @@
struct vm_page_md * const mdpg = VM_PAGE_TO_MD(pg);
pmap_page_set_attributes(mdpg, VM_PAGEMD_POOLPAGE);
- const vaddr_t va = pmap_md_direct_map_paddr(pa);
+ const vaddr_t va = pmap_md_map_poolpage(pa, NBPG);
pmap_md_vca_add(pg, va, NULL);
return va;
}
@@ -1844,6 +1861,7 @@
KASSERT(pg);
struct vm_page_md * const mdpg = VM_PAGE_TO_MD(pg);
pmap_page_clear_attributes(mdpg, VM_PAGEMD_POOLPAGE);
+ pmap_md_unmap_poolpage(va, NBPG);
pmap_md_vca_remove(pg, va);
return pa;
diff -r 95c315bb632e -r c32167689791 sys/common/pmap/tlb/pmap.h
--- a/sys/common/pmap/tlb/pmap.h Thu May 17 07:28:29 2012 +0000
+++ b/sys/common/pmap/tlb/pmap.h Thu May 17 16:20:19 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.h,v 1.11 2011/10/13 19:50:39 matt Exp $ */
+/* $NetBSD: pmap.h,v 1.12 2012/05/17 16:20:19 matt Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -253,6 +253,7 @@
uint16_t pmap_pvlist_lock(struct vm_page_md *, bool);
#define PMAP_STEAL_MEMORY /* enable pmap_steal_memory() */
+#define PMAP_GROWKERNEL /* enable pmap_growkernel() */
/*
* Alternate mapping hooks for pool pages. Avoids thrashing the TLB.
Home |
Main Index |
Thread Index |
Old Index