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