1 | /* $Id: VMMDevState.h 96407 2022-08-22 17:43:14Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VMMDev - Guest <-> VMM/Host communication device, internal header.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2022 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
|
---|
148 | * @{ */
|
---|
149 | int32_t xMouseAbs;
|
---|
150 | int32_t yMouseAbs;
|
---|
151 | /** @} */
|
---|
152 | /** Does the guest currently want the host pointer to be shown? */
|
---|
153 | uint32_t fHostCursorRequested;
|
---|
154 |
|
---|
155 | /** message buffer for backdoor logging. */
|
---|
156 | char szMsg[512];
|
---|
157 | /** message buffer index. */
|
---|
158 | uint32_t offMsg;
|
---|
159 | /** Alignment padding. */
|
---|
160 | uint32_t u32Alignment2;
|
---|
161 |
|
---|
162 | /** Statistics counter for slow IRQ ACK. */
|
---|
163 | STAMCOUNTER StatSlowIrqAck;
|
---|
164 | /** Statistics counter for fast IRQ ACK - R3. */
|
---|
165 | STAMCOUNTER StatFastIrqAckR3;
|
---|
166 | /** Statistics counter for fast IRQ ACK - R0 / RC. */
|
---|
167 | STAMCOUNTER StatFastIrqAckRZ;
|
---|
168 | /** Current host side event flags - VMMDEV_EVENT_XXX. */
|
---|
169 | uint32_t fHostEventFlags;
|
---|
170 | /** Mask of events guest is interested in - VMMDEV_EVENT_XXX.
|
---|
171 | * @note The HGCM events are enabled automatically by the VMMDev device when
|
---|
172 | * guest issues HGCM commands. */
|
---|
173 | uint32_t fGuestFilterMask;
|
---|
174 | /** Delayed mask of guest events - VMMDEV_EVENT_XXX. */
|
---|
175 | uint32_t fNewGuestFilterMask;
|
---|
176 | /** Flag whether fNewGuestFilterMask is valid */
|
---|
177 | bool fNewGuestFilterMaskValid;
|
---|
178 | /** Alignment padding. */
|
---|
179 | bool afAlignment3[3];
|
---|
180 |
|
---|
181 | /** Information reported by guest via VMMDevReportGuestInfo generic request.
|
---|
182 | * Until this information is reported the VMMDev refuses any other requests.
|
---|
183 | */
|
---|
184 | VBoxGuestInfo guestInfo;
|
---|
185 | /** Information report \#2, chewed a little. */
|
---|
186 | struct
|
---|
187 | {
|
---|
188 | uint32_t uFullVersion; /**< non-zero if info is present. */
|
---|
189 | uint32_t uRevision;
|
---|
190 | uint32_t fFeatures;
|
---|
191 | char szName[128];
|
---|
192 | } guestInfo2;
|
---|
193 |
|
---|
194 | /** Array of guest facility statuses. */
|
---|
195 | VMMDEVFACILITYSTATUSENTRY aFacilityStatuses[32];
|
---|
196 | /** The number of valid entries in the facility status array. */
|
---|
197 | uint32_t cFacilityStatuses;
|
---|
198 |
|
---|
199 | /** Information reported by guest via VMMDevReportGuestCapabilities - VMMDEV_GUEST_SUPPORTS_XXX. */
|
---|
200 | uint32_t fGuestCaps;
|
---|
201 |
|
---|
202 | /** "Additions are Ok" indicator, set to true after processing VMMDevReportGuestInfo,
|
---|
203 | * if additions version is compatible. This flag is here to avoid repeated comparing
|
---|
204 | * of the version in guestInfo.
|
---|
205 | */
|
---|
206 | uint32_t fu32AdditionsOk;
|
---|
207 |
|
---|
208 | /** Video acceleration status set by guest. */
|
---|
209 | uint32_t u32VideoAccelEnabled;
|
---|
210 |
|
---|
211 | DISPLAYCHANGEDATA displayChangeData;
|
---|
212 |
|
---|
213 | /** memory balloon change request */
|
---|
214 | uint32_t cMbMemoryBalloon;
|
---|
215 | /** The last balloon size queried by the guest additions. */
|
---|
216 | uint32_t cMbMemoryBalloonLast;
|
---|
217 |
|
---|
218 | /** guest ram size */
|
---|
219 | uint64_t cbGuestRAM;
|
---|
220 |
|
---|
221 | /** unique session id; the id will be different after each start, reset or restore of the VM. */
|
---|
222 | uint64_t idSession;
|
---|
223 |
|
---|
224 | /** Statistics interval in seconds. */
|
---|
225 | uint32_t cSecsStatInterval;
|
---|
226 | /** The statistics interval last returned to the guest. */
|
---|
227 | uint32_t cSecsLastStatInterval;
|
---|
228 |
|
---|
229 | /** Whether seamless is enabled or not. */
|
---|
230 | bool fSeamlessEnabled;
|
---|
231 | /** The last fSeamlessEnabled state returned to the guest. */
|
---|
232 | bool fLastSeamlessEnabled;
|
---|
233 | bool afAlignment5[1];
|
---|
234 |
|
---|
235 | bool fVRDPEnabled;
|
---|
236 | uint32_t uVRDPExperienceLevel;
|
---|
237 |
|
---|
238 | #ifdef VMMDEV_WITH_ALT_TIMESYNC
|
---|
239 | uint64_t msLatchedHostTime;
|
---|
240 | bool fTimesyncBackdoorLo;
|
---|
241 | bool afAlignment6[1];
|
---|
242 | #else
|
---|
243 | bool afAlignment6[2];
|
---|
244 | #endif
|
---|
245 |
|
---|
246 | /** Set if guest should be allowed to trigger state save and power off. */
|
---|
247 | bool fAllowGuestToSaveState;
|
---|
248 | /** Set if GetHostTime should fail.
|
---|
249 | * Loaded from the GetHostTimeDisabled configuration value. */
|
---|
250 | bool fGetHostTimeDisabled;
|
---|
251 | /** Set if backdoor logging should be disabled (output will be ignored then) */
|
---|
252 | bool fBackdoorLogDisabled;
|
---|
253 | /** Don't clear credentials */
|
---|
254 | bool fKeepCredentials;
|
---|
255 | /** Heap enabled. */
|
---|
256 | bool fHeapEnabled;
|
---|
257 |
|
---|
258 | /** Guest Core Dumping enabled. */
|
---|
259 | bool fGuestCoreDumpEnabled;
|
---|
260 | /** Guest Core Dump location. */
|
---|
261 | char szGuestCoreDumpDir[RTPATH_MAX];
|
---|
262 | /** Number of additional cores to keep around. */
|
---|
263 | uint32_t cGuestCoreDumps;
|
---|
264 |
|
---|
265 | /** FLag whether CPU hotplug events are monitored */
|
---|
266 | bool fCpuHotPlugEventsEnabled;
|
---|
267 | /** Alignment padding. */
|
---|
268 | bool afPadding8[3];
|
---|
269 | /** CPU hotplug event */
|
---|
270 | VMMDevCpuEventType enmCpuHotPlugEvent;
|
---|
271 | /** Core id of the CPU to change */
|
---|
272 | uint32_t idCpuCore;
|
---|
273 | /** Package id of the CPU to change */
|
---|
274 | uint32_t idCpuPackage;
|
---|
275 |
|
---|
276 | uint32_t StatMemBalloonChunks;
|
---|
277 |
|
---|
278 | /** @name Heartbeat
|
---|
279 | * @{ */
|
---|
280 | /** Timestamp of the last heartbeat from guest in nanosec. */
|
---|
281 | uint64_t volatile nsLastHeartbeatTS;
|
---|
282 | /** Indicates whether we missed HB from guest on last check. */
|
---|
283 | bool volatile fFlatlined;
|
---|
284 | /** Indicates whether heartbeat check is active. */
|
---|
285 | bool volatile fHeartbeatActive;
|
---|
286 | /** Alignment padding. */
|
---|
287 | bool afAlignment8[6];
|
---|
288 | /** Guest heartbeat interval in nanoseconds.
|
---|
289 | * This is the interval the guest is told to produce heartbeats at. */
|
---|
290 | uint64_t cNsHeartbeatInterval;
|
---|
291 | /** The amount of time without a heartbeat (nanoseconds) before we
|
---|
292 | * conclude the guest is doing a Dixie Flatline (Neuromancer) impression. */
|
---|
293 | uint64_t cNsHeartbeatTimeout;
|
---|
294 | /** Timer for signalling a flatlined guest. */
|
---|
295 | TMTIMERHANDLE hFlatlinedTimer;
|
---|
296 | /** @} */
|
---|
297 |
|
---|
298 | /** @name Testing
|
---|
299 | * @{ */
|
---|
300 | /** Set if testing is enabled. */
|
---|
301 | bool fTestingEnabled;
|
---|
302 | /** Set if testing the MMIO testing range is enabled. */
|
---|
303 | bool fTestingMMIO;
|
---|
304 | #if defined(VBOX_WITHOUT_TESTING_FEATURES) && !defined(DOXYGEN_RUNNING)
|
---|
305 | /** Alignment padding. */
|
---|
306 | bool afPadding9[2];
|
---|
307 | #else
|
---|
308 | /** The amount of readable testing data (for query response). */
|
---|
309 | uint16_t cbReadableTestingData;
|
---|
310 | /** The high timestamp value. */
|
---|
311 | uint32_t u32TestingHighTimestamp;
|
---|
312 | /** The current testing command (VMMDEV_TESTING_CMD_XXX). */
|
---|
313 | uint32_t u32TestingCmd;
|
---|
314 | /** The testing data offset (command specific). */
|
---|
315 | uint32_t offTestingData;
|
---|
316 | /** For buffering the what comes in over the testing data port. */
|
---|
317 | union
|
---|
318 | {
|
---|
319 | /** Plain byte view. */
|
---|
320 | uint8_t ab[1024];
|
---|
321 |
|
---|
322 | /** VMMDEV_TESTING_CMD_INIT, VMMDEV_TESTING_CMD_SUB_NEW,
|
---|
323 | * VMMDEV_TESTING_CMD_FAILED. */
|
---|
324 | struct
|
---|
325 | {
|
---|
326 | char sz[1024];
|
---|
327 | } String, Init, SubNew, Failed;
|
---|
328 |
|
---|
329 | /** VMMDEV_TESTING_CMD_TERM, VMMDEV_TESTING_CMD_SUB_DONE. */
|
---|
330 | struct
|
---|
331 | {
|
---|
332 | uint32_t c;
|
---|
333 | } Error, Term, SubDone;
|
---|
334 |
|
---|
335 | /** VMMDEV_TESTING_CMD_VALUE. */
|
---|
336 | struct
|
---|
337 | {
|
---|
338 | RTUINT64U u64Value;
|
---|
339 | uint32_t u32Unit;
|
---|
340 | char szName[1024 - 8 - 4];
|
---|
341 | } Value;
|
---|
342 |
|
---|
343 | /** A 8-bit VMMDEV_TESTING_QUERY_CFG response. */
|
---|
344 | uint8_t b;
|
---|
345 | /** A 32-bit VMMDEV_TESTING_QUERY_CFG response. */
|
---|
346 | uint32_t u32;
|
---|
347 |
|
---|
348 | /** The read back register (VMMDEV_TESTING_MMIO_OFF_READBACK,
|
---|
349 | * VMMDEV_TESTING_MMIO_OFF_READBACK_R3). */
|
---|
350 | uint8_t abReadBack[VMMDEV_TESTING_READBACK_SIZE];
|
---|
351 | } TestingData;
|
---|
352 | /** The locking testing control dword. */
|
---|
353 | union
|
---|
354 | {
|
---|
355 | /** Plain view. */
|
---|
356 | uint64_t u64;
|
---|
357 | /** Plain 32-bit view. */
|
---|
358 | uint32_t au32[2];
|
---|
359 | struct
|
---|
360 | {
|
---|
361 | /** bits 15:0: Number of microseconds to hold the lock. */
|
---|
362 | uint32_t cUsHold : 16;
|
---|
363 | /** bits 31:16: Number of microseconds to wait before retaking the lock again. */
|
---|
364 | uint32_t cUsBetween : 16;
|
---|
365 | /** bits 51:32: Kilo (1024) ticks the EMT should hold the lock for. */
|
---|
366 | uint32_t cKiloTicksEmtHold : 20;
|
---|
367 | /** bits 57:52: Reserved MBZ. */
|
---|
368 | uint32_t uReserved : 6;
|
---|
369 | /** bit 58: Thread takes lock in shared mode when set, exclusive when clear. */
|
---|
370 | uint32_t fThreadShared : 1;
|
---|
371 | /** bit 59: EMT takes lock in shared mode when set, exclusive when clear. */
|
---|
372 | uint32_t fEmtShared : 1;
|
---|
373 | /** bit 60: Use read/write critical section instead of regular. */
|
---|
374 | uint32_t fReadWriteSection : 1;
|
---|
375 | /** bit 61: EMT passes VINF_SUCCESS as rcBusy if set. */
|
---|
376 | uint32_t fMustSucceed : 1;
|
---|
377 | /** bit 62: Thread pokes EMTs before releasing it when set. */
|
---|
378 | uint32_t fPokeBeforeRelease : 1;
|
---|
379 | /** bit 63: Enabled/disabled. */
|
---|
380 | uint32_t fEnabled : 1;
|
---|
381 | } s;
|
---|
382 | } TestingLockControl;
|
---|
383 | /** Event semaphore that the locking thread blocks. */
|
---|
384 | SUPSEMEVENT hTestingLockEvt;
|
---|
385 | # if HC_ARCH_BITS == 32
|
---|
386 | uint32_t uPadding10;
|
---|
387 | # endif
|
---|
388 | /** Handle for the I/O ports used by the testing component. */
|
---|
389 | IOMIOPORTHANDLE hIoPortTesting;
|
---|
390 | /** Handle for the MMIO region used by the testing component. */
|
---|
391 | IOMMMIOHANDLE hMmioTesting;
|
---|
392 | /** User defined configuration dwords. */
|
---|
393 | uint32_t au32TestingCfgDwords[10];
|
---|
394 | #endif /* !VBOX_WITHOUT_TESTING_FEATURES || DOXYGEN_RUNNING */
|
---|
395 | /** @} */
|
---|
396 |
|
---|
397 | /** Handle for the backdoor logging I/O port. */
|
---|
398 | IOMIOPORTHANDLE hIoPortBackdoorLog;
|
---|
399 | /** Handle for the alternative timesync I/O port. */
|
---|
400 | IOMIOPORTHANDLE hIoPortAltTimesync;
|
---|
401 | /** Handle for the VMM request I/O port (PCI region \#0). */
|
---|
402 | IOMIOPORTHANDLE hIoPortReq;
|
---|
403 | /** Handle for the fast VMM request I/O port (PCI region \#0). */
|
---|
404 | IOMIOPORTHANDLE hIoPortFast;
|
---|
405 | /** Handle for the VMMDev RAM (PCI region \#1). */
|
---|
406 | PGMMMIO2HANDLE hMmio2VMMDevRAM;
|
---|
407 | /** Handle for the VMMDev Heap (PCI region \#2). */
|
---|
408 | PGMMMIO2HANDLE hMmio2Heap;
|
---|
409 | } VMMDEV;
|
---|
410 | /** Pointer to the shared VMM device state. */
|
---|
411 | typedef VMMDEV *PVMMDEV;
|
---|
412 | AssertCompileMemberAlignment(VMMDEV, CritSect, 8);
|
---|
413 | AssertCompileMemberAlignment(VMMDEV, StatSlowIrqAck, 8);
|
---|
414 | AssertCompileMemberAlignment(VMMDEV, cbGuestRAM, 8);
|
---|
415 | AssertCompileMemberAlignment(VMMDEV, enmCpuHotPlugEvent, 4);
|
---|
416 | AssertCompileMemberAlignment(VMMDEV, aFacilityStatuses, 8);
|
---|
417 | #ifndef VBOX_WITHOUT_TESTING_FEATURES
|
---|
418 | AssertCompileMemberAlignment(VMMDEV, TestingData.Value.u64Value, 8);
|
---|
419 | AssertCompileMemberAlignment(VMMDEV, CritSectRw, 64);
|
---|
420 | #endif
|
---|
421 |
|
---|
422 |
|
---|
423 | /** @name VMMDev/HGCM accounting categories (indexes into VMMDEVR3::aHgcmAcc)
|
---|
424 | * @{ */
|
---|
425 | /** Legacy, VMMDEV_REQUESTOR_USR_NOT_GIVEN, VMMDEV_REQUESTOR_USR_DRV,
|
---|
426 | * VMMDEV_REQUESTOR_USR_DRV_OTHER. */
|
---|
427 | #define VMMDEV_HGCM_CATEGORY_KERNEL 0
|
---|
428 | /** VMMDEV_REQUESTOR_USR_ROOT, VMMDEV_REQUESTOR_USR_SYSTEM */
|
---|
429 | #define VMMDEV_HGCM_CATEGORY_ROOT 1
|
---|
430 | /** VMMDEV_REQUESTOR_USR_RESERVED1, VMMDEV_REQUESTOR_USR_USER,
|
---|
431 | * VMMDEV_REQUESTOR_USR_GUEST */
|
---|
432 | #define VMMDEV_HGCM_CATEGORY_USER 2
|
---|
433 | /** Array size. */
|
---|
434 | #define VMMDEV_HGCM_CATEGORY_MAX 3
|
---|
435 | /** @} */
|
---|
436 |
|
---|
437 | /**
|
---|
438 | * State structure for the VMM device, ring-3 edition.
|
---|
439 | */
|
---|
440 | typedef struct VMMDEVR3
|
---|
441 | {
|
---|
442 | /** LUN\#0 + Status: VMMDev port base interface. */
|
---|
443 | PDMIBASE IBase;
|
---|
444 | /** LUN\#0: VMMDev port interface. */
|
---|
445 | PDMIVMMDEVPORT IPort;
|
---|
446 | #ifdef VBOX_WITH_HGCM
|
---|
447 | /** LUN\#0: HGCM port interface. */
|
---|
448 | PDMIHGCMPORT IHGCMPort;
|
---|
449 | /** HGCM connector interface */
|
---|
450 | R3PTRTYPE(PPDMIHGCMCONNECTOR) pHGCMDrv;
|
---|
451 | #endif
|
---|
452 | /** Pointer to base interface of the driver. */
|
---|
453 | R3PTRTYPE(PPDMIBASE) pDrvBase;
|
---|
454 | /** VMMDev connector interface */
|
---|
455 | R3PTRTYPE(PPDMIVMMDEVCONNECTOR) pDrv;
|
---|
456 | /** Pointer to the device instance.
|
---|
457 | * @note Only for interface methods to get their bearings. */
|
---|
458 | PPDMDEVINSR3 pDevIns;
|
---|
459 |
|
---|
460 | /** R3 pointer to VMMDev RAM area */
|
---|
461 | R3PTRTYPE(VMMDevMemory *) pVMMDevRAMR3;
|
---|
462 |
|
---|
463 | /** R3 pointer to VMMDev Heap RAM area. */
|
---|
464 | R3PTRTYPE(VMMDevMemory *) pVMMDevHeapR3;
|
---|
465 |
|
---|
466 | /** Pointer to the credentials. */
|
---|
467 | R3PTRTYPE(VMMDEVCREDS *) pCredentials;
|
---|
468 | /** Set if pCredentials is using the RTMemSafer allocator, clear if heap. */
|
---|
469 | bool fSaferCredentials;
|
---|
470 | bool afAlignment[7];
|
---|
471 |
|
---|
472 | #ifdef VBOX_WITH_HGCM
|
---|
473 | /** Critical section to protect the list. */
|
---|
474 | RTCRITSECT critsectHGCMCmdList;
|
---|
475 | /** List of pending HGCM requests (VBOXHGCMCMD). */
|
---|
476 | RTLISTANCHORR3 listHGCMCmd;
|
---|
477 | /** Whether the HGCM events are already automatically enabled. */
|
---|
478 | uint32_t u32HGCMEnabled;
|
---|
479 | /** Saved state version of restored commands. */
|
---|
480 | uint32_t uSavedStateVersion;
|
---|
481 | RTMEMCACHE hHgcmCmdCache;
|
---|
482 | /** Accounting by for each requestor VMMDEV_REQUESTOR_USR_XXX group.
|
---|
483 | * Legacy requests ends up with VMMDEV_REQUESTOR_USR_NOT_GIVEN */
|
---|
484 | struct
|
---|
485 | {
|
---|
486 | /** The configured heap budget. */
|
---|
487 | uint64_t cbHeapBudgetConfig;
|
---|
488 | /** The currently available heap budget. */
|
---|
489 | uint64_t cbHeapBudget;
|
---|
490 | /** Message stats. */
|
---|
491 | STAMPROFILE StateMsgHeapUsage;
|
---|
492 | /** Budget overruns. */
|
---|
493 | STAMCOUNTER StatBudgetOverruns;
|
---|
494 | } aHgcmAcc[VMMDEV_HGCM_CATEGORY_MAX];
|
---|
495 | STAMPROFILE StatHgcmCmdArrival;
|
---|
496 | STAMPROFILE StatHgcmCmdCompletion;
|
---|
497 | STAMPROFILE StatHgcmCmdTotal;
|
---|
498 | STAMCOUNTER StatHgcmLargeCmdAllocs;
|
---|
499 | STAMCOUNTER StatHgcmFailedPageListLocking;
|
---|
500 | #endif /* VBOX_WITH_HGCM */
|
---|
501 | STAMCOUNTER StatReqBufAllocs;
|
---|
502 | /** Per CPU request 4K sized buffers, allocated as needed. */
|
---|
503 | R3PTRTYPE(VMMDevRequestHeader *) apReqBufs[VMM_MAX_CPU_COUNT];
|
---|
504 |
|
---|
505 | /** Status LUN: Shared folders LED */
|
---|
506 | struct
|
---|
507 | {
|
---|
508 | /** The LED. */
|
---|
509 | PDMLED Led;
|
---|
510 | /** The LED ports. */
|
---|
511 | PDMILEDPORTS ILeds;
|
---|
512 | /** Partner of ILeds. */
|
---|
513 | R3PTRTYPE(PPDMILEDCONNECTORS) pLedsConnector;
|
---|
514 | } SharedFolders;
|
---|
515 |
|
---|
516 | #ifndef VBOX_WITHOUT_TESTING_FEATURES
|
---|
517 | /** The XML output file name (can be a named pipe, doesn't matter to us). */
|
---|
518 | R3PTRTYPE(char *) pszTestingXmlOutput;
|
---|
519 | /** Testing instance for dealing with the output. */
|
---|
520 | RTTEST hTestingTest;
|
---|
521 | /** The locking test thread (). */
|
---|
522 | PPDMTHREAD pTestingLockThread;
|
---|
523 | #endif
|
---|
524 | } VMMDEVR3;
|
---|
525 | /** Pointer to the ring-3 VMM device state. */
|
---|
526 | typedef VMMDEVR3 *PVMMDEVR3;
|
---|
527 |
|
---|
528 |
|
---|
529 | /**
|
---|
530 | * State structure for the VMM device, ring-0 edition.
|
---|
531 | */
|
---|
532 | typedef struct VMMDEVR0
|
---|
533 | {
|
---|
534 | /** R0 pointer to VMMDev RAM area - first page only, could be NULL! */
|
---|
535 | R0PTRTYPE(VMMDevMemory *) pVMMDevRAMR0;
|
---|
536 | } VMMDEVR0;
|
---|
537 | /** Pointer to the ring-0 VMM device state. */
|
---|
538 | typedef VMMDEVR0 *PVMMDEVR0;
|
---|
539 |
|
---|
540 |
|
---|
541 | /**
|
---|
542 | * State structure for the VMM device, raw-mode edition.
|
---|
543 | */
|
---|
544 | typedef struct VMMDEVRC
|
---|
545 | {
|
---|
546 | /** R0 pointer to VMMDev RAM area - first page only, could be NULL! */
|
---|
547 | RCPTRTYPE(VMMDevMemory *) pVMMDevRAMRC;
|
---|
548 | } VMMDEVRC;
|
---|
549 | /** Pointer to the raw-mode VMM device state. */
|
---|
550 | typedef VMMDEVRC *PVMMDEVRC;
|
---|
551 |
|
---|
552 |
|
---|
553 | /** @typedef VMMDEVCC
|
---|
554 | * The VMMDEV device data for the current context. */
|
---|
555 | typedef CTX_SUFF(VMMDEV) VMMDEVCC;
|
---|
556 | /** @typedef PVMMDEVCC
|
---|
557 | * Pointer to the VMMDEV device for the current context. */
|
---|
558 | typedef CTX_SUFF(PVMMDEV) PVMMDEVCC;
|
---|
559 |
|
---|
560 |
|
---|
561 | void VMMDevNotifyGuest(PPDMDEVINS pDevIns, PVMMDEV pThis, PVMMDEVCC pThisCC, uint32_t fAddEvents);
|
---|
562 | void VMMDevCtlSetGuestFilterMask(PPDMDEVINS pDevIns, PVMMDEV pThis, PVMMDEVCC pThisCC, uint32_t fOrMask, uint32_t fNotMask);
|
---|
563 |
|
---|
564 |
|
---|
565 | /** The saved state version. */
|
---|
566 | #define VMMDEV_SAVED_STATE_VERSION VMMDEV_SAVED_STATE_VERSION_DISPLAY_CHANGE_DATA
|
---|
567 | /** The saved state version with display change data state. */
|
---|
568 | #define VMMDEV_SAVED_STATE_VERSION_DISPLAY_CHANGE_DATA 18
|
---|
569 | /** Updated HGCM commands. */
|
---|
570 | #define VMMDEV_SAVED_STATE_VERSION_HGCM_PARAMS 17
|
---|
571 | /** The saved state version with heartbeat state. */
|
---|
572 | #define VMMDEV_SAVED_STATE_VERSION_HEARTBEAT 16
|
---|
573 | /** The saved state version without heartbeat state. */
|
---|
574 | #define VMMDEV_SAVED_STATE_VERSION_NO_HEARTBEAT 15
|
---|
575 | /** The saved state version which is missing the guest facility statuses. */
|
---|
576 | #define VMMDEV_SAVED_STATE_VERSION_MISSING_FACILITY_STATUSES 14
|
---|
577 | /** The saved state version which is missing the guestInfo2 bits. */
|
---|
578 | #define VMMDEV_SAVED_STATE_VERSION_MISSING_GUEST_INFO_2 13
|
---|
579 | /** The saved state version used by VirtualBox 3.0.
|
---|
580 | * This doesn't have the config part. */
|
---|
581 | #define VMMDEV_SAVED_STATE_VERSION_VBOX_30 11
|
---|
582 |
|
---|
583 | #endif /* !VBOX_INCLUDED_SRC_VMMDev_VMMDevState_h */
|
---|
584 |
|
---|