1 | /* $Id: VMMDevState.h 97790 2022-12-13 13:06:03Z 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, 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 | /** Alignment padding. */
|
---|
271 | bool afPadding8[3];
|
---|
272 | /** CPU hotplug event */
|
---|
273 | VMMDevCpuEventType enmCpuHotPlugEvent;
|
---|
274 | /** Core id of the CPU to change */
|
---|
275 | uint32_t idCpuCore;
|
---|
276 | /** Package id of the CPU to change */
|
---|
277 | uint32_t idCpuPackage;
|
---|
278 |
|
---|
279 | uint32_t StatMemBalloonChunks;
|
---|
280 |
|
---|
281 | /** @name Heartbeat
|
---|
282 | * @{ */
|
---|
283 | /** Timestamp of the last heartbeat from guest in nanosec. */
|
---|
284 | uint64_t volatile nsLastHeartbeatTS;
|
---|
285 | /** Indicates whether we missed HB from guest on last check. */
|
---|
286 | bool volatile fFlatlined;
|
---|
287 | /** Indicates whether heartbeat check is active. */
|
---|
288 | bool volatile fHeartbeatActive;
|
---|
289 | /** Alignment padding. */
|
---|
290 | bool afAlignment8[6];
|
---|
291 | /** Guest heartbeat interval in nanoseconds.
|
---|
292 | * This is the interval the guest is told to produce heartbeats at. */
|
---|
293 | uint64_t cNsHeartbeatInterval;
|
---|
294 | /** The amount of time without a heartbeat (nanoseconds) before we
|
---|
295 | * conclude the guest is doing a Dixie Flatline (Neuromancer) impression. */
|
---|
296 | uint64_t cNsHeartbeatTimeout;
|
---|
297 | /** Timer for signalling a flatlined guest. */
|
---|
298 | TMTIMERHANDLE hFlatlinedTimer;
|
---|
299 | /** @} */
|
---|
300 |
|
---|
301 | /** @name Testing
|
---|
302 | * @{ */
|
---|
303 | /** Set if testing is enabled. */
|
---|
304 | bool fTestingEnabled;
|
---|
305 | /** Set if testing the MMIO testing range is enabled. */
|
---|
306 | bool fTestingMMIO;
|
---|
307 | #if defined(VBOX_WITHOUT_TESTING_FEATURES) && !defined(DOXYGEN_RUNNING)
|
---|
308 | /** Alignment padding. */
|
---|
309 | bool afPadding9[2];
|
---|
310 | #else
|
---|
311 | /** The amount of readable testing data (for query response). */
|
---|
312 | uint16_t cbReadableTestingData;
|
---|
313 | /** The high timestamp value. */
|
---|
314 | uint32_t u32TestingHighTimestamp;
|
---|
315 | /** The current testing command (VMMDEV_TESTING_CMD_XXX). */
|
---|
316 | uint32_t u32TestingCmd;
|
---|
317 | /** The testing data offset (command specific). */
|
---|
318 | uint32_t offTestingData;
|
---|
319 | /** For buffering the what comes in over the testing data port. */
|
---|
320 | union
|
---|
321 | {
|
---|
322 | /** Plain byte view. */
|
---|
323 | uint8_t ab[1024];
|
---|
324 |
|
---|
325 | /** VMMDEV_TESTING_CMD_INIT, VMMDEV_TESTING_CMD_SUB_NEW,
|
---|
326 | * VMMDEV_TESTING_CMD_FAILED. */
|
---|
327 | struct
|
---|
328 | {
|
---|
329 | char sz[1024];
|
---|
330 | } String, Init, SubNew, Failed;
|
---|
331 |
|
---|
332 | /** VMMDEV_TESTING_CMD_TERM, VMMDEV_TESTING_CMD_SUB_DONE. */
|
---|
333 | struct
|
---|
334 | {
|
---|
335 | uint32_t c;
|
---|
336 | } Error, Term, SubDone;
|
---|
337 |
|
---|
338 | /** VMMDEV_TESTING_CMD_VALUE. */
|
---|
339 | struct
|
---|
340 | {
|
---|
341 | RTUINT64U u64Value;
|
---|
342 | uint32_t u32Unit;
|
---|
343 | char szName[1024 - 8 - 4];
|
---|
344 | } Value;
|
---|
345 |
|
---|
346 | /** A 8-bit VMMDEV_TESTING_QUERY_CFG response. */
|
---|
347 | uint8_t b;
|
---|
348 | /** A 32-bit VMMDEV_TESTING_QUERY_CFG response. */
|
---|
349 | uint32_t u32;
|
---|
350 |
|
---|
351 | /** The read back register (VMMDEV_TESTING_MMIO_OFF_READBACK,
|
---|
352 | * VMMDEV_TESTING_MMIO_OFF_READBACK_R3). */
|
---|
353 | uint8_t abReadBack[VMMDEV_TESTING_READBACK_SIZE];
|
---|
354 | } TestingData;
|
---|
355 | /** The locking testing control dword. */
|
---|
356 | union
|
---|
357 | {
|
---|
358 | /** Plain view. */
|
---|
359 | uint64_t u64;
|
---|
360 | /** Plain 32-bit view. */
|
---|
361 | uint32_t au32[2];
|
---|
362 | struct
|
---|
363 | {
|
---|
364 | /** bits 15:0: Number of microseconds to hold the lock. */
|
---|
365 | uint32_t cUsHold : 16;
|
---|
366 | /** bits 31:16: Number of microseconds to wait before retaking the lock again. */
|
---|
367 | uint32_t cUsBetween : 16;
|
---|
368 | /** bits 51:32: Kilo (1024) ticks the EMT should hold the lock for. */
|
---|
369 | uint32_t cKiloTicksEmtHold : 20;
|
---|
370 | /** bits 57:52: Reserved MBZ. */
|
---|
371 | uint32_t uReserved : 6;
|
---|
372 | /** bit 58: Thread takes lock in shared mode when set, exclusive when clear. */
|
---|
373 | uint32_t fThreadShared : 1;
|
---|
374 | /** bit 59: EMT takes lock in shared mode when set, exclusive when clear. */
|
---|
375 | uint32_t fEmtShared : 1;
|
---|
376 | /** bit 60: Use read/write critical section instead of regular. */
|
---|
377 | uint32_t fReadWriteSection : 1;
|
---|
378 | /** bit 61: EMT passes VINF_SUCCESS as rcBusy if set. */
|
---|
379 | uint32_t fMustSucceed : 1;
|
---|
380 | /** bit 62: Thread pokes EMTs before releasing it when set. */
|
---|
381 | uint32_t fPokeBeforeRelease : 1;
|
---|
382 | /** bit 63: Enabled/disabled. */
|
---|
383 | uint32_t fEnabled : 1;
|
---|
384 | } s;
|
---|
385 | } TestingLockControl;
|
---|
386 | /** Event semaphore that the locking thread blocks. */
|
---|
387 | SUPSEMEVENT hTestingLockEvt;
|
---|
388 | # if HC_ARCH_BITS == 32
|
---|
389 | uint32_t uPadding10;
|
---|
390 | # endif
|
---|
391 | /** Handle for the I/O ports used by the testing component. */
|
---|
392 | IOMIOPORTHANDLE hIoPortTesting;
|
---|
393 | /** Handle for the MMIO region used by the testing component. */
|
---|
394 | IOMMMIOHANDLE hMmioTesting;
|
---|
395 | /** User defined configuration dwords. */
|
---|
396 | uint32_t au32TestingCfgDwords[10];
|
---|
397 | #endif /* !VBOX_WITHOUT_TESTING_FEATURES || DOXYGEN_RUNNING */
|
---|
398 | /** @} */
|
---|
399 |
|
---|
400 | /** Handle for the backdoor logging I/O port. */
|
---|
401 | IOMIOPORTHANDLE hIoPortBackdoorLog;
|
---|
402 | /** Handle for the alternative timesync I/O port. */
|
---|
403 | IOMIOPORTHANDLE hIoPortAltTimesync;
|
---|
404 | /** Handle for the VMM request I/O port (PCI region \#0). */
|
---|
405 | IOMIOPORTHANDLE hIoPortReq;
|
---|
406 | /** Handle for the fast VMM request I/O port (PCI region \#0). */
|
---|
407 | IOMIOPORTHANDLE hIoPortFast;
|
---|
408 | /** Handle for the VMMDev RAM (PCI region \#1). */
|
---|
409 | PGMMMIO2HANDLE hMmio2VMMDevRAM;
|
---|
410 | /** Handle for the VMMDev Heap (PCI region \#2). */
|
---|
411 | PGMMMIO2HANDLE hMmio2Heap;
|
---|
412 | } VMMDEV;
|
---|
413 | /** Pointer to the shared VMM device state. */
|
---|
414 | typedef VMMDEV *PVMMDEV;
|
---|
415 | AssertCompileMemberAlignment(VMMDEV, CritSect, 8);
|
---|
416 | AssertCompileMemberAlignment(VMMDEV, StatSlowIrqAck, 8);
|
---|
417 | AssertCompileMemberAlignment(VMMDEV, cbGuestRAM, 8);
|
---|
418 | AssertCompileMemberAlignment(VMMDEV, enmCpuHotPlugEvent, 4);
|
---|
419 | AssertCompileMemberAlignment(VMMDEV, aFacilityStatuses, 8);
|
---|
420 | #ifndef VBOX_WITHOUT_TESTING_FEATURES
|
---|
421 | AssertCompileMemberAlignment(VMMDEV, TestingData.Value.u64Value, 8);
|
---|
422 | AssertCompileMemberAlignment(VMMDEV, CritSectRw, 64);
|
---|
423 | #endif
|
---|
424 |
|
---|
425 |
|
---|
426 | /** @name VMMDev/HGCM accounting categories (indexes into VMMDEVR3::aHgcmAcc)
|
---|
427 | * @{ */
|
---|
428 | /** Legacy, VMMDEV_REQUESTOR_USR_NOT_GIVEN, VMMDEV_REQUESTOR_USR_DRV,
|
---|
429 | * VMMDEV_REQUESTOR_USR_DRV_OTHER. */
|
---|
430 | #define VMMDEV_HGCM_CATEGORY_KERNEL 0
|
---|
431 | /** VMMDEV_REQUESTOR_USR_ROOT, VMMDEV_REQUESTOR_USR_SYSTEM */
|
---|
432 | #define VMMDEV_HGCM_CATEGORY_ROOT 1
|
---|
433 | /** VMMDEV_REQUESTOR_USR_RESERVED1, VMMDEV_REQUESTOR_USR_USER,
|
---|
434 | * VMMDEV_REQUESTOR_USR_GUEST */
|
---|
435 | #define VMMDEV_HGCM_CATEGORY_USER 2
|
---|
436 | /** Array size. */
|
---|
437 | #define VMMDEV_HGCM_CATEGORY_MAX 3
|
---|
438 | /** @} */
|
---|
439 |
|
---|
440 | /**
|
---|
441 | * State structure for the VMM device, ring-3 edition.
|
---|
442 | */
|
---|
443 | typedef struct VMMDEVR3
|
---|
444 | {
|
---|
445 | /** LUN\#0 + Status: VMMDev port base interface. */
|
---|
446 | PDMIBASE IBase;
|
---|
447 | /** LUN\#0: VMMDev port interface. */
|
---|
448 | PDMIVMMDEVPORT IPort;
|
---|
449 | #ifdef VBOX_WITH_HGCM
|
---|
450 | /** LUN\#0: HGCM port interface. */
|
---|
451 | PDMIHGCMPORT IHGCMPort;
|
---|
452 | /** HGCM connector interface */
|
---|
453 | R3PTRTYPE(PPDMIHGCMCONNECTOR) pHGCMDrv;
|
---|
454 | #endif
|
---|
455 | /** Pointer to base interface of the driver. */
|
---|
456 | R3PTRTYPE(PPDMIBASE) pDrvBase;
|
---|
457 | /** VMMDev connector interface */
|
---|
458 | R3PTRTYPE(PPDMIVMMDEVCONNECTOR) pDrv;
|
---|
459 | /** Pointer to the device instance.
|
---|
460 | * @note Only for interface methods to get their bearings. */
|
---|
461 | PPDMDEVINSR3 pDevIns;
|
---|
462 |
|
---|
463 | /** R3 pointer to VMMDev RAM area */
|
---|
464 | R3PTRTYPE(VMMDevMemory *) pVMMDevRAMR3;
|
---|
465 |
|
---|
466 | /** R3 pointer to VMMDev Heap RAM area. */
|
---|
467 | R3PTRTYPE(VMMDevMemory *) pVMMDevHeapR3;
|
---|
468 |
|
---|
469 | /** Pointer to the credentials. */
|
---|
470 | R3PTRTYPE(VMMDEVCREDS *) pCredentials;
|
---|
471 | /** Set if pCredentials is using the RTMemSafer allocator, clear if heap. */
|
---|
472 | bool fSaferCredentials;
|
---|
473 | bool afAlignment[7];
|
---|
474 |
|
---|
475 | #ifdef VBOX_WITH_HGCM
|
---|
476 | /** Critical section to protect the list. */
|
---|
477 | RTCRITSECT critsectHGCMCmdList;
|
---|
478 | /** List of pending HGCM requests (VBOXHGCMCMD). */
|
---|
479 | RTLISTANCHORR3 listHGCMCmd;
|
---|
480 | /** Whether the HGCM events are already automatically enabled. */
|
---|
481 | uint32_t u32HGCMEnabled;
|
---|
482 | /** Saved state version of restored commands. */
|
---|
483 | uint32_t uSavedStateVersion;
|
---|
484 | RTMEMCACHE hHgcmCmdCache;
|
---|
485 | /** Accounting by for each requestor VMMDEV_REQUESTOR_USR_XXX group.
|
---|
486 | * Legacy requests ends up with VMMDEV_REQUESTOR_USR_NOT_GIVEN */
|
---|
487 | struct
|
---|
488 | {
|
---|
489 | /** The configured heap budget. */
|
---|
490 | uint64_t cbHeapBudgetConfig;
|
---|
491 | /** The currently available heap budget. */
|
---|
492 | uint64_t cbHeapBudget;
|
---|
493 | /** Message stats. */
|
---|
494 | STAMPROFILE StateMsgHeapUsage;
|
---|
495 | /** Budget overruns. */
|
---|
496 | STAMCOUNTER StatBudgetOverruns;
|
---|
497 | } aHgcmAcc[VMMDEV_HGCM_CATEGORY_MAX];
|
---|
498 | STAMPROFILE StatHgcmCmdArrival;
|
---|
499 | STAMPROFILE StatHgcmCmdCompletion;
|
---|
500 | STAMPROFILE StatHgcmCmdTotal;
|
---|
501 | STAMCOUNTER StatHgcmLargeCmdAllocs;
|
---|
502 | STAMCOUNTER StatHgcmFailedPageListLocking;
|
---|
503 | #endif /* VBOX_WITH_HGCM */
|
---|
504 | STAMCOUNTER StatReqBufAllocs;
|
---|
505 | /** Per CPU request 4K sized buffers, allocated as needed. */
|
---|
506 | R3PTRTYPE(VMMDevRequestHeader *) apReqBufs[VMM_MAX_CPU_COUNT];
|
---|
507 |
|
---|
508 | /** Status LUN: Shared folders LED */
|
---|
509 | struct
|
---|
510 | {
|
---|
511 | /** The LED. */
|
---|
512 | PDMLED Led;
|
---|
513 | /** The LED ports. */
|
---|
514 | PDMILEDPORTS ILeds;
|
---|
515 | /** Partner of ILeds. */
|
---|
516 | R3PTRTYPE(PPDMILEDCONNECTORS) pLedsConnector;
|
---|
517 | } SharedFolders;
|
---|
518 |
|
---|
519 | #ifndef VBOX_WITHOUT_TESTING_FEATURES
|
---|
520 | /** The XML output file name (can be a named pipe, doesn't matter to us). */
|
---|
521 | R3PTRTYPE(char *) pszTestingXmlOutput;
|
---|
522 | /** Testing instance for dealing with the output. */
|
---|
523 | RTTEST hTestingTest;
|
---|
524 | /** The locking test thread (). */
|
---|
525 | PPDMTHREAD pTestingLockThread;
|
---|
526 | #endif
|
---|
527 | } VMMDEVR3;
|
---|
528 | /** Pointer to the ring-3 VMM device state. */
|
---|
529 | typedef VMMDEVR3 *PVMMDEVR3;
|
---|
530 |
|
---|
531 |
|
---|
532 | /**
|
---|
533 | * State structure for the VMM device, ring-0 edition.
|
---|
534 | */
|
---|
535 | typedef struct VMMDEVR0
|
---|
536 | {
|
---|
537 | /** R0 pointer to VMMDev RAM area - first page only, could be NULL! */
|
---|
538 | R0PTRTYPE(VMMDevMemory *) pVMMDevRAMR0;
|
---|
539 | } VMMDEVR0;
|
---|
540 | /** Pointer to the ring-0 VMM device state. */
|
---|
541 | typedef VMMDEVR0 *PVMMDEVR0;
|
---|
542 |
|
---|
543 |
|
---|
544 | /**
|
---|
545 | * State structure for the VMM device, raw-mode edition.
|
---|
546 | */
|
---|
547 | typedef struct VMMDEVRC
|
---|
548 | {
|
---|
549 | /** R0 pointer to VMMDev RAM area - first page only, could be NULL! */
|
---|
550 | RCPTRTYPE(VMMDevMemory *) pVMMDevRAMRC;
|
---|
551 | } VMMDEVRC;
|
---|
552 | /** Pointer to the raw-mode VMM device state. */
|
---|
553 | typedef VMMDEVRC *PVMMDEVRC;
|
---|
554 |
|
---|
555 |
|
---|
556 | /** @typedef VMMDEVCC
|
---|
557 | * The VMMDEV device data for the current context. */
|
---|
558 | typedef CTX_SUFF(VMMDEV) VMMDEVCC;
|
---|
559 | /** @typedef PVMMDEVCC
|
---|
560 | * Pointer to the VMMDEV device for the current context. */
|
---|
561 | typedef CTX_SUFF(PVMMDEV) PVMMDEVCC;
|
---|
562 |
|
---|
563 |
|
---|
564 | void VMMDevNotifyGuest(PPDMDEVINS pDevIns, PVMMDEV pThis, PVMMDEVCC pThisCC, uint32_t fAddEvents);
|
---|
565 | void VMMDevCtlSetGuestFilterMask(PPDMDEVINS pDevIns, PVMMDEV pThis, PVMMDEVCC pThisCC, uint32_t fOrMask, uint32_t fNotMask);
|
---|
566 |
|
---|
567 |
|
---|
568 | /** The saved state version. */
|
---|
569 | #define VMMDEV_SAVED_STATE_VERSION VMMDEV_SAVED_STATE_VERSION_VMM_MOUSE_EXTENDED_DATA
|
---|
570 | /** The saved state version with VMMDev mouse buttons state and wheel movement data. */
|
---|
571 | #define VMMDEV_SAVED_STATE_VERSION_VMM_MOUSE_EXTENDED_DATA 19
|
---|
572 | /** The saved state version with display change data state. */
|
---|
573 | #define VMMDEV_SAVED_STATE_VERSION_DISPLAY_CHANGE_DATA 18
|
---|
574 | /** Updated HGCM commands. */
|
---|
575 | #define VMMDEV_SAVED_STATE_VERSION_HGCM_PARAMS 17
|
---|
576 | /** The saved state version with heartbeat state. */
|
---|
577 | #define VMMDEV_SAVED_STATE_VERSION_HEARTBEAT 16
|
---|
578 | /** The saved state version without heartbeat state. */
|
---|
579 | #define VMMDEV_SAVED_STATE_VERSION_NO_HEARTBEAT 15
|
---|
580 | /** The saved state version which is missing the guest facility statuses. */
|
---|
581 | #define VMMDEV_SAVED_STATE_VERSION_MISSING_FACILITY_STATUSES 14
|
---|
582 | /** The saved state version which is missing the guestInfo2 bits. */
|
---|
583 | #define VMMDEV_SAVED_STATE_VERSION_MISSING_GUEST_INFO_2 13
|
---|
584 | /** The saved state version used by VirtualBox 3.0.
|
---|
585 | * This doesn't have the config part. */
|
---|
586 | #define VMMDEV_SAVED_STATE_VERSION_VBOX_30 11
|
---|
587 |
|
---|
588 | #endif /* !VBOX_INCLUDED_SRC_VMMDev_VMMDevState_h */
|
---|
589 |
|
---|