Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/mips When using 16KB pages in a 64 bit kernel, the ...



details:   https://anonhg.NetBSD.org/src/rev/adb7767a3332
branches:  trunk
changeset: 768674:adb7767a3332
user:      matt <matt%NetBSD.org@localhost>
date:      Wed Aug 24 16:01:53 2011 +0000

description:
When using 16KB pages in a 64 bit kernel, the amount of address space our page
table can address can be larger than the amount of address space the CPU
implementation supports.  This change limits the amount address space to what
the CPU implementation provides.

diffstat:

 sys/arch/mips/include/vmparam.h   |  12 ++++++++++--
 sys/arch/mips/mips/mips_machdep.c |  18 ++++++++++++++++--
 2 files changed, 26 insertions(+), 4 deletions(-)

diffs (79 lines):

diff -r 7c390c7e2611 -r adb7767a3332 sys/arch/mips/include/vmparam.h
--- a/sys/arch/mips/include/vmparam.h   Wed Aug 24 15:11:52 2011 +0000
+++ b/sys/arch/mips/include/vmparam.h   Wed Aug 24 16:01:53 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vmparam.h,v 1.49 2011/07/21 23:03:39 macallan Exp $    */
+/*     $NetBSD: vmparam.h,v 1.50 2011/08/24 16:01:53 matt Exp $        */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -155,7 +155,12 @@
  */
 #define VM_MIN_ADDRESS         ((vaddr_t)0x00000000)
 #ifdef _LP64
-#define VM_MAXUSER_ADDRESS     ((vaddr_t) 1L << (4*PGSHIFT-8))
+#define MIPS_VM_MAXUSER_ADDRESS        ((vaddr_t) 1L << (4*PGSHIFT-8))
+#ifdef ENABLE_MIPS_16KB_PAGE
+#define VM_MAXUSER_ADDRESS     mips_vm_maxuser_address
+#else
+#define VM_MAXUSER_ADDRESS     MIPS_VM_MAXUSER_ADDRESS
+#endif
                                                        /* 0x0000010000000000 */
 #define VM_MAX_ADDRESS         VM_MAXUSER_ADDRESS
 #define VM_MIN_KERNEL_ADDRESS  ((vaddr_t) 3L << 62)    /* 0xC000000000000000 */
@@ -197,6 +202,9 @@
 #ifdef _KERNEL
 #define        UVM_KM_VMFREELIST       mips_poolpage_vmfreelist
 extern int mips_poolpage_vmfreelist;
+#ifdef ENABLE_MIPS_16KB_PAGE
+extern vaddr_t mips_vm_maxuser_address;
+#endif
 #endif
 
 #endif /* ! _MIPS_VMPARAM_H_ */
diff -r 7c390c7e2611 -r adb7767a3332 sys/arch/mips/mips/mips_machdep.c
--- a/sys/arch/mips/mips/mips_machdep.c Wed Aug 24 15:11:52 2011 +0000
+++ b/sys/arch/mips/mips/mips_machdep.c Wed Aug 24 16:01:53 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mips_machdep.c,v 1.246 2011/08/16 06:58:15 matt Exp $  */
+/*     $NetBSD: mips_machdep.c,v 1.247 2011/08/24 16:01:53 matt Exp $  */
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -112,7 +112,7 @@
 
 #include <sys/cdefs.h>                 /* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: mips_machdep.c,v 1.246 2011/08/16 06:58:15 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mips_machdep.c,v 1.247 2011/08/24 16:01:53 matt Exp $");
 
 #define __INTR_PRIVATE
 #include "opt_cputype.h"
@@ -193,6 +193,10 @@
 static void mips_watchpoint_init(void);
 #endif
 
+#if defined(_LP64) && defined(ENABLE_MIPS_16KB_PAGE)
+vaddr_t mips_vm_maxuser_address = MIPS_VM_MAXUSER_ADDRESS;
+#endif
+
 #if defined(MIPS3_PLUS)
 uint32_t mips3_cp0_tlb_page_mask_probe(void);
 uint64_t mips3_cp0_tlb_entry_hi_probe(void);
@@ -1357,6 +1361,16 @@
                opts->mips3_tlb_vpn_mask <<= 2;
                opts->mips3_tlb_vpn_mask >>= 2;
                opts->mips3_tlb_pfn_mask = mips3_cp0_tlb_entry_lo_probe();
+#if defined(_LP64) && defined(ENABLE_MIPS_16KB_PAGE)
+               /*
+                * 16KB pages could cause our page table being able to address
+                * a larger address space than the actual chip supports.  So
+                * we need to limit the address space to what it can really
+                * address.
+                */
+               if (mips_vm_maxuser_address > opts->mips3_tlb_vpn_mask + 1)
+                       mips_vm_maxuser_address = opts->mips3_tlb_vpn_mask + 1;
+#endif
        }
 }
 #endif



Home | Main Index | Thread Index | Old Index