xref: /freebsd/sys/arm/include/vmparam.h (revision 0a44b8a56d23e24b05471ddb038b7dd30b149efe)
16fc729afSOlivier Houchard /*	$NetBSD: vmparam.h,v 1.26 2003/08/07 16:27:47 agc Exp $	*/
26fc729afSOlivier Houchard 
3d8315c79SWarner Losh /*-
451369649SPedro F. Giffuni  * SPDX-License-Identifier: BSD-3-Clause
551369649SPedro F. Giffuni  *
66fc729afSOlivier Houchard  * Copyright (c) 1988 The Regents of the University of California.
76fc729afSOlivier Houchard  * All rights reserved.
86fc729afSOlivier Houchard  *
96fc729afSOlivier Houchard  * Redistribution and use in source and binary forms, with or without
106fc729afSOlivier Houchard  * modification, are permitted provided that the following conditions
116fc729afSOlivier Houchard  * are met:
126fc729afSOlivier Houchard  * 1. Redistributions of source code must retain the above copyright
136fc729afSOlivier Houchard  *    notice, this list of conditions and the following disclaimer.
146fc729afSOlivier Houchard  * 2. Redistributions in binary form must reproduce the above copyright
156fc729afSOlivier Houchard  *    notice, this list of conditions and the following disclaimer in the
166fc729afSOlivier Houchard  *    documentation and/or other materials provided with the distribution.
176fc729afSOlivier Houchard  * 3. Neither the name of the University nor the names of its contributors
186fc729afSOlivier Houchard  *    may be used to endorse or promote products derived from this software
196fc729afSOlivier Houchard  *    without specific prior written permission.
206fc729afSOlivier Houchard  *
216fc729afSOlivier Houchard  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
226fc729afSOlivier Houchard  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
236fc729afSOlivier Houchard  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
246fc729afSOlivier Houchard  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
256fc729afSOlivier Houchard  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
266fc729afSOlivier Houchard  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
276fc729afSOlivier Houchard  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
286fc729afSOlivier Houchard  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
296fc729afSOlivier Houchard  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
306fc729afSOlivier Houchard  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
316fc729afSOlivier Houchard  * SUCH DAMAGE.
326fc729afSOlivier Houchard  */
336fc729afSOlivier Houchard 
346fc729afSOlivier Houchard #ifndef	_MACHINE_VMPARAM_H_
356fc729afSOlivier Houchard #define	_MACHINE_VMPARAM_H_
366fc729afSOlivier Houchard 
37e40f53aaSAndrew Turner /*
38e40f53aaSAndrew Turner  * Machine dependent constants for ARM.
396fc729afSOlivier Houchard  */
40e40f53aaSAndrew Turner 
41e40f53aaSAndrew Turner /*
42e40f53aaSAndrew Turner  * Virtual memory related constants, all in bytes
43e40f53aaSAndrew Turner  */
44e40f53aaSAndrew Turner #ifndef	MAXTSIZ
45d304b9ecSMichal Meloun #define	MAXTSIZ		(256UL*1024*1024)	/* max text size */
46e40f53aaSAndrew Turner #endif
47e40f53aaSAndrew Turner #ifndef	DFLDSIZ
48e40f53aaSAndrew Turner #define	DFLDSIZ		(128UL*1024*1024)	/* initial data size limit */
49e40f53aaSAndrew Turner #endif
50e40f53aaSAndrew Turner #ifndef	MAXDSIZ
51da77382fSKyle Evans #define	MAXDSIZ		(512UL*1024*1024)	/* max data size */
52e40f53aaSAndrew Turner #endif
53e40f53aaSAndrew Turner #ifndef	DFLSSIZ
54202aea9cSKyle Evans #define	DFLSSIZ		(4UL*1024*1024)		/* initial stack size limit */
55e40f53aaSAndrew Turner #endif
56e40f53aaSAndrew Turner #ifndef	MAXSSIZ
57202aea9cSKyle Evans #define	MAXSSIZ		(64UL*1024*1024)	/* max stack size */
58e40f53aaSAndrew Turner #endif
59e40f53aaSAndrew Turner #ifndef	SGROWSIZ
60e40f53aaSAndrew Turner #define	SGROWSIZ	(128UL*1024)		/* amount to grow stack */
61e40f53aaSAndrew Turner #endif
62e40f53aaSAndrew Turner 
636fc729afSOlivier Houchard /*
646fc729afSOlivier Houchard  * Address space constants
656fc729afSOlivier Houchard  */
666fc729afSOlivier Houchard 
676fc729afSOlivier Houchard /*
686fc729afSOlivier Houchard  * The line between user space and kernel space
696fc729afSOlivier Houchard  * Mappings >= KERNEL_BASE are constant across all processes
706fc729afSOlivier Houchard  */
7137143b98SZbigniew Bodek #ifndef KERNBASE
726fc729afSOlivier Houchard #define	KERNBASE		0xc0000000
7337143b98SZbigniew Bodek #endif
746fc729afSOlivier Houchard 
756fc729afSOlivier Houchard /*
762d09b072SIan Lepore  * The virtual address the kernel is linked to run at.  For armv4/5 platforms
772d09b072SIan Lepore  * the low-order 30 bits of this must match the low-order bits of the physical
782d09b072SIan Lepore  * address the kernel is loaded at, so the value is most often provided as a
792d09b072SIan Lepore  * kernel config option in the std.platform file. For armv6/7 the kernel can
802d09b072SIan Lepore  * be loaded at any 2MB boundary, and KERNVIRTADDR can also be set to any 2MB
812d09b072SIan Lepore  * boundary.  It is typically overridden in the std.platform file only when
822d09b072SIan Lepore  * KERNBASE is also set to a lower address to provide more KVA.
832d09b072SIan Lepore  */
842d09b072SIan Lepore #ifndef KERNVIRTADDR
852d09b072SIan Lepore #define	KERNVIRTADDR		0xc0000000
862d09b072SIan Lepore #endif
872d09b072SIan Lepore 
882d09b072SIan Lepore /*
896fc729afSOlivier Houchard  * max number of non-contig chunks of physical RAM you can have
906fc729afSOlivier Houchard  */
916fc729afSOlivier Houchard 
926fc729afSOlivier Houchard #define	VM_PHYSSEG_MAX		32
936fc729afSOlivier Houchard 
946fc729afSOlivier Houchard /*
950b7d5b8fSIan Lepore  * The physical address space may be sparsely populated on some ARM systems.
9604a18977SAlan Cox  */
970b7d5b8fSIan Lepore #define	VM_PHYSSEG_SPARSE
9804a18977SAlan Cox 
9904a18977SAlan Cox /*
100966272caSAlan Cox  * Create one free page pool.  Since the ARM kernel virtual address
101007aeeceSIan Lepore  * space does not include a mapping onto the machine's entire physical
102007aeeceSIan Lepore  * memory, VM_FREEPOOL_DIRECT is defined as an alias for the default
103007aeeceSIan Lepore  * pool, VM_FREEPOOL_DEFAULT.
1049211decaSAlan Cox  */
105966272caSAlan Cox #define	VM_NFREEPOOL		1
106b603e095SAlan Cox #define	VM_FREEPOOL_DEFAULT	0
107007aeeceSIan Lepore #define	VM_FREEPOOL_DIRECT	0
1089211decaSAlan Cox 
1099211decaSAlan Cox /*
110e69ba7c7SIan Lepore  * We need just one free list:  DEFAULT.
1116fc729afSOlivier Houchard  */
112e69ba7c7SIan Lepore #define	VM_NFREELIST		1
1136fc729afSOlivier Houchard #define	VM_FREELIST_DEFAULT	0
1146fc729afSOlivier Houchard 
1159211decaSAlan Cox /*
1169211decaSAlan Cox  * The largest allocation size is 1MB.
1179211decaSAlan Cox  */
1189211decaSAlan Cox #define	VM_NFREEORDER		9
1199211decaSAlan Cox 
120b8e7fc24SAlan Cox /*
121995c2b63SRafal Jaworowski  * Enable superpage reservations: 1 level.
122b8e7fc24SAlan Cox  */
123b8e7fc24SAlan Cox #ifndef	VM_NRESERVLEVEL
124995c2b63SRafal Jaworowski #define	VM_NRESERVLEVEL		1
125995c2b63SRafal Jaworowski #endif
126995c2b63SRafal Jaworowski 
127995c2b63SRafal Jaworowski /*
128995c2b63SRafal Jaworowski  * Level 0 reservations consist of 256 pages.
129995c2b63SRafal Jaworowski  */
130995c2b63SRafal Jaworowski #ifndef	VM_LEVEL_0_ORDER
131995c2b63SRafal Jaworowski #define	VM_LEVEL_0_ORDER	8
132b8e7fc24SAlan Cox #endif
133b8e7fc24SAlan Cox 
1346fc729afSOlivier Houchard #define VM_MIN_ADDRESS          (0x00001000)
135cf1a573fSOleksandr Tymoshenko #ifndef VM_MAXUSER_ADDRESS
13684233ddbSIan Lepore #define VM_MAXUSER_ADDRESS      (KERNBASE - 0x00400000) /* !!! PT2MAP_SIZE */
13784233ddbSIan Lepore #endif
1386fc729afSOlivier Houchard #define VM_MAX_ADDRESS          VM_MAXUSER_ADDRESS
1396fc729afSOlivier Houchard 
1404d22d07aSKonstantin Belousov #define	SHAREDPAGE		(VM_MAXUSER_ADDRESS - PAGE_SIZE)
1414d22d07aSKonstantin Belousov #define	USRSTACK		SHAREDPAGE
1426fc729afSOlivier Houchard 
1436fc729afSOlivier Houchard /* initial pagein size of beginning of executable file */
1446fc729afSOlivier Houchard #ifndef VM_INITIAL_PAGEIN
1456fc729afSOlivier Houchard #define VM_INITIAL_PAGEIN       16
1466fc729afSOlivier Houchard #endif
1476fc729afSOlivier Houchard 
1486fc729afSOlivier Houchard #ifndef VM_MIN_KERNEL_ADDRESS
1496fc729afSOlivier Houchard #define VM_MIN_KERNEL_ADDRESS KERNBASE
1506fc729afSOlivier Houchard #endif
1516fc729afSOlivier Houchard 
152fc23011bSAlan Cox #define	VM_MAX_KERNEL_ADDRESS	(vm_max_kernel_address)
1531211375fSAndre Oppermann 
1546fc729afSOlivier Houchard /*
155c70af487SAlan Cox  * How many physical pages per kmem arena virtual page.
1565b17d1f9SOlivier Houchard  */
1571211375fSAndre Oppermann #ifndef VM_KMEM_SIZE_SCALE
158219d9565SAlan Cox #define	VM_KMEM_SIZE_SCALE	(3)
1591211375fSAndre Oppermann #endif
1606fc729afSOlivier Houchard 
161837a2c51SAlan Cox /*
162c70af487SAlan Cox  * Optional floor (in bytes) on the size of the kmem arena.
163c70af487SAlan Cox  */
164c70af487SAlan Cox #ifndef VM_KMEM_SIZE_MIN
165c70af487SAlan Cox #define	VM_KMEM_SIZE_MIN	(12 * 1024 * 1024)
166c70af487SAlan Cox #endif
167c70af487SAlan Cox 
168c70af487SAlan Cox /*
169c70af487SAlan Cox  * Optional ceiling (in bytes) on the size of the kmem arena: 40% of the
170c70af487SAlan Cox  * kernel map.
171837a2c51SAlan Cox  */
172837a2c51SAlan Cox #ifndef VM_KMEM_SIZE_MAX
173e137643eSOlivier Houchard #define	VM_KMEM_SIZE_MAX	((vm_max_kernel_address - \
174e137643eSOlivier Houchard     VM_MIN_KERNEL_ADDRESS + 1) * 2 / 5)
175837a2c51SAlan Cox #endif
176837a2c51SAlan Cox 
177fc23011bSAlan Cox extern vm_offset_t vm_max_kernel_address;
178fc23011bSAlan Cox 
179cfb00e5aSMatthew D Fleming #define	ZERO_REGION_SIZE	(64 * 1024)	/* 64KB */
180cfb00e5aSMatthew D Fleming 
18199c89998SAlan Cox #ifndef VM_MAX_AUTOTUNE_MAXUSERS
18299c89998SAlan Cox #define	VM_MAX_AUTOTUNE_MAXUSERS	384
18399c89998SAlan Cox #endif
18499c89998SAlan Cox 
185c8d2ffd6SGleb Smirnoff #define	SFBUF
186c8d2ffd6SGleb Smirnoff #define	SFBUF_MAP
187c8d2ffd6SGleb Smirnoff 
1889a8196ceSNathan Whitehorn #define	PMAP_HAS_DMAP	0
189ad6b97e7SNathan Whitehorn #define	PHYS_TO_DMAP(x)	({ panic("No direct map exists"); 0; })
190ad6b97e7SNathan Whitehorn #define	DMAP_TO_PHYS(x)	({ panic("No direct map exists"); 0; })
1919a8196ceSNathan Whitehorn 
19230b72b68SRuslan Bukin #define	DEVMAP_MAX_VADDR	ARM_VECTORS_HIGH
19330b72b68SRuslan Bukin 
194ab041f71SD Scott Phillips /*
19578257765SMark Johnston  * No non-transparent large page support in the pmap.
19678257765SMark Johnston  */
19778257765SMark Johnston #define	PMAP_HAS_LARGEPAGES	0
19878257765SMark Johnston 
19978257765SMark Johnston /*
200ab041f71SD Scott Phillips  * Need a page dump array for minidump.
201ab041f71SD Scott Phillips  */
202ab041f71SD Scott Phillips #define MINIDUMP_PAGE_TRACKING	1
203*0a44b8a5SBojan Novković #define MINIDUMP_STARTUP_PAGE_TRACKING 0
204ab041f71SD Scott Phillips 
2056fc729afSOlivier Houchard #endif	/* _MACHINE_VMPARAM_H_ */
206