vmparam.h revision 256281
11839Swollman/*- 21839Swollman * Copyright (c) 1990 The Regents of the University of California. 31839Swollman * All rights reserved. 41839Swollman * Copyright (c) 1994 John S. Dyson 51839Swollman * All rights reserved. 61839Swollman * 71839Swollman * This code is derived from software contributed to Berkeley by 81839Swollman * William Jolitz. 91839Swollman * 101839Swollman * Redistribution and use in source and binary forms, with or without 111839Swollman * modification, are permitted provided that the following conditions 121839Swollman * are met: 131839Swollman * 1. Redistributions of source code must retain the above copyright 141839Swollman * notice, this list of conditions and the following disclaimer. 151839Swollman * 2. Redistributions in binary form must reproduce the above copyright 161839Swollman * notice, this list of conditions and the following disclaimer in the 171839Swollman * documentation and/or other materials provided with the distribution. 181839Swollman * 4. Neither the name of the University nor the names of its contributors 191839Swollman * may be used to endorse or promote products derived from this software 201839Swollman * without specific prior written permission. 211839Swollman * 221839Swollman * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 231839Swollman * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 241839Swollman * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 251839Swollman * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 261839Swollman * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 271839Swollman * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 281903Swollman * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 291903Swollman * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 301903Swollman * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 311903Swollman * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 321839Swollman * SUCH DAMAGE. 331839Swollman * 341839Swollman * from: @(#)vmparam.h 5.9 (Berkeley) 5/12/91 351839Swollman * from: FreeBSD: src/sys/i386/include/vmparam.h,v 1.33 2000/03/30 361839Swollman * $FreeBSD: stable/10/sys/sparc64/include/vmparam.h 250338 2013-05-07 22:46:24Z attilio $ 371839Swollman */ 381839Swollman 391839Swollman#ifndef _MACHINE_VMPARAM_H_ 401903Swollman#define _MACHINE_VMPARAM_H_ 411903Swollman 421903Swollman/* 431839Swollman * Virtual memory related constants, all in bytes 441839Swollman */ 451839Swollman#ifndef MAXTSIZ 461839Swollman#define MAXTSIZ (1*1024*1024*1024) /* max text size */ 471839Swollman#endif 481839Swollman#ifndef DFLDSIZ 491839Swollman#define DFLDSIZ (128*1024*1024) /* initial data size limit */ 501839Swollman#endif 511839Swollman#ifndef MAXDSIZ 521839Swollman#define MAXDSIZ (1*1024*1024*1024) /* max data size */ 531839Swollman#endif 541839Swollman#ifndef DFLSSIZ 551839Swollman#define DFLSSIZ (128*1024*1024) /* initial stack size limit */ 561839Swollman#endif 571839Swollman#ifndef MAXSSIZ 581839Swollman#define MAXSSIZ (1*1024*1024*1024) /* max stack size */ 591839Swollman#endif 601839Swollman#ifndef SGROWSIZ 611839Swollman#define SGROWSIZ (128*1024) /* amount to grow stack */ 621839Swollman#endif 631839Swollman 641839Swollman/* 651839Swollman * The physical address space is sparsely populated. 661839Swollman */ 671839Swollman#define VM_PHYSSEG_SPARSE 681839Swollman 691839Swollman/* 701839Swollman * The number of PHYSSEG entries must be one greater than the number 711839Swollman * of phys_avail entries because the phys_avail entry that spans the 721839Swollman * largest physical address that is accessible by ISA DMA is split 731839Swollman * into two PHYSSEG entries. 741839Swollman */ 751839Swollman#define VM_PHYSSEG_MAX 64 761839Swollman 771839Swollman/* 781839Swollman * Create three free page pools: VM_FREEPOOL_DEFAULT is the default pool 791839Swollman * from which physical pages are allocated and VM_FREEPOOL_DIRECT is 801839Swollman * the pool from which physical pages for small UMA objects are 811839Swollman * allocated. 821839Swollman */ 831839Swollman#define VM_NFREEPOOL 3 841839Swollman#define VM_FREEPOOL_CACHE 2 851839Swollman#define VM_FREEPOOL_DEFAULT 0 861839Swollman#define VM_FREEPOOL_DIRECT 1 871839Swollman 881839Swollman/* 891839Swollman * Create two free page lists: VM_FREELIST_DEFAULT is for physical 901839Swollman * pages that are above the largest physical address that is 911839Swollman * accessible by ISA DMA and VM_FREELIST_ISADMA is for physical pages 921839Swollman * that are below that address. 931839Swollman */ 941839Swollman#define VM_NFREELIST 2 951839Swollman#define VM_FREELIST_DEFAULT 0 961839Swollman#define VM_FREELIST_ISADMA 1 971839Swollman 981839Swollman/* 991839Swollman * An allocation size of 16MB is supported in order to optimize the 1001839Swollman * use of the direct map by UMA. Specifically, a cache line contains 1011839Swollman * at most four TTEs, collectively mapping 16MB of physical memory. 1021839Swollman * By reducing the number of distinct 16MB "pages" that are used by UMA, 1031839Swollman * the physical memory allocator reduces the likelihood of both 4MB 1041839Swollman * page TLB misses and cache misses caused by 4MB page TLB misses. 1051839Swollman */ 1061839Swollman#define VM_NFREEORDER 12 1071839Swollman 1081839Swollman/* 1091839Swollman * Enable superpage reservations: 1 level. 1101839Swollman */ 1111839Swollman#ifndef VM_NRESERVLEVEL 1121839Swollman#define VM_NRESERVLEVEL 1 1131839Swollman#endif 1141839Swollman 1151839Swollman/* 1161839Swollman * Level 0 reservations consist of 512 pages. 1171839Swollman */ 1181839Swollman#ifndef VM_LEVEL_0_ORDER 1191839Swollman#define VM_LEVEL_0_ORDER 9 1201839Swollman#endif 1211839Swollman 1221839Swollman/** 1231839Swollman * Address space layout. 1241839Swollman * 1251839Swollman * UltraSPARC I and II implement a 44 bit virtual address space. The address 1261839Swollman * space is split into 2 regions at each end of the 64 bit address space, with 1271839Swollman * an out of range "hole" in the middle. UltraSPARC III implements the full 1281839Swollman * 64 bit virtual address space, but we don't really have any use for it and 1291839Swollman * 43 bits of user address space is considered to be "enough", so we ignore it. 1301839Swollman * 1311839Swollman * Upper region: 0xffffffffffffffff 1321839Swollman * 0xfffff80000000000 1331839Swollman * 1341839Swollman * Hole: 0xfffff7ffffffffff 1351839Swollman * 0x0000080000000000 1361839Swollman * 1371839Swollman * Lower region: 0x000007ffffffffff 1381839Swollman * 0x0000000000000000 1391839Swollman * 1401839Swollman * In general we ignore the upper region, and use the lower region as mappable 1411839Swollman * space. 1421839Swollman * 1431839Swollman * We define some interesting address constants: 1441839Swollman * 1451839Swollman * VM_MIN_ADDRESS and VM_MAX_ADDRESS define the start and end of the entire 1461839Swollman * 64 bit address space, mostly just for convenience. 1471839Swollman * 1481839Swollman * VM_MIN_DIRECT_ADDRESS and VM_MAX_DIRECT_ADDRESS define the start and end 1491839Swollman * of the direct mapped region. This maps virtual addresses to physical 1501839Swollman * addresses directly using 4mb tlb entries, with the physical address encoded 1511839Swollman * in the lower 43 bits of virtual address. These mappings are convenient 1521839Swollman * because they do not require page tables, and because they never change they 1531839Swollman * do not require tlb flushes. However, since these mappings are cacheable, 1541839Swollman * we must ensure that all pages accessed this way are either not double 1551839Swollman * mapped, or that all other mappings have virtual color equal to physical 1561839Swollman * color, in order to avoid creating illegal aliases in the data cache. 1571839Swollman * 1581839Swollman * VM_MIN_KERNEL_ADDRESS and VM_MAX_KERNEL_ADDRESS define the start and end of 1591839Swollman * mappable kernel virtual address space. VM_MIN_KERNEL_ADDRESS is basically 1601839Swollman * arbitrary, a convenient address is chosen which allows both the kernel text 1611839Swollman * and data and the prom's address space to be mapped with 1 4mb tsb page. 1621839Swollman * VM_MAX_KERNEL_ADDRESS is variable, computed at startup time based on the 1631839Swollman * amount of physical memory available. Each 4mb tsb page provides 1g of 1641839Swollman * virtual address space, with the only practical limit being available 1651839Swollman * phsyical memory. 1661839Swollman * 1671839Swollman * VM_MIN_PROM_ADDRESS and VM_MAX_PROM_ADDRESS define the start and end of the 1681839Swollman * prom address space. On startup the prom's mappings are duplicated in the 1691839Swollman * kernel tsb, to allow prom memory to be accessed normally by the kernel. 1701839Swollman * 1711839Swollman * VM_MIN_USER_ADDRESS and VM_MAX_USER_ADDRESS define the start and end of the 1721839Swollman * user address space. There are some hardware errata about using addresses 1731839Swollman * at the boundary of the va hole, so we allow just under 43 bits of user 1741839Swollman * address space. Note that the kernel and user address spaces overlap, but 1751839Swollman * this doesn't matter because they use different tlb contexts, and because 1761839Swollman * the kernel address space is not mapped into each process' address space. 1771839Swollman */ 1781839Swollman#define VM_MIN_ADDRESS (0x0000000000000000UL) 1791839Swollman#define VM_MAX_ADDRESS (0xffffffffffffffffUL) 1801839Swollman 1811839Swollman#define VM_MIN_DIRECT_ADDRESS (0xfffff80000000000UL) 1821839Swollman#define VM_MAX_DIRECT_ADDRESS (VM_MAX_ADDRESS) 1831839Swollman 1841839Swollman#define VM_MIN_KERNEL_ADDRESS (0x00000000c0000000UL) 1851839Swollman#define VM_MAX_KERNEL_ADDRESS (vm_max_kernel_address) 1861839Swollman 1871839Swollman#define VM_MIN_PROM_ADDRESS (0x00000000f0000000UL) 1881839Swollman#define VM_MAX_PROM_ADDRESS (0x00000000ffffffffUL) 1891839Swollman 1901839Swollman#define VM_MIN_USER_ADDRESS (0x0000000000000000UL) 1911839Swollman#define VM_MAX_USER_ADDRESS (0x000007fe00000000UL) 1921839Swollman 1931839Swollman#define VM_MINUSER_ADDRESS (VM_MIN_USER_ADDRESS) 1941839Swollman#define VM_MAXUSER_ADDRESS (VM_MAX_USER_ADDRESS) 1951839Swollman 1961839Swollman#define KERNBASE (VM_MIN_KERNEL_ADDRESS) 1971839Swollman#define PROMBASE (VM_MIN_PROM_ADDRESS) 1981839Swollman#define USRSTACK (VM_MAX_USER_ADDRESS) 1991839Swollman 2001839Swollman/* 2011839Swollman * Virtual size (bytes) for various kernel submaps. 2021839Swollman */ 2031839Swollman#ifndef VM_KMEM_SIZE 2041839Swollman#define VM_KMEM_SIZE (16*1024*1024) 2051839Swollman#endif 2061839Swollman 2071839Swollman/* 2081839Swollman * How many physical pages per KVA page allocated. 2091839Swollman * min(max(max(VM_KMEM_SIZE, Physical memory/VM_KMEM_SIZE_SCALE), 2101839Swollman * VM_KMEM_SIZE_MIN), VM_KMEM_SIZE_MAX) 2111839Swollman * is the total KVA space allocated for kmem_map. 2121839Swollman */ 2131839Swollman#ifndef VM_KMEM_SIZE_SCALE 2141839Swollman#define VM_KMEM_SIZE_SCALE (tsb_kernel_ldd_phys == 0 ? 3 : 2) 2151839Swollman#endif 2161839Swollman 2171839Swollman/* 2181839Swollman * Ceiling on amount of kmem_map kva space. 2191839Swollman */ 2201839Swollman#ifndef VM_KMEM_SIZE_MAX 2211839Swollman#define VM_KMEM_SIZE_MAX ((VM_MAX_KERNEL_ADDRESS - \ 2221839Swollman VM_MIN_KERNEL_ADDRESS + 1) * 3 / 5) 2231839Swollman#endif 2241839Swollman 2251839Swollman/* 2261839Swollman * Initial pagein size of beginning of executable file. 2271839Swollman */ 2281839Swollman#ifndef VM_INITIAL_PAGEIN 2291839Swollman#define VM_INITIAL_PAGEIN 16 2301839Swollman#endif 2311839Swollman 2321839Swollman#define UMA_MD_SMALL_ALLOC 2331839Swollman 2341839Swollmanextern u_int tsb_kernel_ldd_phys; 2351839Swollmanextern vm_offset_t vm_max_kernel_address; 2361839Swollman 2371839Swollman/* 2381839Swollman * Older sparc64 machines have a virtually indexed L1 data cache of 16KB. 2391839Swollman * Consequently, mapping the same physical page multiple times may have 2401839Swollman * caching disabled. 2411839Swollman */ 2421903Swollman#define ZERO_REGION_SIZE PAGE_SIZE 2431903Swollman 2441903Swollman#endif /* !_MACHINE_VMPARAM_H_ */ 2451839Swollman