VirtualBox

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

Last change on this file since 72816 was 72352, checked in by vboxsync, 7 years ago

Main, VMMDev: implemented IDisplay::SetScreenLayout, VMMDev multimonitor resize request and VBoxManage controlvm setscreenlayout. bugref:8393

  • 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 72352 2018-05-26 12:37:50Z 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 /** Alignment padding. */
148 RTR3PTR PtrR3Alignment1;
149 /** message buffer for backdoor logging. */
150 char szMsg[512];
151 /** message buffer index. */
152 uint32_t iMsg;
153 /** Alignment padding. */
154 uint32_t u32Alignment2;
155
156 /** IRQ number assigned to the device */
157 uint32_t irq;
158 /** Current host side event flags */
159 uint32_t u32HostEventFlags;
160 /** Mask of events guest is interested in.
161 * @note The HGCM events are enabled automatically by the VMMDev device when
162 * guest issues HGCM commands. */
163 uint32_t u32GuestFilterMask;
164 /** Delayed mask of guest events */
165 uint32_t u32NewGuestFilterMask;
166 /** Flag whether u32NewGuestFilterMask is valid */
167 bool fNewGuestFilterMask;
168 /** Alignment padding. */
169 bool afAlignment3[3];
170
171 /** GC physical address of VMMDev RAM area */
172 RTGCPHYS32 GCPhysVMMDevRAM;
173 /** R3 pointer to VMMDev RAM area */
174 R3PTRTYPE(VMMDevMemory *) pVMMDevRAMR3;
175
176 /** R3 pointer to VMMDev Heap RAM area
177 */
178 R3PTRTYPE(VMMDevMemory *) pVMMDevHeapR3;
179 /** GC physical address of VMMDev Heap RAM area */
180 RTGCPHYS32 GCPhysVMMDevHeap;
181
182 /** Information reported by guest via VMMDevReportGuestInfo generic request.
183 * Until this information is reported the VMMDev refuses any other requests.
184 */
185 VBoxGuestInfo guestInfo;
186 /** Information report \#2, chewed a little. */
187 struct
188 {
189 uint32_t uFullVersion; /**< non-zero if info is present. */
190 uint32_t uRevision;
191 uint32_t fFeatures;
192 char szName[128];
193 } guestInfo2;
194
195 /** Array of guest facility statuses. */
196 VMMDEVFACILITYSTATUSENTRY aFacilityStatuses[32];
197 /** The number of valid entries in the facility status array. */
198 uint32_t cFacilityStatuses;
199
200 /** Information reported by guest via VMMDevReportGuestCapabilities. */
201 uint32_t guestCaps;
202
203 /** "Additions are Ok" indicator, set to true after processing VMMDevReportGuestInfo,
204 * if additions version is compatible. This flag is here to avoid repeated comparing
205 * of the version in guestInfo.
206 */
207 uint32_t fu32AdditionsOk;
208
209 /** Video acceleration status set by guest. */
210 uint32_t u32VideoAccelEnabled;
211
212 DISPLAYCHANGEDATA displayChangeData;
213
214 /** Pointer to the credentials. */
215 R3PTRTYPE(VMMDEVCREDS *) pCredentials;
216
217 bool afAlignment4[HC_ARCH_BITS == 32 ? 3 : 7];
218
219 /* memory balloon change request */
220 uint32_t cMbMemoryBalloon;
221 /** The last balloon size queried by the guest additions. */
222 uint32_t cMbMemoryBalloonLast;
223
224 /* guest ram size */
225 uint64_t cbGuestRAM;
226
227 /* unique session id; the id will be different after each start, reset or restore of the VM. */
228 uint64_t idSession;
229
230 /* statistics interval change request */
231 uint32_t u32StatIntervalSize, u32LastStatIntervalSize;
232
233 /* seamless mode change request */
234 bool fLastSeamlessEnabled, fSeamlessEnabled;
235 bool afAlignment5[1];
236
237 bool fVRDPEnabled;
238 uint32_t uVRDPExperienceLevel;
239
240#ifdef VMMDEV_WITH_ALT_TIMESYNC
241 uint64_t hostTime;
242 bool fTimesyncBackdoorLo;
243 bool afAlignment6[3];
244#endif
245 /** Set if GetHostTime should fail.
246 * Loaded from the GetHostTimeDisabled configuration value. */
247 bool fGetHostTimeDisabled;
248
249 /** Set if backdoor logging should be disabled (output will be ignored then) */
250 bool fBackdoorLogDisabled;
251
252 /** Don't clear credentials */
253 bool fKeepCredentials;
254
255 /** Heap enabled. */
256 bool fHeapEnabled;
257
258 /** Guest Core Dumping enabled. */
259 bool fGuestCoreDumpEnabled;
260
261 /** Guest Core Dump location. */
262 char szGuestCoreDumpDir[RTPATH_MAX];
263
264 /** Number of additional cores to keep around. */
265 uint32_t cGuestCoreDumps;
266
267 bool afAlignment7[1];
268
269#ifdef VBOX_WITH_HGCM
270 /** List of pending HGCM requests (VBOXHGCMCMD). */
271 RTLISTANCHORR3 listHGCMCmd;
272 /** Critical section to protect the list. */
273 RTCRITSECT critsectHGCMCmdList;
274 /** Whether the HGCM events are already automatically enabled. */
275 uint32_t u32HGCMEnabled;
276 /** Saved state version of restored commands. */
277 uint32_t u32SSMVersion;
278#if HC_ARCH_BITS == 32
279 /** Alignment padding. */
280 uint32_t u32Alignment7;
281#endif
282#endif /* VBOX_WITH_HGCM */
283
284 /** Status LUN: Shared folders LED */
285 struct
286 {
287 /** The LED. */
288 PDMLED Led;
289 /** The LED ports. */
290 PDMILEDPORTS ILeds;
291 /** Partner of ILeds. */
292 R3PTRTYPE(PPDMILEDCONNECTORS) pLedsConnector;
293 } SharedFolders;
294
295 /** FLag whether CPU hotplug events are monitored */
296 bool fCpuHotPlugEventsEnabled;
297 /** Alignment padding. */
298 bool afPadding8[3];
299 /** CPU hotplug event */
300 VMMDevCpuEventType enmCpuHotPlugEvent;
301 /** Core id of the CPU to change */
302 uint32_t idCpuCore;
303 /** Package id of the CPU to change */
304 uint32_t idCpuPackage;
305
306 uint32_t StatMemBalloonChunks;
307
308 /** Set if RC/R0 is enabled. */
309 bool fRZEnabled;
310 /** Set if testing is enabled. */
311 bool fTestingEnabled;
312 /** Set if testing the MMIO testing range is enabled. */
313 bool fTestingMMIO;
314 /** Alignment padding. */
315 bool afPadding9[HC_ARCH_BITS == 32 ? 1 : 5];
316#ifndef VBOX_WITHOUT_TESTING_FEATURES
317 /** The high timestamp value. */
318 uint32_t u32TestingHighTimestamp;
319 /** The current testing command (VMMDEV_TESTING_CMD_XXX). */
320 uint32_t u32TestingCmd;
321 /** The testing data offset (command specific). */
322 uint32_t offTestingData;
323 /** For buffering the what comes in over the testing data port. */
324 union
325 {
326 char padding[1024];
327
328 /** VMMDEV_TESTING_CMD_INIT, VMMDEV_TESTING_CMD_SUB_NEW,
329 * VMMDEV_TESTING_CMD_FAILED. */
330 struct
331 {
332 char sz[1024];
333 } String, Init, SubNew, Failed;
334
335 /** VMMDEV_TESTING_CMD_TERM, VMMDEV_TESTING_CMD_SUB_DONE. */
336 struct
337 {
338 uint32_t c;
339 } Error, Term, SubDone;
340
341 /** VMMDEV_TESTING_CMD_VALUE. */
342 struct
343 {
344 RTUINT64U u64Value;
345 uint32_t u32Unit;
346 char szName[1024 - 8 - 4];
347 } Value;
348
349 /** The read back register (VMMDEV_TESTING_MMIO_OFF_READBACK,
350 * VMMDEV_TESTING_MMIO_OFF_READBACK_R3). */
351 uint8_t abReadBack[VMMDEV_TESTING_READBACK_SIZE];
352 } TestingData;
353 /** The XML output file name (can be a named pipe, doesn't matter to us). */
354 R3PTRTYPE(char *) pszTestingXmlOutput;
355 /** Testing instance for dealing with the output. */
356 RTTEST hTestingTest;
357#endif /* !VBOX_WITHOUT_TESTING_FEATURES */
358
359 /** @name Heartbeat
360 * @{ */
361 /** Timestamp of the last heartbeat from guest in nanosec. */
362 uint64_t volatile nsLastHeartbeatTS;
363 /** Indicates whether we missed HB from guest on last check. */
364 bool volatile fFlatlined;
365 /** Indicates whether heartbeat check is active. */
366 bool volatile fHeartbeatActive;
367 /** Alignment padding. */
368 bool afAlignment8[6];
369 /** Guest heartbeat interval in nanoseconds.
370 * This is the interval the guest is told to produce heartbeats at. */
371 uint64_t cNsHeartbeatInterval;
372 /** The amount of time without a heartbeat (nanoseconds) before we
373 * conclude the guest is doing a Dixie Flatline (Neuromancer) impression. */
374 uint64_t cNsHeartbeatTimeout;
375 /** Timer for signalling a flatlined guest. */
376 PTMTIMERR3 pFlatlinedTimer;
377 /** @} */
378} VMMDevState;
379typedef VMMDevState VMMDEV;
380/** Pointer to the VMM device state. */
381typedef VMMDEV *PVMMDEV;
382AssertCompileMemberAlignment(VMMDEV, CritSect, 8);
383AssertCompileMemberAlignment(VMMDEV, cbGuestRAM, 8);
384AssertCompileMemberAlignment(VMMDEV, enmCpuHotPlugEvent, 4);
385AssertCompileMemberAlignment(VMMDEV, aFacilityStatuses, 8);
386#ifndef VBOX_WITHOUT_TESTING_FEATURES
387AssertCompileMemberAlignment(VMMDEV, TestingData.Value.u64Value, 8);
388#endif
389
390
391void VMMDevNotifyGuest(VMMDEV *pVMMDevState, uint32_t u32EventMask);
392void VMMDevCtlSetGuestFilterMask(VMMDEV *pVMMDevState, uint32_t u32OrMask, uint32_t u32NotMask);
393
394/** The saved state version. */
395#define VMMDEV_SAVED_STATE_VERSION VMMDEV_SAVED_STATE_VERSION_HGCM_PARAMS
396/** Updated HGCM commands. */
397#define VMMDEV_SAVED_STATE_VERSION_HGCM_PARAMS 17
398/** The saved state version with heartbeat state. */
399#define VMMDEV_SAVED_STATE_VERSION_HEARTBEAT 16
400/** The saved state version without heartbeat state. */
401#define VMMDEV_SAVED_STATE_VERSION_NO_HEARTBEAT 15
402/** The saved state version which is missing the guest facility statuses. */
403#define VMMDEV_SAVED_STATE_VERSION_MISSING_FACILITY_STATUSES 14
404/** The saved state version which is missing the guestInfo2 bits. */
405#define VMMDEV_SAVED_STATE_VERSION_MISSING_GUEST_INFO_2 13
406/** The saved state version used by VirtualBox 3.0.
407 * This doesn't have the config part. */
408#define VMMDEV_SAVED_STATE_VERSION_VBOX_30 11
409
410#endif /* !___VMMDev_VMMDevState_h */
411
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