vmparam.h revision 170262
180708Sjake/*- 282899Sjake * Copyright (c) 1990 The Regents of the University of California. 380708Sjake * All rights reserved. 482899Sjake * Copyright (c) 1994 John S. Dyson 582899Sjake * All rights reserved. 680708Sjake * 782899Sjake * This code is derived from software contributed to Berkeley by 882899Sjake * William Jolitz. 982899Sjake * 1080708Sjake * Redistribution and use in source and binary forms, with or without 1180708Sjake * modification, are permitted provided that the following conditions 1280708Sjake * are met: 1380708Sjake * 1. Redistributions of source code must retain the above copyright 1480708Sjake * notice, this list of conditions and the following disclaimer. 1580708Sjake * 2. Redistributions in binary form must reproduce the above copyright 1680708Sjake * notice, this list of conditions and the following disclaimer in the 1780708Sjake * documentation and/or other materials provided with the distribution. 1882899Sjake * 3. All advertising materials mentioning features or use of this software 1982899Sjake * must display the following acknowledgement: 2082899Sjake * This product includes software developed by the University of 2182899Sjake * California, Berkeley and its contributors. 2282899Sjake * 4. Neither the name of the University nor the names of its contributors 2382899Sjake * may be used to endorse or promote products derived from this software 2482899Sjake * without specific prior written permission. 2580708Sjake * 2682899Sjake * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 2780708Sjake * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2880708Sjake * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2982899Sjake * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 3080708Sjake * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 3180708Sjake * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 3280708Sjake * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 3380708Sjake * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 3480708Sjake * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 3580708Sjake * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3680708Sjake * SUCH DAMAGE. 3780708Sjake * 3882899Sjake * from: @(#)vmparam.h 5.9 (Berkeley) 5/12/91 3982899Sjake * from: FreeBSD: src/sys/i386/include/vmparam.h,v 1.33 2000/03/30 4080708Sjake * $FreeBSD: head/sys/sparc64/include/vmparam.h 170262 2007-06-04 02:32:07Z alc $ 4180708Sjake */ 4280708Sjake 4382899Sjake 4480708Sjake#ifndef _MACHINE_VMPARAM_H_ 4580708Sjake#define _MACHINE_VMPARAM_H_ 4680708Sjake 4780708Sjake/* 4880708Sjake * Virtual memory related constants, all in bytes 4980708Sjake */ 5080708Sjake#ifndef MAXTSIZ 5180708Sjake#define MAXTSIZ (1*1024*1024*1024) /* max text size */ 5280708Sjake#endif 5380708Sjake#ifndef DFLDSIZ 5480708Sjake#define DFLDSIZ (128*1024*1024) /* initial data size limit */ 5580708Sjake#endif 5680708Sjake#ifndef MAXDSIZ 5780708Sjake#define MAXDSIZ (1*1024*1024*1024) /* max data size */ 5880708Sjake#endif 5980708Sjake#ifndef DFLSSIZ 6080708Sjake#define DFLSSIZ (128*1024*1024) /* initial stack size limit */ 6180708Sjake#endif 6280708Sjake#ifndef MAXSSIZ 6380708Sjake#define MAXSSIZ (1*1024*1024*1024) /* max stack size */ 6480708Sjake#endif 6580708Sjake#ifndef SGROWSIZ 6680708Sjake#define SGROWSIZ (128*1024) /* amount to grow stack */ 6780708Sjake#endif 6880708Sjake 6980708Sjake/* 7080708Sjake * The time for a process to be blocked before being very swappable. 7180708Sjake * This is a number of seconds which the system takes as being a non-trivial 7280708Sjake * amount of real time. You probably shouldn't change this; 7380708Sjake * it is used in subtle ways (fractions and multiples of it are, that is, like 7480708Sjake * half of a ``long time'', almost a long time, etc.) 7580708Sjake * It is related to human patience and other factors which don't really 7680708Sjake * change over time. 7780708Sjake */ 7880708Sjake#define MAXSLP 20 7980708Sjake 8088653Sjake/* 81169291Salc * The physical address space is sparsely populated. 82169291Salc */ 83169291Salc#define VM_PHYSSEG_SPARSE 84169291Salc 85169291Salc/* 86170262Salc * The number of PHYSSEG entries must be one greater than the number 87170262Salc * of phys_avail entries because the phys_avail entry that spans the 88170262Salc * largest physical address that is accessible by ISA DMA is split 89170262Salc * into two PHYSSEG entries. 90170262Salc */ 91170262Salc#define VM_PHYSSEG_MAX 64 92170262Salc 93170262Salc/* 94170262Salc * Create two free page pools: VM_FREEPOOL_DEFAULT is the default pool 95170262Salc * from which physical pages are allocated and VM_FREEPOOL_DIRECT is 96170262Salc * the pool from which physical pages for small UMA objects are 97170262Salc * allocated. 98170262Salc */ 99170262Salc#define VM_NFREEPOOL 2 100170262Salc#define VM_FREEPOOL_DEFAULT 0 101170262Salc#define VM_FREEPOOL_DIRECT 1 102170262Salc 103170262Salc/* 104170262Salc * Create two free page lists: VM_FREELIST_DEFAULT is for physical 105170262Salc * pages that are above the largest physical address that is 106170262Salc * accessible by ISA DMA and VM_FREELIST_ISADMA is for physical pages 107170262Salc * that are below that address. 108170262Salc */ 109170262Salc#define VM_NFREELIST 2 110170262Salc#define VM_FREELIST_DEFAULT 0 111170262Salc#define VM_FREELIST_ISADMA 1 112170262Salc 113170262Salc/* 114170262Salc * An allocation size of 16MB is supported in order to optimize the 115170262Salc * use of the direct map by UMA. Specifically, a cache line contains 116170262Salc * at most four TTEs, collectively mapping 16MB of physical memory. 117170262Salc * By reducing the number of distinct 16MB "pages" that are used by UMA, 118170262Salc * the physical memory allocator reduces the likelihood of both 4MB 119170262Salc * page TLB misses and cache misses caused by 4MB page TLB misses. 120170262Salc */ 121170262Salc#define VM_NFREEORDER 12 122170262Salc 123170262Salc/* 124108245Sjake * Address space layout. 125108245Sjake * 126108245Sjake * UltraSPARC I and II implement a 44 bit virtual address space. The address 127108245Sjake * space is split into 2 regions at each end of the 64 bit address space, with 128108245Sjake * an out of range "hole" in the middle. UltraSPARC III implements the full 129108245Sjake * 64 bit virtual address space, but we don't really have any use for it and 130108245Sjake * 43 bits of user address space is considered to be "enough", so we ignore it. 131108245Sjake * 132108245Sjake * Upper region: 0xffffffffffffffff 133108245Sjake * 0xfffff80000000000 134108245Sjake * 135108245Sjake * Hole: 0xfffff7ffffffffff 136108245Sjake * 0x0000080000000000 137108245Sjake * 138108245Sjake * Lower region: 0x000007ffffffffff 139108245Sjake * 0x0000000000000000 140108245Sjake * 141108245Sjake * In general we ignore the upper region, and use the lower region as mappable 142108245Sjake * space. 143108245Sjake * 144108245Sjake * We define some interesting address constants: 145108245Sjake * 146108245Sjake * VM_MIN_ADDRESS and VM_MAX_ADDRESS define the start and of the entire 64 bit 147108245Sjake * address space, mostly just for convenience. 148108245Sjake * 149108245Sjake * VM_MIN_DIRECT_ADDRESS and VM_MAX_DIRECT_ADDRESS define the start and end 150108245Sjake * of the direct mapped region. This maps virtual addresses to physical 151108245Sjake * addresses directly using 4mb tlb entries, with the physical address encoded 152108245Sjake * in the lower 43 bits of virtual address. These mappings are convenient 153108245Sjake * because they do not require page tables, and because they never change they 154108245Sjake * do not require tlb flushes. However, since these mappings are cacheable, 155108245Sjake * we must ensure that all pages accessed this way are either not double 156108245Sjake * mapped, or that all other mappings have virtual color equal to physical 157108245Sjake * color, in order to avoid creating illegal aliases in the data cache. 158108245Sjake * 159108245Sjake * VM_MIN_KERNEL_ADDRESS and VM_MAX_KERNEL_ADDRESS define the start and end of 160108245Sjake * mappable kernel virtual address space. VM_MIN_KERNEL_ADDRESS is basically 161108245Sjake * arbitrary, a convenient address is chosen which allows both the kernel text 162108245Sjake * and data and the prom's address space to be mapped with 1 4mb tsb page. 163108245Sjake * VM_MAX_KERNEL_ADDRESS is variable, computed at startup time based on the 164108245Sjake * amount of physical memory available. Each 4mb tsb page provides 1g of 165108245Sjake * virtual address space, with the only practical limit being available 166108245Sjake * phsyical memory. 167108245Sjake * 168108245Sjake * VM_MIN_PROM_ADDRESS and VM_MAX_PROM_ADDRESS define the start and end of the 169108245Sjake * prom address space. On startup the prom's mappings are duplicated in the 170108245Sjake * kernel tsb, to allow prom memory to be accessed normally by the kernel. 171108245Sjake * 172108245Sjake * VM_MIN_USER_ADDRESS and VM_MAX_USER_ADDRESS define the start and end of the 173108245Sjake * user address space. There are some hardware errata about using addresses 174108245Sjake * at the boundary of the va hole, so we allow just under 43 bits of user 175108245Sjake * address space. Note that the kernel and user address spaces overlap, but 176108245Sjake * this doesn't matter because they use different tlb contexts, and because 177108245Sjake * the kernel address space is not mapped into each process' address space. 17888653Sjake */ 179108245Sjake#define VM_MIN_ADDRESS (0x0000000000000000UL) 180108245Sjake#define VM_MAX_ADDRESS (0xffffffffffffffffUL) 18180708Sjake 182108245Sjake#define VM_MIN_DIRECT_ADDRESS (0xfffff80000000000UL) 183108245Sjake#define VM_MAX_DIRECT_ADDRESS (VM_MAX_ADDRESS) 18488653Sjake 185108245Sjake#define VM_MIN_KERNEL_ADDRESS (0x00000000c0000000UL) 186108245Sjake#define VM_MAX_KERNEL_ADDRESS (vm_max_kernel_address) 18780708Sjake 188108245Sjake#define VM_MIN_PROM_ADDRESS (0x00000000f0000000UL) 189108245Sjake#define VM_MAX_PROM_ADDRESS (0x00000000ffffe000UL) 190108245Sjake 191108245Sjake#define VM_MIN_USER_ADDRESS (0x0000000000000000UL) 192108245Sjake#define VM_MAX_USER_ADDRESS (0x000007fe00000000UL) 193108245Sjake 194108245Sjake#define VM_MINUSER_ADDRESS (VM_MIN_USER_ADDRESS) 195108245Sjake#define VM_MAXUSER_ADDRESS (VM_MAX_USER_ADDRESS) 196108245Sjake 197108245Sjake#define KERNBASE (VM_MIN_KERNEL_ADDRESS) 198108245Sjake#define USRSTACK (VM_MAX_USER_ADDRESS) 199108245Sjake 20080708Sjake/* 20180708Sjake * Virtual size (bytes) for various kernel submaps. 20280708Sjake */ 20380708Sjake#ifndef VM_KMEM_SIZE 20491974Sjake#define VM_KMEM_SIZE (16*1024*1024) 20580708Sjake#endif 20680708Sjake 20785241Sjake/* 20891974Sjake * How many physical pages per KVA page allocated. 209168920Ssepotvin * min(max(max(VM_KMEM_SIZE, Physical memory/VM_KMEM_SIZE_SCALE), 210168920Ssepotvin * VM_KMEM_SIZE_MIN), VM_KMEM_SIZE_MAX) 21191974Sjake * is the total KVA space allocated for kmem_map. 21291974Sjake */ 21391974Sjake#ifndef VM_KMEM_SIZE_SCALE 21491974Sjake#define VM_KMEM_SIZE_SCALE (3) 21591974Sjake#endif 21691974Sjake 21791974Sjake/* 21880708Sjake * Initial pagein size of beginning of executable file. 21980708Sjake */ 22080708Sjake#ifndef VM_INITIAL_PAGEIN 22180708Sjake#define VM_INITIAL_PAGEIN 16 22280708Sjake#endif 22380708Sjake 224108332Sjake#define UMA_MD_SMALL_ALLOC 225108332Sjake 226101653Sjakeextern vm_offset_t vm_max_kernel_address; 227101653Sjake 22880708Sjake#endif /* !_MACHINE_VMPARAM_H_ */ 229