1 | /** @file
|
---|
2 | * VirtualBox Parameter Definitions. (VMM,+)
|
---|
3 | *
|
---|
4 | * param.mac is generated from this file by running 'kmk incs' in the root.
|
---|
5 | */
|
---|
6 |
|
---|
7 | /*
|
---|
8 | * Copyright (C) 2006-2023 Oracle and/or its affiliates.
|
---|
9 | *
|
---|
10 | * This file is part of VirtualBox base platform packages, as
|
---|
11 | * available from https://www.virtualbox.org.
|
---|
12 | *
|
---|
13 | * This program is free software; you can redistribute it and/or
|
---|
14 | * modify it under the terms of the GNU General Public License
|
---|
15 | * as published by the Free Software Foundation, in version 3 of the
|
---|
16 | * License.
|
---|
17 | *
|
---|
18 | * This program is distributed in the hope that it will be useful, but
|
---|
19 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
21 | * General Public License for more details.
|
---|
22 | *
|
---|
23 | * You should have received a copy of the GNU General Public License
|
---|
24 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
25 | *
|
---|
26 | * The contents of this file may alternatively be used under the terms
|
---|
27 | * of the Common Development and Distribution License Version 1.0
|
---|
28 | * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
|
---|
29 | * in the VirtualBox distribution, in which case the provisions of the
|
---|
30 | * CDDL are applicable instead of those of the GPL.
|
---|
31 | *
|
---|
32 | * You may elect to license modified versions of this file under the
|
---|
33 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
34 | *
|
---|
35 | * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
|
---|
36 | */
|
---|
37 |
|
---|
38 | #ifndef VBOX_INCLUDED_param_h
|
---|
39 | #define VBOX_INCLUDED_param_h
|
---|
40 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
41 | # pragma once
|
---|
42 | #endif
|
---|
43 |
|
---|
44 | #include <iprt/param.h>
|
---|
45 | #include <iprt/cdefs.h>
|
---|
46 |
|
---|
47 |
|
---|
48 | /** @defgroup grp_vbox_param VBox Parameter Definition
|
---|
49 | * @{
|
---|
50 | */
|
---|
51 |
|
---|
52 | /** The guest page size (x86). */
|
---|
53 | #define GUEST_PAGE_SIZE 0x1000
|
---|
54 | /** The guest page offset mask (x86).
|
---|
55 | * @note If one-complementing this, always put a typecast after the operator! */
|
---|
56 | #define GUEST_PAGE_OFFSET_MASK 0xfff
|
---|
57 | /** The guest page shift (x86). */
|
---|
58 | #define GUEST_PAGE_SHIFT 12
|
---|
59 |
|
---|
60 | /** Host page size. */
|
---|
61 | #define HOST_PAGE_SIZE PAGE_SIZE
|
---|
62 | /** Host page offset mask.
|
---|
63 | * @note If one-complementing this, always put a typecast after the operator! */
|
---|
64 | #define HOST_PAGE_OFFSET_MASK PAGE_OFFSET_MASK
|
---|
65 | /** Host page shift. */
|
---|
66 | #define HOST_PAGE_SHIFT PAGE_SHIFT
|
---|
67 |
|
---|
68 |
|
---|
69 | /** The maximum number of pages that can be allocated and mapped
|
---|
70 | * by various MM, PGM and SUP APIs. */
|
---|
71 | #if ARCH_BITS == 64
|
---|
72 | # define VBOX_MAX_ALLOC_PAGE_COUNT (_512M / PAGE_SIZE)
|
---|
73 | #else
|
---|
74 | # define VBOX_MAX_ALLOC_PAGE_COUNT (_256M / PAGE_SIZE)
|
---|
75 | #endif
|
---|
76 |
|
---|
77 | /** @def VBOX_WITH_PAGE_SHARING
|
---|
78 | * Enables the page sharing code.
|
---|
79 | * @remarks This must match GMMR0Init; currently we only support page fusion on
|
---|
80 | * all 64-bit hosts except Mac OS X */
|
---|
81 | #if ( HC_ARCH_BITS == 64 /* ASM-NOINC */ \
|
---|
82 | && (defined(RT_OS_FREEBSD) || defined(RT_OS_LINUX) || defined(RT_OS_SOLARIS) || defined(RT_OS_WINDOWS)) ) /* ASM-NOINC */ \
|
---|
83 | || defined(DOXYGEN_RUNNING) /* ASM-NOINC */
|
---|
84 | # define VBOX_WITH_PAGE_SHARING /* ASM-NOINC */
|
---|
85 | #endif /* ASM-NOINC */
|
---|
86 |
|
---|
87 |
|
---|
88 | /** @defgroup grp_vbox_param_mm Memory Monitor Parameters
|
---|
89 | * @{
|
---|
90 | */
|
---|
91 | /** Initial address of Hypervisor Memory Area.
|
---|
92 | * MUST BE PAGE TABLE ALIGNED! */
|
---|
93 | #define MM_HYPER_AREA_ADDRESS UINT32_C(0xa0000000)
|
---|
94 |
|
---|
95 | /** The max size of the hypervisor memory area. */
|
---|
96 | #define MM_HYPER_AREA_MAX_SIZE (40U * _1M) /**< @todo Readjust when floating RAMRANGEs have been implemented. Used to be 20 * _1MB */
|
---|
97 |
|
---|
98 | /** Maximum number of bytes we can dynamically map into the hypervisor region.
|
---|
99 | * This must be a power of 2 number of pages!
|
---|
100 | */
|
---|
101 | #define MM_HYPER_DYNAMIC_SIZE (16U * PAGE_SIZE)
|
---|
102 |
|
---|
103 | /** The minimum guest RAM size in bytes. */
|
---|
104 | #define MM_RAM_MIN UINT32_C(0x00400000)
|
---|
105 | /** The maximum guest RAM size in bytes. */
|
---|
106 | #if HC_ARCH_BITS == 64
|
---|
107 | # define MM_RAM_MAX UINT64_C(0x20000000000)
|
---|
108 | #else
|
---|
109 | # define MM_RAM_MAX UINT64_C(0x000E0000000)
|
---|
110 | #endif
|
---|
111 | /** The minimum guest RAM size in MBs. */
|
---|
112 | #define MM_RAM_MIN_IN_MB UINT32_C(4)
|
---|
113 | /** The maximum guest RAM size in MBs. */
|
---|
114 | #if HC_ARCH_BITS == 64
|
---|
115 | # define MM_RAM_MAX_IN_MB UINT32_C(2097152)
|
---|
116 | #else
|
---|
117 | # define MM_RAM_MAX_IN_MB UINT32_C(3584)
|
---|
118 | #endif
|
---|
119 | /** The default size of the below 4GB RAM hole. */
|
---|
120 | #define MM_RAM_HOLE_SIZE_DEFAULT (512U * _1M)
|
---|
121 | /** The maximum 64-bit MMIO BAR size.
|
---|
122 | * @remarks There isn't really any limit here other than the size of the
|
---|
123 | * tracking structures we need (around 1/256 of the size). */
|
---|
124 | #if HC_ARCH_BITS == 64
|
---|
125 | # define MM_MMIO_64_MAX _1T
|
---|
126 | #else
|
---|
127 | # define MM_MMIO_64_MAX (_1G64 * 16)
|
---|
128 | #endif
|
---|
129 | /** The maximum 32-bit MMIO BAR size. */
|
---|
130 | #define MM_MMIO_32_MAX _2G
|
---|
131 |
|
---|
132 | /** @} */
|
---|
133 |
|
---|
134 | /** @defgroup grp_vbox_param_pdm Pluggable Device Manager Parameters
|
---|
135 | * @{
|
---|
136 | */
|
---|
137 | /** Max number of network shaper groups. */
|
---|
138 | #define PDM_NET_SHAPER_MAX_GROUPS 32
|
---|
139 | /** Max length of a network shaper group name (excluding terminator). */
|
---|
140 | #define PDM_NET_SHAPER_MAX_NAME_LEN 63
|
---|
141 | /** @} */
|
---|
142 |
|
---|
143 |
|
---|
144 | /** @defgroup grp_vbox_param_pgm Page Manager Parameters
|
---|
145 | * @{
|
---|
146 | */
|
---|
147 | /** The number of handy pages.
|
---|
148 | * This should be a power of two. */
|
---|
149 | #define PGM_HANDY_PAGES 128
|
---|
150 | /** The threshold at which allocation of more handy pages is flagged. */
|
---|
151 | #define PGM_HANDY_PAGES_SET_FF 32
|
---|
152 | /** The threshold at which we will allocate more when in ring-3.
|
---|
153 | * This is must be smaller than both PGM_HANDY_PAGES_SET_FF and
|
---|
154 | * PGM_HANDY_PAGES_MIN. */
|
---|
155 | #define PGM_HANDY_PAGES_R3_ALLOC 8
|
---|
156 | /** The threshold at which we will allocate more when in ring-0 or raw mode.
|
---|
157 | * The idea is that we should never go below this threshold while in ring-0 or
|
---|
158 | * raw mode because of PGM_HANDY_PAGES_RZ_TO_R3. However, should this happen and
|
---|
159 | * we are actually out of memory, we will have 8 page to get out of whatever
|
---|
160 | * code we're executing.
|
---|
161 | *
|
---|
162 | * This is must be smaller than both PGM_HANDY_PAGES_SET_FF and
|
---|
163 | * PGM_HANDY_PAGES_MIN. */
|
---|
164 | #define PGM_HANDY_PAGES_RZ_ALLOC 8
|
---|
165 | /** The threshold at which we force return to R3 ASAP.
|
---|
166 | * The idea is that this should be large enough to get out of any code and up to
|
---|
167 | * the main EM loop when we are out of memory.
|
---|
168 | * This must be less or equal to PGM_HANDY_PAGES_MIN. */
|
---|
169 | #define PGM_HANDY_PAGES_RZ_TO_R3 24
|
---|
170 | /** The minimum number of handy pages (after allocation).
|
---|
171 | * This must be greater or equal to PGM_HANDY_PAGES_SET_FF.
|
---|
172 | * Another name would be PGM_HANDY_PAGES_EXTRA_RESERVATION or _PARANOIA. :-) */
|
---|
173 | #define PGM_HANDY_PAGES_MIN 32
|
---|
174 | /** @} */
|
---|
175 |
|
---|
176 |
|
---|
177 | /** @defgroup grp_vbox_param_vmm VMM Parameters
|
---|
178 | * @{
|
---|
179 | */
|
---|
180 | /** VMM stack size. */
|
---|
181 | #ifdef RT_OS_DARWIN
|
---|
182 | # define VMM_STACK_SIZE 16384U
|
---|
183 | #else
|
---|
184 | # define VMM_STACK_SIZE 8192U
|
---|
185 | #endif
|
---|
186 | /** Min number of Virtual CPUs. */
|
---|
187 | #define VMM_MIN_CPU_COUNT 1
|
---|
188 | /** Max number of Virtual CPUs. */
|
---|
189 | #define VMM_MAX_CPU_COUNT 64
|
---|
190 |
|
---|
191 | /** @} */
|
---|
192 |
|
---|
193 |
|
---|
194 | /** @defgroup grp_vbox_pci PCI Identifiers
|
---|
195 | * @{ */
|
---|
196 | /** VirtualBox PCI vendor ID. */
|
---|
197 | #define VBOX_PCI_VENDORID (0x80ee)
|
---|
198 |
|
---|
199 | /** @name VirtualBox graphics card identifiers
|
---|
200 | * @{ */
|
---|
201 | #define VBOX_VENDORID VBOX_PCI_VENDORID /**< @todo wonderful choice of name! Please squeeze a _VGA_ or something in there, please. */
|
---|
202 | #define VBOX_DEVICEID (0xbeef) /**< @todo ditto. */
|
---|
203 | #define VBOX_VESA_VENDORID VBOX_PCI_VENDORID
|
---|
204 | #define VBOX_VESA_DEVICEID (0xbeef)
|
---|
205 | /** @} */
|
---|
206 |
|
---|
207 | /** @name VMMDev PCI card identifiers
|
---|
208 | * @{ */
|
---|
209 | #define VMMDEV_VENDORID VBOX_PCI_VENDORID
|
---|
210 | #define VMMDEV_DEVICEID (0xcafe)
|
---|
211 | /** @} */
|
---|
212 |
|
---|
213 | /** @} */
|
---|
214 |
|
---|
215 |
|
---|
216 | /** @defgroup grp_vbox_param_misc Misc
|
---|
217 | * @{ */
|
---|
218 |
|
---|
219 | /** The maximum size of a generic segment offload (GSO) frame. This limit is
|
---|
220 | * imposed by the 16-bit frame size in internal networking header. */
|
---|
221 | #define VBOX_MAX_GSO_SIZE 0xfff0
|
---|
222 |
|
---|
223 | /** @} */
|
---|
224 |
|
---|
225 |
|
---|
226 | /** @} */
|
---|
227 |
|
---|
228 | #endif /* !VBOX_INCLUDED_param_h */
|
---|
229 |
|
---|