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