VirtualBox

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

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

VMMDev/HGCM: Added PDM interface + HGCM server helper for finding out if a command/call is being resubmitted on restore or not. This is handy for returning returning an async wait call to the guest upon restore. bugref:3544 [build fix]

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