VirtualBox

source: vbox/trunk/include/VBox/param.h

Last change on this file was 108968, checked in by vboxsync, 5 weeks ago

VMM,Main,Devices: Respect VBOX_VMM_TARGET_ARMV8 correctly on amd64 hosts (for IEM debugging purposes). jiraref:VBP-1598

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 10.4 KB
Line 
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-2024 Oracle and/or its affiliates.
9 *
10 * This file is part of VirtualBox base platform packages, as
11 * available from https://www.215389.xyz.
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#ifdef VMM_HOST_PAGE_SIZE_DYNAMIC
47# include <iprt/system.h>
48#endif
49
50
51/** @defgroup grp_vbox_param VBox Parameter Definition
52 * @{
53 */
54
55/** @def GUEST_MIN_PAGE_SIZE
56 * Minimum guest page size. */
57#define GUEST_MIN_PAGE_SIZE 0x1000
58/** @def GUEST_MIN_PAGE_OFFSET_MASK
59 * Minimum guest page size.
60 * @note If one-complementing this, always put a typecast after the operator! */
61#define GUEST_MIN_PAGE_OFFSET_MASK 0xfff
62/** @def GUEST_MIN_PAGE_SHIFT
63 * Minimum guest page size. */
64#define GUEST_MIN_PAGE_SHIFT 12
65
66/** @def GUEST_MAX_PAGE_SIZE
67 * Maximum guest page size. */
68#ifdef VBOX_VMM_TARGET_ARMV8
69# define GUEST_MAX_PAGE_SIZE 0x10000
70#elif defined(VBOX_VMM_TARGET_X86) || defined(DOXYGEN_RUNNING)
71# define GUEST_MAX_PAGE_SIZE 0x1000
72#endif
73/** @def GUEST_MAX_PAGE_OFFSET_MASK
74 * Maximum guest page size.
75 * @note If one-complementing this, always put a typecast after the operator! */
76#ifdef VBOX_VMM_TARGET_ARMV8
77# define GUEST_MAX_PAGE_OFFSET_MASK 0xffff
78#elif defined(VBOX_VMM_TARGET_X86) || defined(DOXYGEN_RUNNING)
79# define GUEST_MAX_PAGE_OFFSET_MASK 0xfff
80#endif
81/** @def GUEST_MAX_PAGE_SHIFT
82 * Maximum guest page size. */
83#ifdef VBOX_VMM_TARGET_ARMV8
84# define GUEST_MAX_PAGE_SHIFT 16
85#elif defined(VBOX_VMM_TARGET_X86) || defined(DOXYGEN_RUNNING)
86# define GUEST_MAX_PAGE_SHIFT 12
87#endif
88
89/** The guest page size (x86). */
90#define GUEST_PAGE_SIZE 0x1000
91/** The guest page offset mask (x86).
92 * @note If one-complementing this, always put a typecast after the operator! */
93#define GUEST_PAGE_OFFSET_MASK 0xfff
94/** The guest page shift (x86). */
95#define GUEST_PAGE_SHIFT 12
96
97
98/** Host page size. */
99#define HOST_PAGE_SIZE PAGE_SIZE
100/** Host page offset mask.
101 * @note If one-complementing this, always put a typecast after the operator! */
102#define HOST_PAGE_OFFSET_MASK PAGE_OFFSET_MASK
103/** Host page shift. */
104#define HOST_PAGE_SHIFT PAGE_SHIFT
105
106
107/** The host page size which can be dynamic on certain hosts, linux.arm64 for instance */
108#ifdef VMM_HOST_PAGE_SIZE_DYNAMIC
109# define HOST_PAGE_SIZE_DYNAMIC RTSystemGetPageSize()
110#else
111# define HOST_PAGE_SIZE_DYNAMIC HOST_PAGE_SIZE
112#endif
113/** The host page shift which can be dynamic on certain hosts, linux.arm64 for instance */
114#ifdef VMM_HOST_PAGE_SIZE_DYNAMIC
115# define HOST_PAGE_SHIFT_DYNAMIC RTSystemGetPageShift()
116#else
117# define HOST_PAGE_SHIFT_DYNAMIC HOST_PAGE_SHIFT
118#endif
119
120
121/** The maximum memory size that can be allocated and mapped
122 * by various MM, PGM and SUP APIs. */
123#define VBOX_MAX_ALLOC_SIZE _512M
124
125
126/** The maximum number of pages that can be allocated and mapped
127 * by various MM, PGM and SUP APIs. */
128#if ARCH_BITS == 64
129# define VBOX_MAX_ALLOC_PAGE_COUNT (VBOX_MAX_ALLOC_SIZE / PAGE_SIZE)
130#else
131# define VBOX_MAX_ALLOC_PAGE_COUNT (_256M / PAGE_SIZE) /** @todo r=aeichner Remove? */
132#endif
133
134/** @def VBOX_WITH_PAGE_SHARING
135 * Enables the page sharing code on the host side (do not use in guest code).
136 * @remarks Currently we only support page fusion on mainline AMD64 hosts,
137 * except Mac OS X (no ring-0). */
138#if ( HC_ARCH_BITS == 64 /* ASM-NOINC */ \
139 && defined(RT_ARCH_AMD64) /* ASM-NOINC */ \
140 && (defined(RT_OS_FREEBSD) || defined(RT_OS_LINUX) || defined(RT_OS_SOLARIS) || defined(RT_OS_WINDOWS)) ) /* ASM-NOINC */ \
141 && (defined(VBOX_VMM_TARGET_X86) || defined(VBOX_VMM_TARGET_AGNOSTIC)) /* quick hack */ \
142 || defined(DOXYGEN_RUNNING) /* ASM-NOINC */
143# define VBOX_WITH_PAGE_SHARING /* ASM-NOINC */
144#endif /* ASM-NOINC */
145
146
147/** @defgroup grp_vbox_param_mm Memory Monitor Parameters
148 * @{
149 */
150/** Initial address of Hypervisor Memory Area.
151 * MUST BE PAGE TABLE ALIGNED! */
152#define MM_HYPER_AREA_ADDRESS UINT32_C(0xa0000000)
153
154/** The max size of the hypervisor memory area. */
155#define MM_HYPER_AREA_MAX_SIZE (40U * _1M) /**< @todo Readjust when floating RAMRANGEs have been implemented. Used to be 20 * _1MB */
156
157/** Maximum number of bytes we can dynamically map into the hypervisor region.
158 * This must be a power of 2 number of pages!
159 */
160#define MM_HYPER_DYNAMIC_SIZE (16U * PAGE_SIZE)
161
162/** The minimum guest RAM size in bytes. */
163#define MM_RAM_MIN UINT32_C(0x00400000)
164/** The maximum guest RAM size in bytes. */
165#if HC_ARCH_BITS == 64
166# define MM_RAM_MAX UINT64_C(0x20000000000)
167#else
168# define MM_RAM_MAX UINT64_C(0x000E0000000)
169#endif
170/** The minimum guest RAM size in MBs. */
171#define MM_RAM_MIN_IN_MB UINT32_C(4)
172/** The maximum guest RAM size in MBs. */
173#if HC_ARCH_BITS == 64
174# define MM_RAM_MAX_IN_MB UINT32_C(2097152)
175#else
176# define MM_RAM_MAX_IN_MB UINT32_C(3584)
177#endif
178/** The default size of the below 4GB RAM hole. */
179#define MM_RAM_HOLE_SIZE_DEFAULT (512U * _1M)
180/** The maximum 64-bit MMIO BAR size.
181 * @remarks There isn't really any limit here other than the size of the
182 * tracking structures we need (around 1/256 of the size). */
183#if HC_ARCH_BITS == 64
184# define MM_MMIO_64_MAX _1T
185#else
186# define MM_MMIO_64_MAX (_1G64 * 16)
187#endif
188/** The maximum 32-bit MMIO BAR size. */
189#define MM_MMIO_32_MAX _2G
190
191/** @} */
192
193/** @defgroup grp_vbox_param_pdm Pluggable Device Manager Parameters
194 * @{
195 */
196/** Max number of network shaper groups. */
197#define PDM_NET_SHAPER_MAX_GROUPS 32
198/** Max length of a network shaper group name (excluding terminator). */
199#define PDM_NET_SHAPER_MAX_NAME_LEN 63
200/** @} */
201
202
203/** @defgroup grp_vbox_param_pgm Page Manager Parameters
204 * @{
205 */
206/** The number of handy pages.
207 * This should be a power of two. */
208#define PGM_HANDY_PAGES 128
209/** The threshold at which allocation of more handy pages is flagged. */
210#define PGM_HANDY_PAGES_SET_FF 32
211/** The threshold at which we will allocate more when in ring-3.
212 * This is must be smaller than both PGM_HANDY_PAGES_SET_FF and
213 * PGM_HANDY_PAGES_MIN. */
214#define PGM_HANDY_PAGES_R3_ALLOC 8
215/** The threshold at which we will allocate more when in ring-0 or raw mode.
216 * The idea is that we should never go below this threshold while in ring-0 or
217 * raw mode because of PGM_HANDY_PAGES_RZ_TO_R3. However, should this happen and
218 * we are actually out of memory, we will have 8 page to get out of whatever
219 * code we're executing.
220 *
221 * This is must be smaller than both PGM_HANDY_PAGES_SET_FF and
222 * PGM_HANDY_PAGES_MIN. */
223#define PGM_HANDY_PAGES_RZ_ALLOC 8
224/** The threshold at which we force return to R3 ASAP.
225 * The idea is that this should be large enough to get out of any code and up to
226 * the main EM loop when we are out of memory.
227 * This must be less or equal to PGM_HANDY_PAGES_MIN. */
228#define PGM_HANDY_PAGES_RZ_TO_R3 24
229/** The minimum number of handy pages (after allocation).
230 * This must be greater or equal to PGM_HANDY_PAGES_SET_FF.
231 * Another name would be PGM_HANDY_PAGES_EXTRA_RESERVATION or _PARANOIA. :-) */
232#define PGM_HANDY_PAGES_MIN 32
233/** @} */
234
235
236/** @defgroup grp_vbox_param_vmm VMM Parameters
237 * @{
238 */
239/** VMM stack size. */
240#ifdef RT_OS_DARWIN
241# define VMM_STACK_SIZE 16384U
242#else
243# define VMM_STACK_SIZE 8192U
244#endif
245/** Min number of Virtual CPUs. */
246#define VMM_MIN_CPU_COUNT 1
247/** Max number of Virtual CPUs. */
248#define VMM_MAX_CPU_COUNT 64
249
250/** @} */
251
252
253/** @defgroup grp_vbox_pci PCI Identifiers
254 * @{ */
255/** VirtualBox PCI vendor ID. */
256#define VBOX_PCI_VENDORID (0x80ee)
257
258/** @name VirtualBox graphics card identifiers
259 * @{ */
260#define VBOX_VENDORID VBOX_PCI_VENDORID /**< @todo wonderful choice of name! Please squeeze a _VGA_ or something in there, please. */
261#define VBOX_DEVICEID (0xbeef) /**< @todo ditto. */
262#define VBOX_VESA_VENDORID VBOX_PCI_VENDORID
263#define VBOX_VESA_DEVICEID (0xbeef)
264/** @} */
265
266/** @name VMMDev PCI card identifiers
267 * @{ */
268#define VMMDEV_VENDORID VBOX_PCI_VENDORID
269#define VMMDEV_DEVICEID (0xcafe)
270/** @} */
271
272/** @} */
273
274
275/** @defgroup grp_vbox_param_vga VGA
276 * @{ */
277/** The default amount of VGA VRAM (in bytes). */
278#define VGA_VRAM_DEFAULT (_4M)
279/** The minimum amount of VGA VRAM (in bytes). */
280#define VGA_VRAM_MIN (_1M)
281/** The maximum amount of VGA VRAM (in bytes). */
282#define VGA_VRAM_MAX (_1G)
283
284/** The minimum amount of SVGA VRAM (in bytes). */
285#define VBOX_SVGA_VRAM_MIN_SIZE (4U * 640U * 480U)
286/** The maximum amount of SVGA VRAM (in bytes) when 3D acceleration is enabled. */
287#define VBOX_SVGA_VRAM_MIN_SIZE_3D _16M
288/** The maximum amount of SVGA VRAM (in bytes). */
289#define VBOX_SVGA_VRAM_MAX_SIZE _128M
290/** @} */
291
292
293/** @defgroup grp_vbox_param_misc Misc
294 * @{ */
295
296/** The maximum size of a generic segment offload (GSO) frame. This limit is
297 * imposed by the 16-bit frame size in internal networking header. */
298#define VBOX_MAX_GSO_SIZE 0xfff0
299
300/** @} */
301
302
303/** @} */
304
305#endif /* !VBOX_INCLUDED_param_h */
306
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette