1 | /* $Id: VMMDevState.h 100185 2023-06-16 06:54:50Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VMMDev - Guest <-> VMM/Host communication device, internal header.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2023 Oracle and/or its affiliates.
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox base platform packages, as
|
---|
10 | * available from https://www.virtualbox.org.
|
---|
11 | *
|
---|
12 | * This program is free software; you can redistribute it and/or
|
---|
13 | * modify it under the terms of the GNU General Public License
|
---|
14 | * as published by the Free Software Foundation, in version 3 of the
|
---|
15 | * License.
|
---|
16 | *
|
---|
17 | * This program is distributed in the hope that it will be useful, but
|
---|
18 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
20 | * General Public License for more details.
|
---|
21 | *
|
---|
22 | * You should have received a copy of the GNU General Public License
|
---|
23 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
24 | *
|
---|
25 | * SPDX-License-Identifier: GPL-3.0-only
|
---|
26 | */
|
---|
27 |
|
---|
28 | #ifndef VBOX_INCLUDED_SRC_VMMDev_VMMDevState_h
|
---|
29 | #define VBOX_INCLUDED_SRC_VMMDev_VMMDevState_h
|
---|
30 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
31 | # pragma once
|
---|
32 | #endif
|
---|
33 |
|
---|
34 | #include <VBoxVideo.h> /* For VBVA definitions. */
|
---|
35 | #include <VBox/VMMDev.h>
|
---|
36 | #include <VBox/vmm/pdmdev.h>
|
---|
37 | #include <VBox/vmm/pdmifs.h>
|
---|
38 | #ifndef VBOX_WITHOUT_TESTING_FEATURES
|
---|
39 | # include <VBox/vmm/pdmthread.h>
|
---|
40 | # include <iprt/test.h>
|
---|
41 | # include <VBox/VMMDevTesting.h>
|
---|
42 | #endif
|
---|
43 |
|
---|
44 | #include <iprt/list.h>
|
---|
45 | #include <iprt/memcache.h>
|
---|
46 |
|
---|
47 |
|
---|
48 | #define VMMDEV_WITH_ALT_TIMESYNC
|
---|
49 |
|
---|
50 | /** Request locking structure (HGCM optimization). */
|
---|
51 | typedef struct VMMDEVREQLOCK
|
---|
52 | {
|
---|
53 | void *pvReq;
|
---|
54 | PGMPAGEMAPLOCK Lock;
|
---|
55 | } VMMDEVREQLOCK;
|
---|
56 | /** Pointer to a request lock structure. */
|
---|
57 | typedef VMMDEVREQLOCK *PVMMDEVREQLOCK;
|
---|
58 |
|
---|
59 | typedef struct DISPLAYCHANGEREQUEST
|
---|
60 | {
|
---|
61 | bool fPending;
|
---|
62 | bool afAlignment[3];
|
---|
63 | VMMDevDisplayDef displayChangeRequest;
|
---|
64 | VMMDevDisplayDef lastReadDisplayChangeRequest;
|
---|
65 | } DISPLAYCHANGEREQUEST;
|
---|
66 |
|
---|
67 | typedef struct DISPLAYCHANGEDATA
|
---|
68 | {
|
---|
69 | /* Which monitor is being reported to the guest. */
|
---|
70 | int32_t iCurrentMonitor;
|
---|
71 |
|
---|
72 | /** true if the guest responded to VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST at least once */
|
---|
73 | bool fGuestSentChangeEventAck;
|
---|
74 | bool afAlignment[3];
|
---|
75 |
|
---|
76 | DISPLAYCHANGEREQUEST aRequests[VBOX_VIDEO_MAX_SCREENS];
|
---|
77 | } DISPLAYCHANGEDATA;
|
---|
78 |
|
---|
79 |
|
---|
80 | /**
|
---|
81 | * Credentials for automatic guest logon and host configured logon (?).
|
---|
82 | *
|
---|
83 | * This is not stored in the same block as the instance data in order to make it
|
---|
84 | * harder to access.
|
---|
85 | */
|
---|
86 | typedef struct VMMDEVCREDS
|
---|
87 | {
|
---|
88 | /** credentials for guest logon purposes */
|
---|
89 | struct
|
---|
90 | {
|
---|
91 | char szUserName[VMMDEV_CREDENTIALS_SZ_SIZE];
|
---|
92 | char szPassword[VMMDEV_CREDENTIALS_SZ_SIZE];
|
---|
93 | char szDomain[VMMDEV_CREDENTIALS_SZ_SIZE];
|
---|
94 | bool fAllowInteractiveLogon;
|
---|
95 | } Logon;
|
---|
96 |
|
---|
97 | /** credentials for verification by guest */
|
---|
98 | struct
|
---|
99 | {
|
---|
100 | char szUserName[VMMDEV_CREDENTIALS_SZ_SIZE];
|
---|
101 | char szPassword[VMMDEV_CREDENTIALS_SZ_SIZE];
|
---|
102 | char szDomain[VMMDEV_CREDENTIALS_SZ_SIZE];
|
---|
103 | } Judge;
|
---|
104 | } VMMDEVCREDS;
|
---|
105 |
|
---|
106 |
|
---|
107 | /**
|
---|
108 | * Facility status entry.
|
---|
109 | */
|
---|
110 | typedef struct VMMDEVFACILITYSTATUSENTRY
|
---|
111 | {
|
---|
112 | /** The facility (may contain values other than the defined ones). */
|
---|
113 | VBoxGuestFacilityType enmFacility;
|
---|
114 | /** The status (may contain values other than the defined ones). */
|
---|
115 | VBoxGuestFacilityStatus enmStatus;
|
---|
116 | /** Whether this entry is fixed and cannot be reused when inactive. */
|
---|
117 | bool fFixed;
|
---|
118 | /** Explicit alignment padding / reserved for future use. MBZ. */
|
---|
119 | bool afPadding[3];
|
---|
120 | /** The facility flags (yet to be defined). */
|
---|
121 | uint32_t fFlags;
|
---|
122 | /** Last update timestamp. */
|
---|
123 | RTTIMESPEC TimeSpecTS;
|
---|
124 | } VMMDEVFACILITYSTATUSENTRY;
|
---|
125 | /** Pointer to a facility status entry. */
|
---|
126 | typedef VMMDEVFACILITYSTATUSENTRY *PVMMDEVFACILITYSTATUSENTRY;
|
---|
127 |
|
---|
128 |
|
---|
129 | /**
|
---|
130 | * State structure for the VMM device.
|
---|
131 | */
|
---|
132 | typedef struct VMMDEV
|
---|
133 | {
|
---|
134 | /** The critical section for this device.
|
---|
135 | * @remarks We use this rather than the default one, it's simpler with all
|
---|
136 | * the driver interfaces where we have to waste time digging out the
|
---|
137 | * PDMDEVINS structure. */
|
---|
138 | PDMCRITSECT CritSect;
|
---|
139 | #if !defined(VBOX_WITHOUT_TESTING_FEATURES) || defined(DOXYGEN_RUNNING)
|
---|
140 | /** Read write critical section of lock testing.
|
---|
141 | * @remarks At the beginning to satisfy 64 byte alignment requirement. */
|
---|
142 | PDMCRITSECTRW CritSectRw;
|
---|
143 | #endif
|
---|
144 |
|
---|
145 | /** mouse capabilities of host and guest */
|
---|
146 | uint32_t fMouseCapabilities;
|
---|
147 | /** @name Absolute mouse position in pixels, relative wheel movement and buttons state.
|
---|
148 | * @{ */
|
---|
149 | int32_t xMouseAbs;
|
---|
150 | int32_t yMouseAbs;
|
---|
151 | int32_t dzMouse;
|
---|
152 | int32_t dwMouse;
|
---|
153 | uint32_t fMouseButtons;
|
---|
154 | /** @} */
|
---|
155 | /** Does the guest currently want the host pointer to be shown? */
|
---|
156 | uint32_t fHostCursorRequested;
|
---|
157 |
|
---|
158 | /** message buffer for backdoor logging. */
|
---|
159 | char szMsg[512];
|
---|
160 | /** message buffer index. */
|
---|
161 | uint32_t offMsg;
|
---|
162 | /** Alignment padding. */
|
---|
163 | uint32_t u32Alignment2;
|
---|
164 |
|
---|
165 | /** Statistics counter for slow IRQ ACK. */
|
---|
166 | STAMCOUNTER StatSlowIrqAck;
|
---|
167 | /** Statistics counter for fast IRQ ACK - R3. */
|
---|
168 | STAMCOUNTER StatFastIrqAckR3;
|
---|
169 | /** Statistics counter for fast IRQ ACK - R0 / RC. */
|
---|
170 | STAMCOUNTER StatFastIrqAckRZ;
|
---|
171 | /** Current host side event flags - VMMDEV_EVENT_XXX. */
|
---|
172 | uint32_t fHostEventFlags;
|
---|
173 | /** Mask of events guest is interested in - VMMDEV_EVENT_XXX.
|
---|
174 | * @note The HGCM events are enabled automatically by the VMMDev device when
|
---|
175 | * guest issues HGCM commands. */
|
---|
176 | uint32_t fGuestFilterMask;
|
---|
177 | /** Delayed mask of guest events - VMMDEV_EVENT_XXX. */
|
---|
178 | uint32_t fNewGuestFilterMask;
|
---|
179 | /** Flag whether fNewGuestFilterMask is valid */
|
---|
180 | bool fNewGuestFilterMaskValid;
|
---|
181 | /** Alignment padding. */
|
---|
182 | bool afAlignment3[3];
|
---|
183 |
|
---|
184 | /** Information reported by guest via VMMDevReportGuestInfo generic request.
|
---|
185 | * Until this information is reported the VMMDev refuses any other requests.
|
---|
186 | */
|
---|
187 | VBoxGuestInfo guestInfo;
|
---|
188 | /** Information report \#2, chewed a little. */
|
---|
189 | struct
|
---|
190 | {
|
---|
191 | uint32_t uFullVersion; /**< non-zero if info is present. */
|
---|
192 | uint32_t uRevision;
|
---|
193 | uint32_t fFeatures;
|
---|
194 | char szName[128];
|
---|
195 | } guestInfo2;
|
---|
196 |
|
---|
197 | /** Array of guest facility statuses. */
|
---|
198 | VMMDEVFACILITYSTATUSENTRY aFacilityStatuses[32];
|
---|
199 | /** The number of valid entries in the facility status array. */
|
---|
200 | uint32_t cFacilityStatuses;
|
---|
201 |
|
---|
202 | /** Information reported by guest via VMMDevReportGuestCapabilities - VMMDEV_GUEST_SUPPORTS_XXX. */
|
---|
203 | uint32_t fGuestCaps;
|
---|
204 |
|
---|
205 | /** "Additions are Ok" indicator, set to true after processing VMMDevReportGuestInfo,
|
---|
206 | * if additions version is compatible. This flag is here to avoid repeated comparing
|
---|
207 | * of the version in guestInfo.
|
---|
208 | */
|
---|
209 | uint32_t fu32AdditionsOk;
|
---|
210 |
|
---|
211 | /** Video acceleration status set by guest. */
|
---|
212 | uint32_t u32VideoAccelEnabled;
|
---|
213 |
|
---|
214 | DISPLAYCHANGEDATA displayChangeData;
|
---|
215 |
|
---|
216 | /** memory balloon change request */
|
---|
217 | uint32_t cMbMemoryBalloon;
|
---|
218 | /** The last balloon size queried by the guest additions. */
|
---|
219 | uint32_t cMbMemoryBalloonLast;
|
---|
220 |
|
---|
221 | /** guest ram size */
|
---|
222 | uint64_t cbGuestRAM;
|
---|
223 |
|
---|
224 | /** unique session id; the id will be different after each start, reset or restore of the VM. */
|
---|
225 | uint64_t idSession;
|
---|
226 |
|
---|
227 | /** Statistics interval in seconds. */
|
---|
228 | uint32_t cSecsStatInterval;
|
---|
229 | /** The statistics interval last returned to the guest. */
|
---|
230 | uint32_t cSecsLastStatInterval;
|
---|
231 |
|
---|
232 | /** Whether seamless is enabled or not. */
|
---|
233 | bool fSeamlessEnabled;
|
---|
234 | /** The last fSeamlessEnabled state returned to the guest. */
|
---|
235 | bool fLastSeamlessEnabled;
|
---|
236 | bool afAlignment5[1];
|
---|
237 |
|
---|
238 | bool fVRDPEnabled;
|
---|
239 | uint32_t uVRDPExperienceLevel;
|
---|
240 |
|
---|
241 | #ifdef VMMDEV_WITH_ALT_TIMESYNC
|
---|
242 | uint64_t msLatchedHostTime;
|
---|
243 | bool fTimesyncBackdoorLo;
|
---|
244 | bool afAlignment6[1];
|
---|
245 | #else
|
---|
246 | bool afAlignment6[2];
|
---|
247 | #endif
|
---|
248 |
|
---|
249 | /** Set if guest should be allowed to trigger state save and power off. */
|
---|
250 | bool fAllowGuestToSaveState;
|
---|
251 | /** Set if GetHostTime should fail.
|
---|
252 | * Loaded from the GetHostTimeDisabled configuration value. */
|
---|
253 | bool fGetHostTimeDisabled;
|
---|
254 | /** Set if backdoor logging should be disabled (output will be ignored then) */
|
---|
255 | bool fBackdoorLogDisabled;
|
---|
256 | /** Don't clear credentials */
|
---|
257 | bool fKeepCredentials;
|
---|
258 | /** Heap enabled. */
|
---|
259 | bool fHeapEnabled;
|
---|
260 |
|
---|
261 | /** Guest Core Dumping enabled. */
|
---|
262 | bool fGuestCoreDumpEnabled;
|
---|
263 | /** Guest Core Dump location. */
|
---|
264 | char szGuestCoreDumpDir[RTPATH_MAX];
|
---|
265 | /** Number of additional cores to keep around. */
|
---|
266 | uint32_t cGuestCoreDumps;
|
---|
267 |
|
---|
268 | /** FLag whether CPU hotplug events are monitored */
|
---|
269 | bool fCpuHotPlugEventsEnabled;
|
---|
270 | /** Flag whether the VMM device is offering the request ports
|
---|
271 | * over MMIO as well (mainly for ARM at the moment). */
|
---|
272 | bool fMmioReq;
|
---|
273 | /** Alignment padding. */
|
---|
274 | bool afPadding8[2];
|
---|
275 | /** CPU hotplug event */
|
---|
276 | VMMDevCpuEventType enmCpuHotPlugEvent;
|
---|
277 | /** Core id of the CPU to change */
|
---|
278 | uint32_t idCpuCore;
|
---|
279 | /** Package id of the CPU to change */
|
---|
280 | uint32_t idCpuPackage;
|
---|
281 |
|
---|
282 | uint32_t StatMemBalloonChunks;
|
---|
283 |
|
---|
284 | /** @name Heartbeat
|
---|
285 | * @{ */
|
---|
286 | /** Timestamp of the last heartbeat from guest in nanosec. */
|
---|
287 | uint64_t volatile nsLastHeartbeatTS;
|
---|
288 | /** Indicates whether we missed HB from guest on last check. */
|
---|
289 | bool volatile fFlatlined;
|
---|
290 | /** Indicates whether heartbeat check is active. */
|
---|
291 | bool volatile fHeartbeatActive;
|
---|
292 | /** Alignment padding. */
|
---|
293 | bool afAlignment8[6];
|
---|
294 | /** Guest heartbeat interval in nanoseconds.
|
---|
295 | * This is the interval the guest is told to produce heartbeats at. */
|
---|
296 | uint64_t cNsHeartbeatInterval;
|
---|
297 | /** The amount of time without a heartbeat (nanoseconds) before we
|
---|
298 | * conclude the guest is doing a Dixie Flatline (Neuromancer) impression. */
|
---|
299 | uint64_t cNsHeartbeatTimeout;
|
---|
300 | /** Timer for signalling a flatlined guest. */
|
---|
301 | TMTIMERHANDLE hFlatlinedTimer;
|
---|
302 | /** @} */
|
---|
303 |
|
---|
304 | /** @name Testing
|
---|
305 | * @{ */
|
---|
306 | /** Set if testing is enabled. */
|
---|
307 | bool fTestingEnabled;
|
---|
308 | /** Set if testing the MMIO testing range is enabled. */
|
---|
309 | bool fTestingMMIO;
|
---|
310 | #if defined(VBOX_WITHOUT_TESTING_FEATURES) && !defined(DOXYGEN_RUNNING)
|
---|
311 | /** Alignment padding. */
|
---|
312 | bool afPadding9[2];
|
---|
313 | #else
|
---|
314 | /** The amount of readable testing data (for query response). */
|
---|
315 | uint16_t cbReadableTestingData;
|
---|
316 | /** The high timestamp value. */
|
---|
317 | uint32_t u32TestingHighTimestamp;
|
---|
318 | /** The current testing command (VMMDEV_TESTING_CMD_XXX). */
|
---|
319 | uint32_t u32TestingCmd;
|
---|
320 | /** The testing data offset (command specific). */
|
---|
321 | uint32_t offTestingData;
|
---|
322 | /** For buffering the what comes in over the testing data port. */
|
---|
323 | union
|
---|
324 | {
|
---|
325 | /** Plain byte view. */
|
---|
326 | uint8_t ab[1024];
|
---|
327 |
|
---|
328 | /** VMMDEV_TESTING_CMD_INIT, VMMDEV_TESTING_CMD_SUB_NEW,
|
---|
329 | * VMMDEV_TESTING_CMD_FAILED. */
|
---|
330 | struct
|
---|
331 | {
|
---|
332 | char sz[1024];
|
---|
333 | } String, Init, SubNew, Failed;
|
---|
334 |
|
---|
335 | /** VMMDEV_TESTING_CMD_TERM, VMMDEV_TESTING_CMD_SUB_DONE. */
|
---|
336 | struct
|
---|
337 | {
|
---|
338 | uint32_t c;
|
---|
339 | } Error, Term, SubDone;
|
---|
340 |
|
---|
341 | /** VMMDEV_TESTING_CMD_VALUE. */
|
---|
342 | struct
|
---|
343 | {
|
---|
344 | RTUINT64U u64Value;
|
---|
345 | uint32_t u32Unit;
|
---|
346 | char szName[1024 - 8 - 4];
|
---|
347 | } Value;
|
---|
348 |
|
---|
349 | /** A 8-bit VMMDEV_TESTING_QUERY_CFG response. */
|
---|
350 | uint8_t b;
|
---|
351 | /** A 32-bit VMMDEV_TESTING_QUERY_CFG response. */
|
---|
352 | uint32_t u32;
|
---|
353 |
|
---|
354 | /** The read back register (VMMDEV_TESTING_MMIO_OFF_READBACK,
|
---|
355 | * VMMDEV_TESTING_MMIO_OFF_READBACK_R3). */
|
---|
356 | uint8_t abReadBack[VMMDEV_TESTING_READBACK_SIZE];
|
---|
357 | } TestingData;
|
---|
358 | /** The locking testing control dword. */
|
---|
359 | union
|
---|
360 | {
|
---|
361 | /** Plain view. */
|
---|
362 | uint64_t u64;
|
---|
363 | /** Plain 32-bit view. */
|
---|
364 | uint32_t au32[2];
|
---|
365 | struct
|
---|
366 | {
|
---|
367 | /** bits 15:0: Number of microseconds to hold the lock. */
|
---|
368 | uint32_t cUsHold : 16;
|
---|
369 | /** bits 31:16: Number of microseconds to wait before retaking the lock again. */
|
---|
370 | uint32_t cUsBetween : 16;
|
---|
371 | /** bits 51:32: Kilo (1024) ticks the EMT should hold the lock for. */
|
---|
372 | uint32_t cKiloTicksEmtHold : 20;
|
---|
373 | /** bits 57:52: Reserved MBZ. */
|
---|
374 | uint32_t uReserved : 6;
|
---|
375 | /** bit 58: Thread takes lock in shared mode when set, exclusive when clear. */
|
---|
376 | uint32_t fThreadShared : 1;
|
---|
377 | /** bit 59: EMT takes lock in shared mode when set, exclusive when clear. */
|
---|
378 | uint32_t fEmtShared : 1;
|
---|
379 | /** bit 60: Use read/write critical section instead of regular. */
|
---|
380 | uint32_t fReadWriteSection : 1;
|
---|
381 | /** bit 61: EMT passes VINF_SUCCESS as rcBusy if set. */
|
---|
382 | uint32_t fMustSucceed : 1;
|
---|
383 | /** bit 62: Thread pokes EMTs before releasing it when set. */
|
---|
384 | uint32_t fPokeBeforeRelease : 1;
|
---|
385 | /** bit 63: Enabled/disabled. */
|
---|
386 | uint32_t fEnabled : 1;
|
---|
387 | } s;
|
---|
388 | } TestingLockControl;
|
---|
389 | /** Event semaphore that the locking thread blocks. */
|
---|
390 | SUPSEMEVENT hTestingLockEvt;
|
---|
391 | # if HC_ARCH_BITS == 32
|
---|
392 | uint32_t uPadding10;
|
---|
393 | # endif
|
---|
394 | /** Handle for the I/O ports used by the testing component. */
|
---|
395 | IOMIOPORTHANDLE hIoPortTesting;
|
---|
396 | /** Handle for the MMIO region used by the testing component. */
|
---|
397 | IOMMMIOHANDLE hMmioTesting;
|
---|
398 | /** User defined configuration dwords. */
|
---|
399 | uint32_t au32TestingCfgDwords[10];
|
---|
400 | #endif /* !VBOX_WITHOUT_TESTING_FEATURES || DOXYGEN_RUNNING */
|
---|
401 | /** @} */
|
---|
402 |
|
---|
403 | /** Handle for the backdoor logging I/O port. */
|
---|
404 | IOMIOPORTHANDLE hIoPortBackdoorLog;
|
---|
405 | /** Handle for the alternative timesync I/O port. */
|
---|
406 | IOMIOPORTHANDLE hIoPortAltTimesync;
|
---|
407 | /** Handle for the VMM request I/O port (PCI region \#0). */
|
---|
408 | IOMIOPORTHANDLE hIoPortReq;
|
---|
409 | /** Handle for the fast VMM request I/O port (PCI region \#0). */
|
---|
410 | IOMIOPORTHANDLE hIoPortFast;
|
---|
411 | /** Handle for the VMM request MMIO region (PCI region \#3). */
|
---|
412 | IOMMMIOHANDLE hMmioReq;
|
---|
413 | /** Handle for the VMMDev RAM (PCI region \#1). */
|
---|
414 | PGMMMIO2HANDLE hMmio2VMMDevRAM;
|
---|
415 | /** Handle for the VMMDev Heap (PCI region \#2). */
|
---|
416 | PGMMMIO2HANDLE hMmio2Heap;
|
---|
417 | } VMMDEV;
|
---|
418 | /** Pointer to the shared VMM device state. */
|
---|
419 | typedef VMMDEV *PVMMDEV;
|
---|
420 | AssertCompileMemberAlignment(VMMDEV, CritSect, 8);
|
---|
421 | AssertCompileMemberAlignment(VMMDEV, StatSlowIrqAck, 8);
|
---|
422 | AssertCompileMemberAlignment(VMMDEV, cbGuestRAM, 8);
|
---|
423 | AssertCompileMemberAlignment(VMMDEV, enmCpuHotPlugEvent, 4);
|
---|
424 | AssertCompileMemberAlignment(VMMDEV, aFacilityStatuses, 8);
|
---|
425 | #ifndef VBOX_WITHOUT_TESTING_FEATURES
|
---|
426 | AssertCompileMemberAlignment(VMMDEV, TestingData.Value.u64Value, 8);
|
---|
427 | AssertCompileMemberAlignment(VMMDEV, CritSectRw, 64);
|
---|
428 | #endif
|
---|
429 |
|
---|
430 |
|
---|
431 | /** @name VMMDev/HGCM accounting categories (indexes into VMMDEVR3::aHgcmAcc)
|
---|
432 | * @{ */
|
---|
433 | /** Legacy, VMMDEV_REQUESTOR_USR_NOT_GIVEN, VMMDEV_REQUESTOR_USR_DRV,
|
---|
434 | * VMMDEV_REQUESTOR_USR_DRV_OTHER. */
|
---|
435 | #define VMMDEV_HGCM_CATEGORY_KERNEL 0
|
---|
436 | /** VMMDEV_REQUESTOR_USR_ROOT, VMMDEV_REQUESTOR_USR_SYSTEM */
|
---|
437 | #define VMMDEV_HGCM_CATEGORY_ROOT 1
|
---|
438 | /** VMMDEV_REQUESTOR_USR_RESERVED1, VMMDEV_REQUESTOR_USR_USER,
|
---|
439 | * VMMDEV_REQUESTOR_USR_GUEST */
|
---|
440 | #define VMMDEV_HGCM_CATEGORY_USER 2
|
---|
441 | /** Array size. */
|
---|
442 | #define VMMDEV_HGCM_CATEGORY_MAX 3
|
---|
443 | /** @} */
|
---|
444 |
|
---|
445 | /**
|
---|
446 | * State structure for the VMM device, ring-3 edition.
|
---|
447 | */
|
---|
448 | typedef struct VMMDEVR3
|
---|
449 | {
|
---|
450 | /** LUN\#0 + Status: VMMDev port base interface. */
|
---|
451 | PDMIBASE IBase;
|
---|
452 | /** LUN\#0: VMMDev port interface. */
|
---|
453 | PDMIVMMDEVPORT IPort;
|
---|
454 | #ifdef VBOX_WITH_HGCM
|
---|
455 | /** LUN\#0: HGCM port interface. */
|
---|
456 | PDMIHGCMPORT IHGCMPort;
|
---|
457 | /** HGCM connector interface */
|
---|
458 | R3PTRTYPE(PPDMIHGCMCONNECTOR) pHGCMDrv;
|
---|
459 | #endif
|
---|
460 | /** Pointer to base interface of the driver. */
|
---|
461 | R3PTRTYPE(PPDMIBASE) pDrvBase;
|
---|
462 | /** VMMDev connector interface */
|
---|
463 | R3PTRTYPE(PPDMIVMMDEVCONNECTOR) pDrv;
|
---|
464 | /** Pointer to the device instance.
|
---|
465 | * @note Only for interface methods to get their bearings. */
|
---|
466 | PPDMDEVINSR3 pDevIns;
|
---|
467 |
|
---|
468 | /** R3 pointer to VMMDev RAM area */
|
---|
469 | R3PTRTYPE(VMMDevMemory *) pVMMDevRAMR3;
|
---|
470 |
|
---|
471 | /** R3 pointer to VMMDev Heap RAM area. */
|
---|
472 | R3PTRTYPE(VMMDevMemory *) pVMMDevHeapR3;
|
---|
473 |
|
---|
474 | /** Pointer to the credentials. */
|
---|
475 | R3PTRTYPE(VMMDEVCREDS *) pCredentials;
|
---|
476 | /** Set if pCredentials is using the RTMemSafer allocator, clear if heap. */
|
---|
477 | bool fSaferCredentials;
|
---|
478 | bool afAlignment[7];
|
---|
479 |
|
---|
480 | #ifdef VBOX_WITH_HGCM
|
---|
481 | /** Critical section to protect the list. */
|
---|
482 | RTCRITSECT critsectHGCMCmdList;
|
---|
483 | /** List of pending HGCM requests (VBOXHGCMCMD). */
|
---|
484 | RTLISTANCHORR3 listHGCMCmd;
|
---|
485 | /** Whether the HGCM events are already automatically enabled. */
|
---|
486 | uint32_t u32HGCMEnabled;
|
---|
487 | /** Saved state version of restored commands. */
|
---|
488 | uint32_t uSavedStateVersion;
|
---|
489 | RTMEMCACHE hHgcmCmdCache;
|
---|
490 | /** Accounting by for each requestor VMMDEV_REQUESTOR_USR_XXX group.
|
---|
491 | * Legacy requests ends up with VMMDEV_REQUESTOR_USR_NOT_GIVEN */
|
---|
492 | struct
|
---|
493 | {
|
---|
494 | /** The configured heap budget. */
|
---|
495 | uint64_t cbHeapBudgetConfig;
|
---|
496 | /** The currently available heap budget. */
|
---|
497 | uint64_t cbHeapBudget;
|
---|
498 | /** Message stats. */
|
---|
499 | STAMPROFILE StateMsgHeapUsage;
|
---|
500 | /** Budget overruns. */
|
---|
501 | STAMCOUNTER StatBudgetOverruns;
|
---|
502 | } aHgcmAcc[VMMDEV_HGCM_CATEGORY_MAX];
|
---|
503 | STAMPROFILE StatHgcmCmdArrival;
|
---|
504 | STAMPROFILE StatHgcmCmdCompletion;
|
---|
505 | STAMPROFILE StatHgcmCmdTotal;
|
---|
506 | STAMCOUNTER StatHgcmLargeCmdAllocs;
|
---|
507 | STAMCOUNTER StatHgcmFailedPageListLocking;
|
---|
508 | #endif /* VBOX_WITH_HGCM */
|
---|
509 | STAMCOUNTER StatReqBufAllocs;
|
---|
510 | /** Per CPU request 4K sized buffers, allocated as needed. */
|
---|
511 | R3PTRTYPE(VMMDevRequestHeader *) apReqBufs[VMM_MAX_CPU_COUNT];
|
---|
512 |
|
---|
513 | /** Status LUN: Shared folders LED */
|
---|
514 | struct
|
---|
515 | {
|
---|
516 | /** The LED. */
|
---|
517 | PDMLED Led;
|
---|
518 | /** The LED ports. */
|
---|
519 | PDMILEDPORTS ILeds;
|
---|
520 | /** Partner of ILeds. */
|
---|
521 | R3PTRTYPE(PPDMILEDCONNECTORS) pLedsConnector;
|
---|
522 | } SharedFolders;
|
---|
523 |
|
---|
524 | #ifndef VBOX_WITHOUT_TESTING_FEATURES
|
---|
525 | /** The XML output file name (can be a named pipe, doesn't matter to us). */
|
---|
526 | R3PTRTYPE(char *) pszTestingXmlOutput;
|
---|
527 | /** Testing instance for dealing with the output. */
|
---|
528 | RTTEST hTestingTest;
|
---|
529 | /** The locking test thread (). */
|
---|
530 | PPDMTHREAD pTestingLockThread;
|
---|
531 | #endif
|
---|
532 | } VMMDEVR3;
|
---|
533 | /** Pointer to the ring-3 VMM device state. */
|
---|
534 | typedef VMMDEVR3 *PVMMDEVR3;
|
---|
535 |
|
---|
536 |
|
---|
537 | /**
|
---|
538 | * State structure for the VMM device, ring-0 edition.
|
---|
539 | */
|
---|
540 | typedef struct VMMDEVR0
|
---|
541 | {
|
---|
542 | /** R0 pointer to VMMDev RAM area - first page only, could be NULL! */
|
---|
543 | R0PTRTYPE(VMMDevMemory *) pVMMDevRAMR0;
|
---|
544 | } VMMDEVR0;
|
---|
545 | /** Pointer to the ring-0 VMM device state. */
|
---|
546 | typedef VMMDEVR0 *PVMMDEVR0;
|
---|
547 |
|
---|
548 |
|
---|
549 | /**
|
---|
550 | * State structure for the VMM device, raw-mode edition.
|
---|
551 | */
|
---|
552 | typedef struct VMMDEVRC
|
---|
553 | {
|
---|
554 | /** R0 pointer to VMMDev RAM area - first page only, could be NULL! */
|
---|
555 | RCPTRTYPE(VMMDevMemory *) pVMMDevRAMRC;
|
---|
556 | } VMMDEVRC;
|
---|
557 | /** Pointer to the raw-mode VMM device state. */
|
---|
558 | typedef VMMDEVRC *PVMMDEVRC;
|
---|
559 |
|
---|
560 |
|
---|
561 | /** @typedef VMMDEVCC
|
---|
562 | * The VMMDEV device data for the current context. */
|
---|
563 | typedef CTX_SUFF(VMMDEV) VMMDEVCC;
|
---|
564 | /** @typedef PVMMDEVCC
|
---|
565 | * Pointer to the VMMDEV device for the current context. */
|
---|
566 | typedef CTX_SUFF(PVMMDEV) PVMMDEVCC;
|
---|
567 |
|
---|
568 |
|
---|
569 | void VMMDevNotifyGuest(PPDMDEVINS pDevIns, PVMMDEV pThis, PVMMDEVCC pThisCC, uint32_t fAddEvents);
|
---|
570 | void VMMDevCtlSetGuestFilterMask(PPDMDEVINS pDevIns, PVMMDEV pThis, PVMMDEVCC pThisCC, uint32_t fOrMask, uint32_t fNotMask);
|
---|
571 |
|
---|
572 |
|
---|
573 | /** The saved state version. */
|
---|
574 | #define VMMDEV_SAVED_STATE_VERSION VMMDEV_SAVED_STATE_VERSION_MMIO_ACCESS
|
---|
575 | /** Added support to optionally use MMIO instead of PIO for passing requests to the host (mainly for ARM). */
|
---|
576 | #define VMMDEV_SAVED_STATE_VERSION_MMIO_ACCESS 20
|
---|
577 | /** The saved state version with VMMDev mouse buttons state and wheel movement data. */
|
---|
578 | #define VMMDEV_SAVED_STATE_VERSION_VMM_MOUSE_EXTENDED_DATA 19
|
---|
579 | /** The saved state version with display change data state. */
|
---|
580 | #define VMMDEV_SAVED_STATE_VERSION_DISPLAY_CHANGE_DATA 18
|
---|
581 | /** Updated HGCM commands. */
|
---|
582 | #define VMMDEV_SAVED_STATE_VERSION_HGCM_PARAMS 17
|
---|
583 | /** The saved state version with heartbeat state. */
|
---|
584 | #define VMMDEV_SAVED_STATE_VERSION_HEARTBEAT 16
|
---|
585 | /** The saved state version without heartbeat state. */
|
---|
586 | #define VMMDEV_SAVED_STATE_VERSION_NO_HEARTBEAT 15
|
---|
587 | /** The saved state version which is missing the guest facility statuses. */
|
---|
588 | #define VMMDEV_SAVED_STATE_VERSION_MISSING_FACILITY_STATUSES 14
|
---|
589 | /** The saved state version which is missing the guestInfo2 bits. */
|
---|
590 | #define VMMDEV_SAVED_STATE_VERSION_MISSING_GUEST_INFO_2 13
|
---|
591 | /** The saved state version used by VirtualBox 3.0.
|
---|
592 | * This doesn't have the config part. */
|
---|
593 | #define VMMDEV_SAVED_STATE_VERSION_VBOX_30 11
|
---|
594 |
|
---|
595 | #endif /* !VBOX_INCLUDED_SRC_VMMDev_VMMDevState_h */
|
---|
596 |
|
---|