xref: /freebsd/sys/arm/include/vmparam.h (revision ab041f713aeccdf23b4805ffb71815c8d4aa9c88)
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  * $FreeBSD$
346fc729afSOlivier Houchard  */
356fc729afSOlivier Houchard 
366fc729afSOlivier Houchard #ifndef	_MACHINE_VMPARAM_H_
376fc729afSOlivier Houchard #define	_MACHINE_VMPARAM_H_
386fc729afSOlivier Houchard 
39e40f53aaSAndrew Turner /*
40e40f53aaSAndrew Turner  * Machine dependent constants for ARM.
416fc729afSOlivier Houchard  */
42e40f53aaSAndrew Turner 
43e40f53aaSAndrew Turner /*
44e40f53aaSAndrew Turner  * Virtual memory related constants, all in bytes
45e40f53aaSAndrew Turner  */
46e40f53aaSAndrew Turner #ifndef	MAXTSIZ
47d304b9ecSMichal Meloun #define	MAXTSIZ		(256UL*1024*1024)	/* max text size */
48e40f53aaSAndrew Turner #endif
49e40f53aaSAndrew Turner #ifndef	DFLDSIZ
50e40f53aaSAndrew Turner #define	DFLDSIZ		(128UL*1024*1024)	/* initial data size limit */
51e40f53aaSAndrew Turner #endif
52e40f53aaSAndrew Turner #ifndef	MAXDSIZ
53e40f53aaSAndrew Turner #define	MAXDSIZ		(512UL*1024*1024)	/* max data size */
54e40f53aaSAndrew Turner #endif
55e40f53aaSAndrew Turner #ifndef	DFLSSIZ
56e40f53aaSAndrew Turner #define	DFLSSIZ		(2UL*1024*1024)		/* initial stack size limit */
57e40f53aaSAndrew Turner #endif
58e40f53aaSAndrew Turner #ifndef	MAXSSIZ
59e40f53aaSAndrew Turner #define	MAXSSIZ		(8UL*1024*1024)		/* max stack size */
60e40f53aaSAndrew Turner #endif
61e40f53aaSAndrew Turner #ifndef	SGROWSIZ
62e40f53aaSAndrew Turner #define	SGROWSIZ	(128UL*1024)		/* amount to grow stack */
63e40f53aaSAndrew Turner #endif
64e40f53aaSAndrew Turner 
656fc729afSOlivier Houchard /*
666fc729afSOlivier Houchard  * Address space constants
676fc729afSOlivier Houchard  */
686fc729afSOlivier Houchard 
696fc729afSOlivier Houchard /*
706fc729afSOlivier Houchard  * The line between user space and kernel space
716fc729afSOlivier Houchard  * Mappings >= KERNEL_BASE are constant across all processes
726fc729afSOlivier Houchard  */
7337143b98SZbigniew Bodek #ifndef KERNBASE
746fc729afSOlivier Houchard #define	KERNBASE		0xc0000000
7537143b98SZbigniew Bodek #endif
766fc729afSOlivier Houchard 
776fc729afSOlivier Houchard /*
782d09b072SIan Lepore  * The virtual address the kernel is linked to run at.  For armv4/5 platforms
792d09b072SIan Lepore  * the low-order 30 bits of this must match the low-order bits of the physical
802d09b072SIan Lepore  * address the kernel is loaded at, so the value is most often provided as a
812d09b072SIan Lepore  * kernel config option in the std.platform file. For armv6/7 the kernel can
822d09b072SIan Lepore  * be loaded at any 2MB boundary, and KERNVIRTADDR can also be set to any 2MB
832d09b072SIan Lepore  * boundary.  It is typically overridden in the std.platform file only when
842d09b072SIan Lepore  * KERNBASE is also set to a lower address to provide more KVA.
852d09b072SIan Lepore  */
862d09b072SIan Lepore #ifndef KERNVIRTADDR
872d09b072SIan Lepore #define	KERNVIRTADDR		0xc0000000
882d09b072SIan Lepore #endif
892d09b072SIan Lepore 
902d09b072SIan Lepore /*
916fc729afSOlivier Houchard  * max number of non-contig chunks of physical RAM you can have
926fc729afSOlivier Houchard  */
936fc729afSOlivier Houchard 
946fc729afSOlivier Houchard #define	VM_PHYSSEG_MAX		32
956fc729afSOlivier Houchard 
966fc729afSOlivier Houchard /*
970b7d5b8fSIan Lepore  * The physical address space may be sparsely populated on some ARM systems.
9804a18977SAlan Cox  */
990b7d5b8fSIan Lepore #define	VM_PHYSSEG_SPARSE
10004a18977SAlan Cox 
10104a18977SAlan Cox /*
102966272caSAlan Cox  * Create one free page pool.  Since the ARM kernel virtual address
103007aeeceSIan Lepore  * space does not include a mapping onto the machine's entire physical
104007aeeceSIan Lepore  * memory, VM_FREEPOOL_DIRECT is defined as an alias for the default
105007aeeceSIan Lepore  * pool, VM_FREEPOOL_DEFAULT.
1069211decaSAlan Cox  */
107966272caSAlan Cox #define	VM_NFREEPOOL		1
108b603e095SAlan Cox #define	VM_FREEPOOL_DEFAULT	0
109007aeeceSIan Lepore #define	VM_FREEPOOL_DIRECT	0
1109211decaSAlan Cox 
1119211decaSAlan Cox /*
112e69ba7c7SIan Lepore  * We need just one free list:  DEFAULT.
1136fc729afSOlivier Houchard  */
114e69ba7c7SIan Lepore #define	VM_NFREELIST		1
1156fc729afSOlivier Houchard #define	VM_FREELIST_DEFAULT	0
1166fc729afSOlivier Houchard 
1179211decaSAlan Cox /*
1189211decaSAlan Cox  * The largest allocation size is 1MB.
1199211decaSAlan Cox  */
1209211decaSAlan Cox #define	VM_NFREEORDER		9
1219211decaSAlan Cox 
122b8e7fc24SAlan Cox /*
123995c2b63SRafal Jaworowski  * Enable superpage reservations: 1 level.
124b8e7fc24SAlan Cox  */
125b8e7fc24SAlan Cox #ifndef	VM_NRESERVLEVEL
126995c2b63SRafal Jaworowski #define	VM_NRESERVLEVEL		1
127995c2b63SRafal Jaworowski #endif
128995c2b63SRafal Jaworowski 
129995c2b63SRafal Jaworowski /*
130995c2b63SRafal Jaworowski  * Level 0 reservations consist of 256 pages.
131995c2b63SRafal Jaworowski  */
132995c2b63SRafal Jaworowski #ifndef	VM_LEVEL_0_ORDER
133995c2b63SRafal Jaworowski #define	VM_LEVEL_0_ORDER	8
134b8e7fc24SAlan Cox #endif
135b8e7fc24SAlan Cox 
1366fc729afSOlivier Houchard #define VM_MIN_ADDRESS          (0x00001000)
137cf1a573fSOleksandr Tymoshenko #ifndef VM_MAXUSER_ADDRESS
13884233ddbSIan Lepore #define VM_MAXUSER_ADDRESS      (KERNBASE - 0x00400000) /* !!! PT2MAP_SIZE */
13984233ddbSIan Lepore #endif
1406fc729afSOlivier Houchard #define VM_MAX_ADDRESS          VM_MAXUSER_ADDRESS
1416fc729afSOlivier Houchard 
1424d22d07aSKonstantin Belousov #define	SHAREDPAGE		(VM_MAXUSER_ADDRESS - PAGE_SIZE)
1434d22d07aSKonstantin Belousov #define	USRSTACK		SHAREDPAGE
1446fc729afSOlivier Houchard 
1456fc729afSOlivier Houchard /* initial pagein size of beginning of executable file */
1466fc729afSOlivier Houchard #ifndef VM_INITIAL_PAGEIN
1476fc729afSOlivier Houchard #define VM_INITIAL_PAGEIN       16
1486fc729afSOlivier Houchard #endif
1496fc729afSOlivier Houchard 
1506fc729afSOlivier Houchard #ifndef VM_MIN_KERNEL_ADDRESS
1516fc729afSOlivier Houchard #define VM_MIN_KERNEL_ADDRESS KERNBASE
1526fc729afSOlivier Houchard #endif
1536fc729afSOlivier Houchard 
154fc23011bSAlan Cox #define	VM_MAX_KERNEL_ADDRESS	(vm_max_kernel_address)
1551211375fSAndre Oppermann 
1566fc729afSOlivier Houchard /*
157c70af487SAlan Cox  * How many physical pages per kmem arena virtual page.
1585b17d1f9SOlivier Houchard  */
1591211375fSAndre Oppermann #ifndef VM_KMEM_SIZE_SCALE
160219d9565SAlan Cox #define	VM_KMEM_SIZE_SCALE	(3)
1611211375fSAndre Oppermann #endif
1626fc729afSOlivier Houchard 
163837a2c51SAlan Cox /*
164c70af487SAlan Cox  * Optional floor (in bytes) on the size of the kmem arena.
165c70af487SAlan Cox  */
166c70af487SAlan Cox #ifndef VM_KMEM_SIZE_MIN
167c70af487SAlan Cox #define	VM_KMEM_SIZE_MIN	(12 * 1024 * 1024)
168c70af487SAlan Cox #endif
169c70af487SAlan Cox 
170c70af487SAlan Cox /*
171c70af487SAlan Cox  * Optional ceiling (in bytes) on the size of the kmem arena: 40% of the
172c70af487SAlan Cox  * kernel map.
173837a2c51SAlan Cox  */
174837a2c51SAlan Cox #ifndef VM_KMEM_SIZE_MAX
175e137643eSOlivier Houchard #define	VM_KMEM_SIZE_MAX	((vm_max_kernel_address - \
176e137643eSOlivier Houchard     VM_MIN_KERNEL_ADDRESS + 1) * 2 / 5)
177837a2c51SAlan Cox #endif
178837a2c51SAlan Cox 
179fc23011bSAlan Cox extern vm_offset_t vm_max_kernel_address;
180fc23011bSAlan Cox 
181cfb00e5aSMatthew D Fleming #define	ZERO_REGION_SIZE	(64 * 1024)	/* 64KB */
182cfb00e5aSMatthew D Fleming 
18399c89998SAlan Cox #ifndef VM_MAX_AUTOTUNE_MAXUSERS
18499c89998SAlan Cox #define	VM_MAX_AUTOTUNE_MAXUSERS	384
18599c89998SAlan Cox #endif
18699c89998SAlan Cox 
187c8d2ffd6SGleb Smirnoff #define	SFBUF
188c8d2ffd6SGleb Smirnoff #define	SFBUF_MAP
189c8d2ffd6SGleb Smirnoff 
1909a8196ceSNathan Whitehorn #define	PMAP_HAS_DMAP	0
191ad6b97e7SNathan Whitehorn #define	PHYS_TO_DMAP(x)	({ panic("No direct map exists"); 0; })
192ad6b97e7SNathan Whitehorn #define	DMAP_TO_PHYS(x)	({ panic("No direct map exists"); 0; })
1939a8196ceSNathan Whitehorn 
19430b72b68SRuslan Bukin #define	DEVMAP_MAX_VADDR	ARM_VECTORS_HIGH
19530b72b68SRuslan Bukin 
196*ab041f71SD Scott Phillips /*
197*ab041f71SD Scott Phillips  * Need a page dump array for minidump.
198*ab041f71SD Scott Phillips  */
199*ab041f71SD Scott Phillips #define MINIDUMP_PAGE_TRACKING	1
200*ab041f71SD Scott Phillips 
2016fc729afSOlivier Houchard #endif	/* _MACHINE_VMPARAM_H_ */
202