Annotation of src/sys/arch/aarch64/include/vmparam.h, Revision 1.4.2.2
1.4.2.2 ! martin 1: /* $NetBSD$ */
1.1 matt 2:
3: /*-
4: * Copyright (c) 2014 The NetBSD Foundation, Inc.
5: * All rights reserved.
6: *
7: * This code is derived from software contributed to The NetBSD Foundation
8: * by Matt Thomas of 3am Software Foundry.
9: *
10: * Redistribution and use in source and binary forms, with or without
11: * modification, are permitted provided that the following conditions
12: * are met:
13: * 1. Redistributions of source code must retain the above copyright
14: * notice, this list of conditions and the following disclaimer.
15: * 2. Redistributions in binary form must reproduce the above copyright
16: * notice, this list of conditions and the following disclaimer in the
17: * documentation and/or other materials provided with the distribution.
18: *
19: * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20: * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21: * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22: * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23: * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24: * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25: * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26: * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27: * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28: * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29: * POSSIBILITY OF SUCH DAMAGE.
30: */
31:
32: #ifndef _AARCH64_VMPARAM_H_
33: #define _AARCH64_VMPARAM_H_
34:
35: #ifdef __aarch64__
36:
1.3 ryo 37: #define __USE_TOPDOWN_VM
38:
1.1 matt 39: /*
1.4 jmcneill 40: * Default pager_map of 16MB is small and we have plenty of VA to burn.
41: */
42: #define PAGER_MAP_DEFAULT_SIZE (512 * 1024 * 1024)
43:
44: /*
1.4.2.2 ! martin 45: * Defaults for Unified Buffer Cache parameters.
! 46: */
! 47:
! 48: #ifndef UBC_WINSHIFT
! 49: #define UBC_WINSHIFT 16 /* 64kB */
! 50: #endif
! 51: #ifndef UBC_NWINS
! 52: #define UBC_NWINS 4096 /* 256MB */
! 53: #endif
! 54:
! 55: /*
1.1 matt 56: * AARCH64 supports 3 page sizes: 4KB, 16KB, 64KB. Each page table can
57: * even have its own page size.
58: */
59:
60: #ifdef AARCH64_PAGE_SHIFT
61: #if (1 << AARCH64_PAGE_SHIFT) & ~0x141000
62: #error AARCH64_PAGE_SHIFT contains an unsupported value.
63: #endif
64: #define PAGE_SHIFT AARCH64_PAGE_SHIFT
65: #else
66: #define PAGE_SHIFT 12
67: #endif
68: #define PAGE_SIZE (1 << PAGE_SHIFT)
69: #define PAGE_MASK (PAGE_SIZE - 1)
70:
71: #if PAGE_SHIFT <= 14
1.3 ryo 72: #define USPACE 32768
1.1 matt 73: #else
74: #define USPACE 65536
75: #endif
76: #define UPAGES (USPACE >> PAGE_SHIFT)
77:
78: /*
79: * USRSTACK is the top (end) of the user stack. The user VA space is a
80: * 48-bit address space starting at 0. Place the stack at its top end.
81: */
1.3 ryo 82: #define USRSTACK VM_MAXUSER_ADDRESS
1.1 matt 83:
84: #ifndef MAXTSIZ
85: #define MAXTSIZ (1L << 30) /* max text size (1GB) */
86: #endif
87:
88: #ifndef MAXDSIZ
89: #define MAXDSIZ (1L << 36) /* max data size (64GB) */
90: #endif
91:
92: #ifndef MAXSSIZ
93: #define MAXSSIZ (1L << 26) /* max stack size (64MB) */
94: #endif
95:
96: #ifndef DFLDSIZ
97: #define DFLDSIZ (1L << 32) /* default data size (4GB) */
98: #endif
99:
1.3 ryo 100: #ifndef DFLSSIZ
101: #define DFLSSIZ (1L << 23) /* default stack size (8MB) */
102: #endif
103:
104: #define USRSTACK32 VM_MAXUSER_ADDRESS32
105:
106: #ifndef MAXTSIZ32
107: #define MAXTSIZ32 (1L << 26) /* 32bit max text size (64MB) */
108: #endif
109:
110: #ifndef MAXDSIZ32
1.4.2.1 christos 111: #define MAXDSIZ32 (3U*1024*1024*1024) /* max data size */
1.3 ryo 112: #endif
113:
114: #ifndef MAXSSIZ32
115: #define MAXSSIZ32 (64*1024*1024) /* max stack size */
116: #endif
117:
1.1 matt 118: #ifndef DFLDSIZ32
119: #define DFLDSIZ32 (1L << 27) /* 32bit default data size (128MB) */
120: #endif
121:
122: #ifndef DFLSSIZ32
123: #define DFLSSIZ32 (1L << 21) /* 32bit default stack size (2MB) */
124: #endif
125:
126: #define VM_MIN_ADDRESS ((vaddr_t) 0x0)
127: #define VM_MAXUSER_ADDRESS ((vaddr_t) (1L << 48) - PAGE_SIZE)
128: #define VM_MAX_ADDRESS VM_MAXUSER_ADDRESS
129:
1.4.2.1 christos 130: #define VM_MAXUSER_ADDRESS32 ((vaddr_t) 0xfffff000)
1.1 matt 131:
132: /*
1.4.2.2 ! martin 133: * kernel virtual space layout:
! 134: * 0xffff000000000000- 64T KSEG(direct mapping)
! 135: * 0xffff400000000000- 32T (KASAN SHADOW MAP)
! 136: * 0xffff600000000000- 32T (not used)
! 137: * 0xffff800000000000- 1G EFI_RUNTIME
! 138: * 0xffff800040000000- 64T (not used)
! 139: * 0xffffc00000000000- 64T KERNEL VM Space (including kernel text/data/bss)
! 140: * 0xfffffffff0000000- 254M KERNEL_IO for pmap_devmap
! 141: * 0xffffffffffe00000- 2M RESERVED
1.1 matt 142: */
1.4.2.2 ! martin 143: #define VM_MIN_KERNEL_ADDRESS ((vaddr_t) 0xffffc00000000000L)
1.3 ryo 144: #define VM_MAX_KERNEL_ADDRESS ((vaddr_t) 0xffffffffffe00000L)
145:
146: /*
147: * last 254MB of kernel vm area (0xfffffffff0000000-0xffffffffffe00000)
148: * may be used for devmap. address must be aligned 2MB (L2_SIZE)
149: * see also aarch64/pmap.c:pmap_devmap_*
150: */
151: #define VM_KERNEL_IO_ADDRESS 0xfffffffff0000000L
1.4.2.1 christos 152: #define VM_KERNEL_IO_SIZE (VM_MAX_KERNEL_ADDRESS - VM_KERNEL_IO_ADDRESS)
153:
154: /*
155: * Reserved space for EFI runtime services
156: */
157: #define EFI_RUNTIME_VA 0xffff800000000000L
158: #define EFI_RUNTIME_SIZE 0x0000000040000000L
1.1 matt 159:
160: /* virtual sizes (bytes) for various kernel submaps */
161: #define USRIOSIZE (PAGE_SIZE / 8)
162: #define VM_PHYS_SIZE (USRIOSIZE * PAGE_SIZE)
163:
1.4.2.1 christos 164: #define VM_DEFAULT_ADDRESS32_TOPDOWN(da, sz) \
165: trunc_page(USRSTACK32 - MAXSSIZ32 - (sz) - user_stack_guard_size)
166: #define VM_DEFAULT_ADDRESS32_BOTTOMUP(da, sz) \
167: round_page((vaddr_t)(da) + (vsize_t)MAXDSIZ32)
168:
1.1 matt 169: /*
170: * Since we have the address space, we map all of physical memory (RAM)
171: * using block page table entries.
172: */
173: #define AARCH64_KSEG_MASK ((vaddr_t) 0xffff000000000000L)
1.4.2.2 ! martin 174: #define AARCH64_KSEG_SIZE (1UL << 46) /* 64TB */
1.1 matt 175: #define AARCH64_KSEG_START AARCH64_KSEG_MASK
1.3 ryo 176: #define AARCH64_KSEG_END (AARCH64_KSEG_START + AARCH64_KSEG_SIZE)
177: #define AARCH64_KMEMORY_BASE AARCH64_KSEG_MASK
1.1 matt 178: #define AARCH64_KVA_P(va) (((vaddr_t) (va) & AARCH64_KSEG_MASK) != 0)
179: #define AARCH64_PA_TO_KVA(pa) ((vaddr_t) ((pa) | AARCH64_KSEG_START))
1.3 ryo 180: #define AARCH64_KVA_TO_PA(va) ((paddr_t) ((va) & ~AARCH64_KSEG_MASK))
1.1 matt 181:
182: /* */
1.4.2.1 christos 183: #define VM_PHYSSEG_MAX 64 /* XXX */
1.1 matt 184: #define VM_PHYSSEG_STRAT VM_PSTRAT_BSEARCH
185:
1.4.2.2 ! martin 186: #define VM_NFREELIST 1
1.3 ryo 187: #define VM_FREELIST_DEFAULT 0
1.1 matt 188:
189: #elif defined(__arm__)
190:
191: #include <arm/vmparam.h>
192:
193: #endif /* __aarch64__/__arm__ */
194:
195: #endif /* _AARCH64_VMPARAM_H_ */
CVSweb <webmaster@jp.NetBSD.org>