diff options
author | 2010-06-29 21:26:09 +0000 | |
---|---|---|
committer | 2010-06-29 21:26:09 +0000 | |
commit | f4918fc13c48ea19564f3b4d43bf6b19d5fc1acf (patch) | |
tree | 6bacac714f3d7b391b10c55694a10875303fcb92 /sys | |
parent | Fix an obviously wrong comment. ok reyk@ (diff) | |
download | wireguard-openbsd-f4918fc13c48ea19564f3b4d43bf6b19d5fc1acf.tar.xz wireguard-openbsd-f4918fc13c48ea19564f3b4d43bf6b19d5fc1acf.zip |
There is absolutely no need to double map DVMA addresses into the kernel address
space on SRMMU systems (i.e. sun4m), so don't do it anymore and update
misleading comments.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/sparc/include/param.h | 12 | ||||
-rw-r--r-- | sys/arch/sparc/include/pmap.h | 10 | ||||
-rw-r--r-- | sys/arch/sparc/sparc/machdep.c | 41 | ||||
-rw-r--r-- | sys/arch/sparc/sparc/vaddrs.h | 23 | ||||
-rw-r--r-- | sys/arch/sparc/sparc/vm_machdep.c | 25 |
5 files changed, 31 insertions, 80 deletions
diff --git a/sys/arch/sparc/include/param.h b/sys/arch/sparc/include/param.h index 4eb288b689b..71cc97bf954 100644 --- a/sys/arch/sparc/include/param.h +++ b/sys/arch/sparc/include/param.h @@ -1,4 +1,4 @@ -/* $OpenBSD: param.h,v 1.40 2007/11/28 16:33:20 martin Exp $ */ +/* $OpenBSD: param.h,v 1.41 2010/06/29 21:26:09 miod Exp $ */ /* $NetBSD: param.h,v 1.29 1997/03/10 22:50:37 pk Exp $ */ /* @@ -112,16 +112,6 @@ #define btodb(x) ((x) >> DEV_BSHIFT) #define dbtob(x) ((x) << DEV_BSHIFT) -/* - * dvmamap manages a range of DVMA addresses intended to create double - * mappings of physical memory. In a way, `dvmamap' is a submap of the - * VM map `phys_map'. The difference is the use of the `resource map' - * routines to manage page allocation, allowing DVMA addresses to be - * allocated and freed from within interrupt routines. - * - * Note that `phys_map' can still be used to allocate memory-backed pages - * in DVMA space. - */ #ifdef _KERNEL #ifndef _LOCORE extern vaddr_t dvma_base; diff --git a/sys/arch/sparc/include/pmap.h b/sys/arch/sparc/include/pmap.h index 9c6a85917b2..e4c1c780dc8 100644 --- a/sys/arch/sparc/include/pmap.h +++ b/sys/arch/sparc/include/pmap.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.h,v 1.46 2010/06/06 10:04:33 miod Exp $ */ +/* $OpenBSD: pmap.h,v 1.47 2010/06/29 21:26:09 miod Exp $ */ /* $NetBSD: pmap.h,v 1.30 1997/08/04 20:00:47 pk Exp $ */ /* @@ -58,8 +58,8 @@ * both into the same structure. Fortunately, they are almost the same. * * The kernel begins at 0xf8000000 and runs to 0xffffffff (although - * some of this is not actually used). Kernel space, including DVMA - * space (for now?), is mapped identically into all user contexts. + * some of this is not actually used). Kernel space is mapped identically + * into all user contexts. * There is no point in duplicating this mapping in each user process * so they do not appear in the user structures. * @@ -72,8 +72,8 @@ * makes no such distinction. * * Since each virtual segment covers 256 kbytes, the user space - * requires 3584 segments, while the kernel (including DVMA) requires - * only 512 segments. + * requires 3584 segments, while the kernel (including DVMA on 4/4c) + * requires only 512 segments. * * ** FOR THE SUN4/SUN4C diff --git a/sys/arch/sparc/sparc/machdep.c b/sys/arch/sparc/sparc/machdep.c index 4ed5029fe22..ead377a6ad5 100644 --- a/sys/arch/sparc/sparc/machdep.c +++ b/sys/arch/sparc/sparc/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.126 2010/06/27 13:28:47 miod Exp $ */ +/* $OpenBSD: machdep.c,v 1.127 2010/06/29 21:26:12 miod Exp $ */ /* $NetBSD: machdep.c,v 1.85 1997/09/12 08:55:02 pk Exp $ */ /* @@ -100,7 +100,6 @@ #endif struct vm_map *exec_map = NULL; -struct vm_map *phys_map = NULL; /* * Declare these as initialized data so we can patch them. @@ -128,11 +127,10 @@ int sparc_led_blink = 0; * safepri is a safe priority for sleep to set for a spin-wait * during autoconfiguration or after a panic. */ -int safepri = 0; +int safepri = 0; /* - * dvmamap is used to manage DVMA memory. Note: this coincides with - * the memory range in `phys_map' (which is mostly a place-holder). + * dvmamap_extent is used to manage DVMA memory. */ vaddr_t dvma_base, dvma_end; struct extent *dvmamap_extent; @@ -192,38 +190,11 @@ cpu_startup() * map, but we want one completely separate, even though it uses * the same pmap. */ - dvma_base = CPU_ISSUN4M ? DVMA4M_BASE : DVMA_BASE; - dvma_end = CPU_ISSUN4M ? DVMA4M_END : DVMA_END; -#if defined(SUN4M) - if (CPU_ISSUN4M) { - /* - * The DVMA space we want partially overrides kernel_map. - * Allocate it in kernel_map as well to prevent it from being - * used for other things. - */ - if (uvm_map(kernel_map, &dvma_base, - vm_map_max(kernel_map) - dvma_base, - NULL, UVM_UNKNOWN_OFFSET, 0, - UVM_MAPFLAG(UVM_PROT_NONE, UVM_PROT_NONE, UVM_INH_NONE, - UVM_ADV_NORMAL, UVM_FLAG_FIXED))) - panic("startup: can not steal dvma map"); - } -#endif - phys_map = uvm_map_create(pmap_kernel(), dvma_base, dvma_end, - VM_MAP_INTRSAFE); - if (phys_map == NULL) - panic("unable to create DVMA map"); - - /* - * Allocate DVMA space and dump into a privately managed - * resource map for double mappings which is usable from - * interrupt contexts. - */ - if (uvm_km_valloc_wait(phys_map, (dvma_end-dvma_base)) != dvma_base) - panic("unable to allocate from DVMA map"); + dvma_base = CPU_ISSUN4DOR4M ? DVMA4M_BASE : DVMA_BASE; + dvma_end = CPU_ISSUN4DOR4M ? DVMA4M_END : DVMA_END; dvmamap_extent = extent_create("dvmamap", dvma_base, dvma_end, M_DEVBUF, NULL, 0, EX_NOWAIT); - if (dvmamap_extent == 0) + if (dvmamap_extent == NULL) panic("unable to allocate extent for dvma"); #ifdef DEBUG diff --git a/sys/arch/sparc/sparc/vaddrs.h b/sys/arch/sparc/sparc/vaddrs.h index e833b72416e..5afd25688dc 100644 --- a/sys/arch/sparc/sparc/vaddrs.h +++ b/sys/arch/sparc/sparc/vaddrs.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vaddrs.h,v 1.7 2005/04/17 18:47:51 miod Exp $ */ +/* $OpenBSD: vaddrs.h,v 1.8 2010/06/29 21:26:12 miod Exp $ */ /* $NetBSD: vaddrs.h,v 1.8 1997/03/10 23:54:41 pk Exp $ */ /* @@ -52,10 +52,10 @@ * Special (fixed) virtual addresses on the SPARC. * * IO virtual space begins at 0xfe000000 (a segment boundary) and - * continues up to the DVMA edge at 0xff000000. (The upper all-1s - * byte is special since some of the hardware supplies this to pad - * a 24-bit address space out to 32 bits. This is a legacy of the - * IBM PC AT bus, actually, just so you know who to blame.) + * continues up to the DVMA edge at 0xff000000 (on non-SRMMU systems only). + * (The upper all-1s byte is special anyway since some of the hardware + * supplies this to pad a 24-bit address space out to 32 bits. This is a + * legacy of the IBM PC AT bus, actually, just so you know who to blame.) * * We reserve several pages at the base of our IO virtual space * for `oft-used' devices which must be present anyway in order to @@ -100,20 +100,9 @@ * Note that pagetables must be allocated at a cost of 1k per MB of DVMA * space, plus severe alignment restrictions. So don't make DVMA4M_BASE too * low (max space = 2G). - * - * Since DVMA space overlaps with normal kernel address space (notably - * the device mappings and the PROM), we don't want to put any DVMA - * mappings where any of this useful stuff is (i.e. if we dvma_malloc - * a buffer, we want to still have a SRMMU mapping to it, and we can't - * have that if its on top of kernel code). Thus the last two - * constants define the actual DVMA addresses used. These can be anything - * as long as they are within the bounds setup by the first 2 constants. - * This is especially important on MP systems with cache coherency: to - * avoid consistency problems, DVMA addresses must map to the same place - * in both processor and IOMMU space. */ #define DVMA4M_BASE 0xfc000000 /* can change subject to above rule */ -#define DVMA4M_END 0xfffff000 /* XXX is this enough? */ +#define DVMA4M_END 0xfffff000 #define DVMA_D24_BASE 0xff000000 #define DVMA_D24_END 0xfffff000 diff --git a/sys/arch/sparc/sparc/vm_machdep.c b/sys/arch/sparc/sparc/vm_machdep.c index 7c3f8617c94..912be7ddf40 100644 --- a/sys/arch/sparc/sparc/vm_machdep.c +++ b/sys/arch/sparc/sparc/vm_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vm_machdep.c,v 1.52 2010/06/22 20:27:32 oga Exp $ */ +/* $OpenBSD: vm_machdep.c,v 1.53 2010/06/29 21:26:12 miod Exp $ */ /* $NetBSD: vm_machdep.c,v 1.30 1997/03/10 23:55:40 pk Exp $ */ /* @@ -140,7 +140,8 @@ u_long dvma_cachealign = 0; /* * Map a range [va, va+len] of wired virtual addresses in the given map - * to a kernel address in DVMA space. + * to a valid DVMA address. On non-SRMMU systems, this establish a + * second mapping of that range. */ vaddr_t dvma_mapin_space(map, va, len, canwait, space) @@ -222,33 +223,33 @@ dvma_mapin_space(map, va, len, canwait, space) } /* - * Remove double map of `va' in DVMA space at `kva'. + * Remove DVMA mapping of `va' in DVMA space at `dva'. */ void -dvma_mapout(kva, va, len) - vaddr_t kva, va; +dvma_mapout(dva, va, len) + vaddr_t dva, va; int len; { int s, off; int error; - int klen; + int dlen; - off = (int)kva & PGOFSET; - kva -= off; - klen = round_page(len + off); + off = (int)dva & PGOFSET; + dva -= off; + dlen = round_page(len + off); #if defined(SUN4M) if (CPU_ISSUN4M) - iommu_remove(kva, klen); + iommu_remove(dva, dlen); else #endif { - pmap_kremove(kva, klen); + pmap_kremove(dva, dlen); pmap_update(pmap_kernel()); } s = splhigh(); - error = extent_free(dvmamap_extent, kva, klen, EX_NOWAIT); + error = extent_free(dvmamap_extent, dva, dlen, EX_NOWAIT); if (error) printf("dvma_mapout: extent_free failed\n"); splx(s); |