VirtualBox

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

Last change on this file since 72054 was 71891, checked in by vboxsync, 7 years ago

VMMDev: VMMDevHGCM rewrite

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