VirtualBox

source: vbox/trunk/src/VBox/Devices/VMMDev/VMMDevState.h@ 78403

Last change on this file since 78403 was 77243, checked in by vboxsync, 6 years ago

HGCM,SharedFolders: Added new variation on the HGCM page list type that does not use a bounce buffer. bugref:9172

  • Added VMMDevHGCMParmType_NoBouncePageList.
  • Made VMMDevHGCMParmType_Embedded
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 15.2 KB
Line 
1/* $Id: VMMDevState.h 77243 2019-02-10 22:44:00Z vboxsync $ */
2/** @file
3 * VMMDev - Guest <-> VMM/Host communication device, internal header.
4 */
5
6/*
7 * Copyright (C) 2006-2019 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 <iprt/test.h>
30# include <VBox/VMMDevTesting.h>
31#endif
32
33#include <iprt/list.h>
34#include <iprt/memcache.h>
35
36
37#define VMMDEV_WITH_ALT_TIMESYNC
38
39/** Request locking structure (HGCM optimization). */
40typedef struct VMMDEVREQLOCK
41{
42 void *pvReq;
43 PGMPAGEMAPLOCK Lock;
44} VMMDEVREQLOCK;
45/** Pointer to a request lock structure. */
46typedef VMMDEVREQLOCK *PVMMDEVREQLOCK;
47
48typedef struct DISPLAYCHANGEREQUEST
49{
50 bool fPending;
51 bool afAlignment[3];
52 VMMDevDisplayDef displayChangeRequest;
53 VMMDevDisplayDef lastReadDisplayChangeRequest;
54} DISPLAYCHANGEREQUEST;
55
56typedef struct DISPLAYCHANGEDATA
57{
58 /* Which monitor is being reported to the guest. */
59 int32_t iCurrentMonitor;
60
61 /** true if the guest responded to VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST at least once */
62 bool fGuestSentChangeEventAck;
63 bool afAlignment[3];
64
65 DISPLAYCHANGEREQUEST aRequests[VBOX_VIDEO_MAX_SCREENS];
66} DISPLAYCHANGEDATA;
67
68
69/**
70 * Credentials for automatic guest logon and host configured logon (?).
71 *
72 * This is not stored in the same block as the instance data in order to make it
73 * harder to access.
74 */
75typedef struct VMMDEVCREDS
76{
77 /** credentials for guest logon purposes */
78 struct
79 {
80 char szUserName[VMMDEV_CREDENTIALS_SZ_SIZE];
81 char szPassword[VMMDEV_CREDENTIALS_SZ_SIZE];
82 char szDomain[VMMDEV_CREDENTIALS_SZ_SIZE];
83 bool fAllowInteractiveLogon;
84 } Logon;
85
86 /** credentials for verification by guest */
87 struct
88 {
89 char szUserName[VMMDEV_CREDENTIALS_SZ_SIZE];
90 char szPassword[VMMDEV_CREDENTIALS_SZ_SIZE];
91 char szDomain[VMMDEV_CREDENTIALS_SZ_SIZE];
92 } Judge;
93} VMMDEVCREDS;
94
95
96/**
97 * Facility status entry.
98 */
99typedef struct VMMDEVFACILITYSTATUSENTRY
100{
101 /** The facility (may contain values other than the defined ones). */
102 VBoxGuestFacilityType enmFacility;
103 /** The status (may contain values other than the defined ones). */
104 VBoxGuestFacilityStatus enmStatus;
105 /** Whether this entry is fixed and cannot be reused when inactive. */
106 bool fFixed;
107 /** Explicit alignment padding / reserved for future use. MBZ. */
108 bool afPadding[3];
109 /** The facility flags (yet to be defined). */
110 uint32_t fFlags;
111 /** Last update timestamp. */
112 RTTIMESPEC TimeSpecTS;
113} VMMDEVFACILITYSTATUSENTRY;
114/** Pointer to a facility status entry. */
115typedef VMMDEVFACILITYSTATUSENTRY *PVMMDEVFACILITYSTATUSENTRY;
116
117
118/**
119 * State structure for the VMM device.
120 */
121typedef struct VMMDevState
122{
123 /** The PCI device structure. */
124 PDMPCIDEV PciDev;
125 /** The critical section for this device.
126 * @remarks We use this rather than the default one, it's simpler with all
127 * the driver interfaces where we have to waste time digging out the
128 * PDMDEVINS structure. */
129 PDMCRITSECT CritSect;
130
131 /** hypervisor address space size */
132 uint32_t hypervisorSize;
133
134 /** mouse capabilities of host and guest */
135 uint32_t mouseCapabilities;
136 /** absolute mouse position in pixels */
137 int32_t mouseXAbs;
138 int32_t mouseYAbs;
139 /** Does the guest currently want the host pointer to be shown? */
140 uint32_t fHostCursorRequested;
141
142//#if HC_ARCH_BITS == 32
143// /** Alignment padding. */
144// uint32_t u32Alignment0;
145//#endif
146
147 /** Pointer to device instance - RC pointer. */
148 PPDMDEVINSRC pDevInsRC;
149 /** Pointer to device instance - R3 poitner. */
150 PPDMDEVINSR3 pDevInsR3;
151 /** Pointer to device instance - R0 pointer. */
152 PPDMDEVINSR0 pDevInsR0;
153
154 /** LUN\#0 + Status: VMMDev port base interface. */
155 PDMIBASE IBase;
156 /** LUN\#0: VMMDev port interface. */
157 PDMIVMMDEVPORT IPort;
158#ifdef VBOX_WITH_HGCM
159 /** LUN\#0: HGCM port interface. */
160 PDMIHGCMPORT IHGCMPort;
161//# if HC_ARCH_BITS == 32
162// RTR3PTR R3PtrAlignment1;
163//# endif
164#endif
165 /** Pointer to base interface of the driver. */
166 R3PTRTYPE(PPDMIBASE) pDrvBase;
167 /** VMMDev connector interface */
168 R3PTRTYPE(PPDMIVMMDEVCONNECTOR) pDrv;
169#ifdef VBOX_WITH_HGCM
170 /** HGCM connector interface */
171 R3PTRTYPE(PPDMIHGCMCONNECTOR) pHGCMDrv;
172#endif
173 /** message buffer for backdoor logging. */
174 char szMsg[512];
175 /** message buffer index. */
176 uint32_t iMsg;
177 /** Alignment padding. */
178 uint32_t u32Alignment2;
179
180 /** Statistics counter for slow IRQ ACK. */
181 STAMCOUNTER StatSlowIrqAck;
182 /** Statistics counter for fast IRQ ACK - R3. */
183 STAMCOUNTER StatFastIrqAckR3;
184 /** Statistics counter for fast IRQ ACK - R0 / RC. */
185 STAMCOUNTER StatFastIrqAckRZ;
186 /** IRQ number assigned to the device */
187 uint32_t irq;
188 /** Current host side event flags */
189 uint32_t u32HostEventFlags;
190 /** Mask of events guest is interested in.
191 * @note The HGCM events are enabled automatically by the VMMDev device when
192 * guest issues HGCM commands. */
193 uint32_t u32GuestFilterMask;
194 /** Delayed mask of guest events */
195 uint32_t u32NewGuestFilterMask;
196 /** Flag whether u32NewGuestFilterMask is valid */
197 bool fNewGuestFilterMask;
198 /** Alignment padding. */
199 bool afAlignment3[3];
200
201 /** GC physical address of VMMDev RAM area */
202 RTGCPHYS32 GCPhysVMMDevRAM;
203 /** R3 pointer to VMMDev RAM area */
204 R3PTRTYPE(VMMDevMemory *) pVMMDevRAMR3;
205 /** R0 pointer to VMMDev RAM area - first page only, could be NULL! */
206 R0PTRTYPE(VMMDevMemory *) pVMMDevRAMR0;
207 /** R0 pointer to VMMDev RAM area - first page only, could be NULL! */
208 RCPTRTYPE(VMMDevMemory *) pVMMDevRAMRC;
209#if HC_ARCH_BITS != 32
210 RTRCPTR RCPtrAlignment3b;
211#endif
212
213 /** R3 pointer to VMMDev Heap RAM area. */
214 R3PTRTYPE(VMMDevMemory *) pVMMDevHeapR3;
215 /** GC physical address of VMMDev Heap RAM area */
216 RTGCPHYS32 GCPhysVMMDevHeap;
217
218 /** Information reported by guest via VMMDevReportGuestInfo generic request.
219 * Until this information is reported the VMMDev refuses any other requests.
220 */
221 VBoxGuestInfo guestInfo;
222 /** Information report \#2, chewed a little. */
223 struct
224 {
225 uint32_t uFullVersion; /**< non-zero if info is present. */
226 uint32_t uRevision;
227 uint32_t fFeatures;
228 char szName[128];
229 } guestInfo2;
230
231 /** Array of guest facility statuses. */
232 VMMDEVFACILITYSTATUSENTRY aFacilityStatuses[32];
233 /** The number of valid entries in the facility status array. */
234 uint32_t cFacilityStatuses;
235
236 /** Information reported by guest via VMMDevReportGuestCapabilities. */
237 uint32_t guestCaps;
238
239 /** "Additions are Ok" indicator, set to true after processing VMMDevReportGuestInfo,
240 * if additions version is compatible. This flag is here to avoid repeated comparing
241 * of the version in guestInfo.
242 */
243 uint32_t fu32AdditionsOk;
244
245 /** Video acceleration status set by guest. */
246 uint32_t u32VideoAccelEnabled;
247
248 DISPLAYCHANGEDATA displayChangeData;
249
250 /** Pointer to the credentials. */
251 R3PTRTYPE(VMMDEVCREDS *) pCredentials;
252
253#if HC_ARCH_BITS == 32
254 uint32_t uAlignment4;
255#endif
256
257 /* memory balloon change request */
258 uint32_t cMbMemoryBalloon;
259 /** The last balloon size queried by the guest additions. */
260 uint32_t cMbMemoryBalloonLast;
261
262 /* guest ram size */
263 uint64_t cbGuestRAM;
264
265 /* unique session id; the id will be different after each start, reset or restore of the VM. */
266 uint64_t idSession;
267
268 /* statistics interval change request */
269 uint32_t u32StatIntervalSize, u32LastStatIntervalSize;
270
271 /* seamless mode change request */
272 bool fLastSeamlessEnabled, fSeamlessEnabled;
273 bool afAlignment5[1];
274
275 bool fVRDPEnabled;
276 uint32_t uVRDPExperienceLevel;
277
278#ifdef VMMDEV_WITH_ALT_TIMESYNC
279 uint64_t hostTime;
280 bool fTimesyncBackdoorLo;
281 bool afAlignment6[2];
282#else
283 bool afAlignment6[1+2];
284#endif
285 /** Set if GetHostTime should fail.
286 * Loaded from the GetHostTimeDisabled configuration value. */
287 bool fGetHostTimeDisabled;
288
289 /** Set if backdoor logging should be disabled (output will be ignored then) */
290 bool fBackdoorLogDisabled;
291
292 /** Don't clear credentials */
293 bool fKeepCredentials;
294
295 /** Heap enabled. */
296 bool fHeapEnabled;
297
298 /** Guest Core Dumping enabled. */
299 bool fGuestCoreDumpEnabled;
300
301 /** Guest Core Dump location. */
302 char szGuestCoreDumpDir[RTPATH_MAX];
303
304 /** Number of additional cores to keep around. */
305 uint32_t cGuestCoreDumps;
306
307#ifdef VBOX_WITH_HGCM
308 /** List of pending HGCM requests (VBOXHGCMCMD). */
309 RTLISTANCHORR3 listHGCMCmd;
310 /** Critical section to protect the list. */
311 RTCRITSECT critsectHGCMCmdList;
312 /** Whether the HGCM events are already automatically enabled. */
313 uint32_t u32HGCMEnabled;
314 /** Saved state version of restored commands. */
315 uint32_t u32SSMVersion;
316 RTMEMCACHE hHgcmCmdCache;
317 STAMPROFILE StatHgcmCmdArrival;
318 STAMPROFILE StatHgcmCmdCompletion;
319 STAMPROFILE StatHgcmCmdTotal;
320 STAMCOUNTER StatHgcmLargeCmdAllocs;
321 STAMCOUNTER StatHgcmFailedPageListLocking;
322#endif /* VBOX_WITH_HGCM */
323 STAMCOUNTER StatReqBufAllocs;
324
325 /** Per CPU request 4K sized buffers, allocated as needed. */
326 R3PTRTYPE(VMMDevRequestHeader *) apReqBufs[VMM_MAX_CPU_COUNT];
327
328 /** Status LUN: Shared folders LED */
329 struct
330 {
331 /** The LED. */
332 PDMLED Led;
333 /** The LED ports. */
334 PDMILEDPORTS ILeds;
335 /** Partner of ILeds. */
336 R3PTRTYPE(PPDMILEDCONNECTORS) pLedsConnector;
337 } SharedFolders;
338
339 /** FLag whether CPU hotplug events are monitored */
340 bool fCpuHotPlugEventsEnabled;
341 /** Alignment padding. */
342 bool afPadding8[3];
343 /** CPU hotplug event */
344 VMMDevCpuEventType enmCpuHotPlugEvent;
345 /** Core id of the CPU to change */
346 uint32_t idCpuCore;
347 /** Package id of the CPU to change */
348 uint32_t idCpuPackage;
349
350 uint32_t StatMemBalloonChunks;
351
352 /** Set if RC/R0 is enabled. */
353 bool fRZEnabled;
354 /** Set if testing is enabled. */
355 bool fTestingEnabled;
356 /** Set if testing the MMIO testing range is enabled. */
357 bool fTestingMMIO;
358 /** Alignment padding. */
359 bool afPadding9[HC_ARCH_BITS == 32 ? 1 : 5];
360#ifndef VBOX_WITHOUT_TESTING_FEATURES
361 /** The high timestamp value. */
362 uint32_t u32TestingHighTimestamp;
363 /** The current testing command (VMMDEV_TESTING_CMD_XXX). */
364 uint32_t u32TestingCmd;
365 /** The testing data offset (command specific). */
366 uint32_t offTestingData;
367 /** For buffering the what comes in over the testing data port. */
368 union
369 {
370 char padding[1024];
371
372 /** VMMDEV_TESTING_CMD_INIT, VMMDEV_TESTING_CMD_SUB_NEW,
373 * VMMDEV_TESTING_CMD_FAILED. */
374 struct
375 {
376 char sz[1024];
377 } String, Init, SubNew, Failed;
378
379 /** VMMDEV_TESTING_CMD_TERM, VMMDEV_TESTING_CMD_SUB_DONE. */
380 struct
381 {
382 uint32_t c;
383 } Error, Term, SubDone;
384
385 /** VMMDEV_TESTING_CMD_VALUE. */
386 struct
387 {
388 RTUINT64U u64Value;
389 uint32_t u32Unit;
390 char szName[1024 - 8 - 4];
391 } Value;
392
393 /** The read back register (VMMDEV_TESTING_MMIO_OFF_READBACK,
394 * VMMDEV_TESTING_MMIO_OFF_READBACK_R3). */
395 uint8_t abReadBack[VMMDEV_TESTING_READBACK_SIZE];
396 } TestingData;
397 /** The XML output file name (can be a named pipe, doesn't matter to us). */
398 R3PTRTYPE(char *) pszTestingXmlOutput;
399 /** Testing instance for dealing with the output. */
400 RTTEST hTestingTest;
401#endif /* !VBOX_WITHOUT_TESTING_FEATURES */
402
403 /** @name Heartbeat
404 * @{ */
405 /** Timestamp of the last heartbeat from guest in nanosec. */
406 uint64_t volatile nsLastHeartbeatTS;
407 /** Indicates whether we missed HB from guest on last check. */
408 bool volatile fFlatlined;
409 /** Indicates whether heartbeat check is active. */
410 bool volatile fHeartbeatActive;
411 /** Alignment padding. */
412 bool afAlignment8[6];
413 /** Guest heartbeat interval in nanoseconds.
414 * This is the interval the guest is told to produce heartbeats at. */
415 uint64_t cNsHeartbeatInterval;
416 /** The amount of time without a heartbeat (nanoseconds) before we
417 * conclude the guest is doing a Dixie Flatline (Neuromancer) impression. */
418 uint64_t cNsHeartbeatTimeout;
419 /** Timer for signalling a flatlined guest. */
420 PTMTIMERR3 pFlatlinedTimer;
421 /** @} */
422} VMMDevState;
423typedef VMMDevState VMMDEV;
424/** Pointer to the VMM device state. */
425typedef VMMDEV *PVMMDEV;
426AssertCompileMemberAlignment(VMMDEV, CritSect, 8);
427AssertCompileMemberAlignment(VMMDEV, StatSlowIrqAck, 8);
428AssertCompileMemberAlignment(VMMDEV, cbGuestRAM, 8);
429AssertCompileMemberAlignment(VMMDEV, enmCpuHotPlugEvent, 4);
430AssertCompileMemberAlignment(VMMDEV, aFacilityStatuses, 8);
431#ifndef VBOX_WITHOUT_TESTING_FEATURES
432AssertCompileMemberAlignment(VMMDEV, TestingData.Value.u64Value, 8);
433#endif
434
435
436void VMMDevNotifyGuest(VMMDEV *pVMMDevState, uint32_t u32EventMask);
437void VMMDevCtlSetGuestFilterMask(VMMDEV *pVMMDevState, uint32_t u32OrMask, uint32_t u32NotMask);
438
439
440/** The saved state version. */
441#define VMMDEV_SAVED_STATE_VERSION VMMDEV_SAVED_STATE_VERSION_HGCM_PARAMS
442/** Updated HGCM commands. */
443#define VMMDEV_SAVED_STATE_VERSION_HGCM_PARAMS 17
444/** The saved state version with heartbeat state. */
445#define VMMDEV_SAVED_STATE_VERSION_HEARTBEAT 16
446/** The saved state version without heartbeat state. */
447#define VMMDEV_SAVED_STATE_VERSION_NO_HEARTBEAT 15
448/** The saved state version which is missing the guest facility statuses. */
449#define VMMDEV_SAVED_STATE_VERSION_MISSING_FACILITY_STATUSES 14
450/** The saved state version which is missing the guestInfo2 bits. */
451#define VMMDEV_SAVED_STATE_VERSION_MISSING_GUEST_INFO_2 13
452/** The saved state version used by VirtualBox 3.0.
453 * This doesn't have the config part. */
454#define VMMDEV_SAVED_STATE_VERSION_VBOX_30 11
455
456#endif /* !VBOX_INCLUDED_SRC_VMMDev_VMMDevState_h */
457
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette