VirtualBox

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

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

VMMDev,Main,HostServices: More profiling of HGCM guest call processing.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 13.7 KB
Line 
1/* $Id: VMMDevState.h 75500 2018-11-16 01:24:39Z 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 STAMPROFILE StatHgcmCmdArrival;
281 STAMPROFILE StatHgcmCmdCompletion;
282 STAMPROFILE StatHgcmCmdTotal;
283#endif /* VBOX_WITH_HGCM */
284
285 /** Status LUN: Shared folders LED */
286 struct
287 {
288 /** The LED. */
289 PDMLED Led;
290 /** The LED ports. */
291 PDMILEDPORTS ILeds;
292 /** Partner of ILeds. */
293 R3PTRTYPE(PPDMILEDCONNECTORS) pLedsConnector;
294 } SharedFolders;
295
296 /** FLag whether CPU hotplug events are monitored */
297 bool fCpuHotPlugEventsEnabled;
298 /** Alignment padding. */
299 bool afPadding8[3];
300 /** CPU hotplug event */
301 VMMDevCpuEventType enmCpuHotPlugEvent;
302 /** Core id of the CPU to change */
303 uint32_t idCpuCore;
304 /** Package id of the CPU to change */
305 uint32_t idCpuPackage;
306
307 uint32_t StatMemBalloonChunks;
308
309 /** Set if RC/R0 is enabled. */
310 bool fRZEnabled;
311 /** Set if testing is enabled. */
312 bool fTestingEnabled;
313 /** Set if testing the MMIO testing range is enabled. */
314 bool fTestingMMIO;
315 /** Alignment padding. */
316 bool afPadding9[HC_ARCH_BITS == 32 ? 1 : 5];
317#ifndef VBOX_WITHOUT_TESTING_FEATURES
318 /** The high timestamp value. */
319 uint32_t u32TestingHighTimestamp;
320 /** The current testing command (VMMDEV_TESTING_CMD_XXX). */
321 uint32_t u32TestingCmd;
322 /** The testing data offset (command specific). */
323 uint32_t offTestingData;
324 /** For buffering the what comes in over the testing data port. */
325 union
326 {
327 char padding[1024];
328
329 /** VMMDEV_TESTING_CMD_INIT, VMMDEV_TESTING_CMD_SUB_NEW,
330 * VMMDEV_TESTING_CMD_FAILED. */
331 struct
332 {
333 char sz[1024];
334 } String, Init, SubNew, Failed;
335
336 /** VMMDEV_TESTING_CMD_TERM, VMMDEV_TESTING_CMD_SUB_DONE. */
337 struct
338 {
339 uint32_t c;
340 } Error, Term, SubDone;
341
342 /** VMMDEV_TESTING_CMD_VALUE. */
343 struct
344 {
345 RTUINT64U u64Value;
346 uint32_t u32Unit;
347 char szName[1024 - 8 - 4];
348 } Value;
349
350 /** The read back register (VMMDEV_TESTING_MMIO_OFF_READBACK,
351 * VMMDEV_TESTING_MMIO_OFF_READBACK_R3). */
352 uint8_t abReadBack[VMMDEV_TESTING_READBACK_SIZE];
353 } TestingData;
354 /** The XML output file name (can be a named pipe, doesn't matter to us). */
355 R3PTRTYPE(char *) pszTestingXmlOutput;
356 /** Testing instance for dealing with the output. */
357 RTTEST hTestingTest;
358#endif /* !VBOX_WITHOUT_TESTING_FEATURES */
359
360 /** @name Heartbeat
361 * @{ */
362 /** Timestamp of the last heartbeat from guest in nanosec. */
363 uint64_t volatile nsLastHeartbeatTS;
364 /** Indicates whether we missed HB from guest on last check. */
365 bool volatile fFlatlined;
366 /** Indicates whether heartbeat check is active. */
367 bool volatile fHeartbeatActive;
368 /** Alignment padding. */
369 bool afAlignment8[6];
370 /** Guest heartbeat interval in nanoseconds.
371 * This is the interval the guest is told to produce heartbeats at. */
372 uint64_t cNsHeartbeatInterval;
373 /** The amount of time without a heartbeat (nanoseconds) before we
374 * conclude the guest is doing a Dixie Flatline (Neuromancer) impression. */
375 uint64_t cNsHeartbeatTimeout;
376 /** Timer for signalling a flatlined guest. */
377 PTMTIMERR3 pFlatlinedTimer;
378 /** @} */
379} VMMDevState;
380typedef VMMDevState VMMDEV;
381/** Pointer to the VMM device state. */
382typedef VMMDEV *PVMMDEV;
383AssertCompileMemberAlignment(VMMDEV, CritSect, 8);
384AssertCompileMemberAlignment(VMMDEV, cbGuestRAM, 8);
385AssertCompileMemberAlignment(VMMDEV, enmCpuHotPlugEvent, 4);
386AssertCompileMemberAlignment(VMMDEV, aFacilityStatuses, 8);
387#ifndef VBOX_WITHOUT_TESTING_FEATURES
388AssertCompileMemberAlignment(VMMDEV, TestingData.Value.u64Value, 8);
389#endif
390
391
392void VMMDevNotifyGuest(VMMDEV *pVMMDevState, uint32_t u32EventMask);
393void VMMDevCtlSetGuestFilterMask(VMMDEV *pVMMDevState, uint32_t u32OrMask, uint32_t u32NotMask);
394
395/** The saved state version. */
396#define VMMDEV_SAVED_STATE_VERSION VMMDEV_SAVED_STATE_VERSION_HGCM_PARAMS
397/** Updated HGCM commands. */
398#define VMMDEV_SAVED_STATE_VERSION_HGCM_PARAMS 17
399/** The saved state version with heartbeat state. */
400#define VMMDEV_SAVED_STATE_VERSION_HEARTBEAT 16
401/** The saved state version without heartbeat state. */
402#define VMMDEV_SAVED_STATE_VERSION_NO_HEARTBEAT 15
403/** The saved state version which is missing the guest facility statuses. */
404#define VMMDEV_SAVED_STATE_VERSION_MISSING_FACILITY_STATUSES 14
405/** The saved state version which is missing the guestInfo2 bits. */
406#define VMMDEV_SAVED_STATE_VERSION_MISSING_GUEST_INFO_2 13
407/** The saved state version used by VirtualBox 3.0.
408 * This doesn't have the config part. */
409#define VMMDEV_SAVED_STATE_VERSION_VBOX_30 11
410
411#endif /* !___VMMDev_VMMDevState_h */
412
Note: See TracBrowser for help on using the repository browser.

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