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