1 | /* $Id: VMMDevState.h 44777 2013-02-21 13:18:01Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VMMDev - Guest <-> VMM/Host communication device, internal header.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2012 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 |
|
---|
25 | #define VMMDEV_WITH_ALT_TIMESYNC
|
---|
26 |
|
---|
27 | typedef struct DISPLAYCHANGEINFO
|
---|
28 | {
|
---|
29 | uint32_t xres;
|
---|
30 | uint32_t yres;
|
---|
31 | uint32_t bpp;
|
---|
32 | uint32_t display;
|
---|
33 | int32_t xOrigin;
|
---|
34 | int32_t yOrigin;
|
---|
35 | bool fEnabled;
|
---|
36 | bool fChangeOrigin;
|
---|
37 | } DISPLAYCHANGEINFO;
|
---|
38 |
|
---|
39 | typedef struct DISPLAYCHANGEREQUEST
|
---|
40 | {
|
---|
41 | bool fPending;
|
---|
42 | bool afAlignment[3];
|
---|
43 | DISPLAYCHANGEINFO displayChangeRequest;
|
---|
44 | DISPLAYCHANGEINFO lastReadDisplayChangeRequest;
|
---|
45 | } DISPLAYCHANGEREQUEST;
|
---|
46 |
|
---|
47 | typedef struct DISPLAYCHANGEDATA
|
---|
48 | {
|
---|
49 | /* Which monitor is being reported to the guest. */
|
---|
50 | int iCurrentMonitor;
|
---|
51 |
|
---|
52 | /** true if the guest responded to VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST at least once */
|
---|
53 | bool fGuestSentChangeEventAck;
|
---|
54 | bool afAlignment[3];
|
---|
55 |
|
---|
56 | DISPLAYCHANGEREQUEST aRequests[64]; /// @todo maxMonitors
|
---|
57 | } DISPLAYCHANGEDATA;
|
---|
58 |
|
---|
59 |
|
---|
60 | /**
|
---|
61 | * Credentials for automatic guest logon and host configured logon (?).
|
---|
62 | *
|
---|
63 | * This is not stored in the same block as the instance data in order to make it
|
---|
64 | * harder to access.
|
---|
65 | */
|
---|
66 | typedef struct VMMDEVCREDS
|
---|
67 | {
|
---|
68 | /** credentials for guest logon purposes */
|
---|
69 | struct
|
---|
70 | {
|
---|
71 | char szUserName[VMMDEV_CREDENTIALS_SZ_SIZE];
|
---|
72 | char szPassword[VMMDEV_CREDENTIALS_SZ_SIZE];
|
---|
73 | char szDomain[VMMDEV_CREDENTIALS_SZ_SIZE];
|
---|
74 | bool fAllowInteractiveLogon;
|
---|
75 | } Logon;
|
---|
76 |
|
---|
77 | /** credentials for verification by guest */
|
---|
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 | } Judge;
|
---|
84 | } VMMDEVCREDS;
|
---|
85 |
|
---|
86 |
|
---|
87 | /**
|
---|
88 | * Facility status entry.
|
---|
89 | */
|
---|
90 | typedef struct VMMDEVFACILITYSTATUSENTRY
|
---|
91 | {
|
---|
92 | /** The facility, see VBoxGuestFacilityType. */
|
---|
93 | uint32_t uFacility;
|
---|
94 | /** The status, see VBoxGuestFacilityStatus. */
|
---|
95 | uint16_t uStatus;
|
---|
96 | /** Whether this entry is fixed and cannot be reused when inactive. */
|
---|
97 | bool fFixed;
|
---|
98 | /** Explicit alignment padding / reserved for future use. MBZ. */
|
---|
99 | bool fPadding;
|
---|
100 | /** The facility flags (yet to be defined). */
|
---|
101 | uint32_t fFlags;
|
---|
102 | /** Explicit alignment padding / reserved for future use. MBZ. */
|
---|
103 | uint32_t uPadding;
|
---|
104 | /** Last update timestamp. */
|
---|
105 | RTTIMESPEC TimeSpecTS;
|
---|
106 | } VMMDEVFACILITYSTATUSENTRY;
|
---|
107 | /** Pointer to a facility status entry. */
|
---|
108 | typedef VMMDEVFACILITYSTATUSENTRY *PVMMDEVFACILITYSTATUSENTRY;
|
---|
109 |
|
---|
110 |
|
---|
111 | /** device structure containing all state information */
|
---|
112 | typedef struct VMMDevState
|
---|
113 | {
|
---|
114 | /** The PCI device structure. */
|
---|
115 | PCIDevice PciDev;
|
---|
116 | /** The critical section for this device.
|
---|
117 | * @remarks We use this rather than the default one, it's simpler with all
|
---|
118 | * the driver interfaces where we have to waste time digging out the
|
---|
119 | * PDMDEVINS structure. */
|
---|
120 | PDMCRITSECT CritSect;
|
---|
121 |
|
---|
122 | /** hypervisor address space size */
|
---|
123 | uint32_t hypervisorSize;
|
---|
124 |
|
---|
125 | /** mouse capabilities of host and guest */
|
---|
126 | uint32_t mouseCapabilities;
|
---|
127 | /** absolute mouse position in pixels */
|
---|
128 | int32_t mouseXAbs;
|
---|
129 | int32_t mouseYAbs;
|
---|
130 | /** Does the guest currently want the host pointer to be shown? */
|
---|
131 | uint32_t fHostCursorRequested;
|
---|
132 |
|
---|
133 | /** Alignment padding. */
|
---|
134 | uint32_t u32Alignment0;
|
---|
135 |
|
---|
136 | /** Pointer to device instance. */
|
---|
137 | PPDMDEVINSR3 pDevIns;
|
---|
138 | /** LUN\#0 + Status: VMMDev port base interface. */
|
---|
139 | PDMIBASE IBase;
|
---|
140 | /** LUN\#0: VMMDev port interface. */
|
---|
141 | PDMIVMMDEVPORT IPort;
|
---|
142 | #ifdef VBOX_WITH_HGCM
|
---|
143 | /** LUN\#0: HGCM port interface. */
|
---|
144 | PDMIHGCMPORT IHGCMPort;
|
---|
145 | #endif
|
---|
146 | /** Pointer to base interface of the driver. */
|
---|
147 | R3PTRTYPE(PPDMIBASE) pDrvBase;
|
---|
148 | /** VMMDev connector interface */
|
---|
149 | R3PTRTYPE(PPDMIVMMDEVCONNECTOR) pDrv;
|
---|
150 | #ifdef VBOX_WITH_HGCM
|
---|
151 | /** HGCM connector interface */
|
---|
152 | R3PTRTYPE(PPDMIHGCMCONNECTOR) pHGCMDrv;
|
---|
153 | #endif
|
---|
154 | /** Alignment padding. */
|
---|
155 | RTR3PTR PtrR3Alignment1;
|
---|
156 | /** message buffer for backdoor logging. */
|
---|
157 | char szMsg[512];
|
---|
158 | /** message buffer index. */
|
---|
159 | uint32_t iMsg;
|
---|
160 | /** Alignment padding. */
|
---|
161 | uint32_t u32Alignment2;
|
---|
162 |
|
---|
163 | /** IRQ number assigned to the device */
|
---|
164 | uint32_t irq;
|
---|
165 | /** Current host side event flags */
|
---|
166 | uint32_t u32HostEventFlags;
|
---|
167 | /** Mask of events guest is interested in.
|
---|
168 | * @note The HGCM events are enabled automatically by the VMMDev device when
|
---|
169 | * guest issues HGCM commands. */
|
---|
170 | uint32_t u32GuestFilterMask;
|
---|
171 | /** Delayed mask of guest events */
|
---|
172 | uint32_t u32NewGuestFilterMask;
|
---|
173 | /** Flag whether u32NewGuestFilterMask is valid */
|
---|
174 | bool fNewGuestFilterMask;
|
---|
175 | /** Alignment padding. */
|
---|
176 | bool afAlignment3[3];
|
---|
177 |
|
---|
178 | /** GC physical address of VMMDev RAM area */
|
---|
179 | RTGCPHYS32 GCPhysVMMDevRAM;
|
---|
180 | /** R3 pointer to VMMDev RAM area */
|
---|
181 | R3PTRTYPE(VMMDevMemory *) pVMMDevRAMR3;
|
---|
182 |
|
---|
183 | /** R3 pointer to VMMDev Heap RAM area
|
---|
184 | */
|
---|
185 | R3PTRTYPE(VMMDevMemory *) pVMMDevHeapR3;
|
---|
186 | /** GC physical address of VMMDev Heap RAM area */
|
---|
187 | RTGCPHYS32 GCPhysVMMDevHeap;
|
---|
188 |
|
---|
189 | /** Information reported by guest via VMMDevReportGuestInfo generic request.
|
---|
190 | * Until this information is reported the VMMDev refuses any other requests.
|
---|
191 | */
|
---|
192 | VBoxGuestInfo guestInfo;
|
---|
193 | /** Information report \#2, chewed a litte. */
|
---|
194 | struct
|
---|
195 | {
|
---|
196 | uint32_t uFullVersion; /**< non-zero if info is present. */
|
---|
197 | uint32_t uRevision;
|
---|
198 | uint32_t fFeatures;
|
---|
199 | char szName[128];
|
---|
200 | } guestInfo2;
|
---|
201 |
|
---|
202 | /** Array of guest facility statuses. */
|
---|
203 | VMMDEVFACILITYSTATUSENTRY aFacilityStatuses[32];
|
---|
204 | /** The number of valid entries in the facility status array. */
|
---|
205 | uint32_t cFacilityStatuses;
|
---|
206 |
|
---|
207 | /** Information reported by guest via VMMDevReportGuestCapabilities. */
|
---|
208 | uint32_t guestCaps;
|
---|
209 |
|
---|
210 | /** "Additions are Ok" indicator, set to true after processing VMMDevReportGuestInfo,
|
---|
211 | * if additions version is compatible. This flag is here to avoid repeated comparing
|
---|
212 | * of the version in guestInfo.
|
---|
213 | */
|
---|
214 | uint32_t fu32AdditionsOk;
|
---|
215 |
|
---|
216 | /** Video acceleration status set by guest. */
|
---|
217 | uint32_t u32VideoAccelEnabled;
|
---|
218 |
|
---|
219 | DISPLAYCHANGEDATA displayChangeData;
|
---|
220 |
|
---|
221 | /** Pointer to the credentials. */
|
---|
222 | R3PTRTYPE(VMMDEVCREDS *) pCredentials;
|
---|
223 |
|
---|
224 | bool afAlignment4[HC_ARCH_BITS == 32 ? 3 : 7];
|
---|
225 |
|
---|
226 | /* memory balloon change request */
|
---|
227 | uint32_t cMbMemoryBalloon;
|
---|
228 | /** The last balloon size queried by the guest additions. */
|
---|
229 | uint32_t cMbMemoryBalloonLast;
|
---|
230 |
|
---|
231 | /* guest ram size */
|
---|
232 | uint64_t cbGuestRAM;
|
---|
233 |
|
---|
234 | /* unique session id; the id will be different after each start, reset or restore of the VM. */
|
---|
235 | uint64_t idSession;
|
---|
236 |
|
---|
237 | /* statistics interval change request */
|
---|
238 | uint32_t u32StatIntervalSize, u32LastStatIntervalSize;
|
---|
239 |
|
---|
240 | /* seamless mode change request */
|
---|
241 | bool fLastSeamlessEnabled, fSeamlessEnabled;
|
---|
242 | bool afAlignment5[1];
|
---|
243 |
|
---|
244 | bool fVRDPEnabled;
|
---|
245 | uint32_t uVRDPExperienceLevel;
|
---|
246 |
|
---|
247 | #ifdef VMMDEV_WITH_ALT_TIMESYNC
|
---|
248 | uint64_t hostTime;
|
---|
249 | bool fTimesyncBackdoorLo;
|
---|
250 | bool afAlignment6[3];
|
---|
251 | #endif
|
---|
252 | /** Set if GetHostTime should fail.
|
---|
253 | * Loaded from the GetHostTimeDisabled configuration value. */
|
---|
254 | bool fGetHostTimeDisabled;
|
---|
255 |
|
---|
256 | /** Set if backdoor logging should be disabled (output will be ignored then) */
|
---|
257 | bool fBackdoorLogDisabled;
|
---|
258 |
|
---|
259 | /** Don't clear credentials */
|
---|
260 | bool fKeepCredentials;
|
---|
261 |
|
---|
262 | /** Heap enabled. */
|
---|
263 | bool fHeapEnabled;
|
---|
264 |
|
---|
265 | /** Guest Core Dumping enabled. */
|
---|
266 | bool fGuestCoreDumpEnabled;
|
---|
267 |
|
---|
268 | /** Guest Core Dump location. */
|
---|
269 | char szGuestCoreDumpDir[RTPATH_MAX];
|
---|
270 |
|
---|
271 | /** Number of additional cores to keep around. */
|
---|
272 | uint32_t cGuestCoreDumps;
|
---|
273 |
|
---|
274 | bool afAlignment7[1];
|
---|
275 |
|
---|
276 | #ifdef VBOX_WITH_HGCM
|
---|
277 | /** List of pending HGCM requests, used for saving the HGCM state. */
|
---|
278 | R3PTRTYPE(PVBOXHGCMCMD) pHGCMCmdList;
|
---|
279 | /** Critical section to protect the list. */
|
---|
280 | RTCRITSECT critsectHGCMCmdList;
|
---|
281 | /** Whether the HGCM events are already automatically enabled. */
|
---|
282 | uint32_t u32HGCMEnabled;
|
---|
283 | /** Alignment padding. */
|
---|
284 | uint32_t u32Alignment7;
|
---|
285 | #endif /* VBOX_WITH_HGCM */
|
---|
286 |
|
---|
287 | /** Status LUN: Shared folders LED */
|
---|
288 | struct
|
---|
289 | {
|
---|
290 | /** The LED. */
|
---|
291 | PDMLED Led;
|
---|
292 | /** The LED ports. */
|
---|
293 | PDMILEDPORTS ILeds;
|
---|
294 | /** Partner of ILeds. */
|
---|
295 | R3PTRTYPE(PPDMILEDCONNECTORS) pLedsConnector;
|
---|
296 | } SharedFolders;
|
---|
297 |
|
---|
298 | /** FLag whether CPU hotplug events are monitored */
|
---|
299 | bool fCpuHotPlugEventsEnabled;
|
---|
300 | /** Alignment padding. */
|
---|
301 | bool afPadding8[3];
|
---|
302 | /** CPU hotplug event */
|
---|
303 | VMMDevCpuEventType enmCpuHotPlugEvent;
|
---|
304 | /** Core id of the CPU to change */
|
---|
305 | uint32_t idCpuCore;
|
---|
306 | /** Package id of the CPU to change */
|
---|
307 | uint32_t idCpuPackage;
|
---|
308 |
|
---|
309 | uint32_t StatMemBalloonChunks;
|
---|
310 |
|
---|
311 | /** Set if RC/R0 is enabled. */
|
---|
312 | bool fRZEnabled;
|
---|
313 | /** Set if testing is enabled. */
|
---|
314 | bool fTestingEnabled;
|
---|
315 | /** Alignment padding. */
|
---|
316 | bool afPadding9[HC_ARCH_BITS == 32 ? 2 : 6];
|
---|
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 | } TestingData;
|
---|
350 | #endif /* !VBOX_WITHOUT_TESTING_FEATURES */
|
---|
351 | } VMMDevState;
|
---|
352 | typedef VMMDevState VMMDEV;
|
---|
353 | /** Pointer to the VMM device state. */
|
---|
354 | typedef VMMDEV *PVMMDEV;
|
---|
355 | AssertCompileMemberAlignment(VMMDEV, CritSect, 8);
|
---|
356 | AssertCompileMemberAlignment(VMMDEV, cbGuestRAM, 8);
|
---|
357 | AssertCompileMemberAlignment(VMMDEV, enmCpuHotPlugEvent, 4);
|
---|
358 | AssertCompileMemberAlignment(VMMDEV, aFacilityStatuses, 8);
|
---|
359 | #ifndef VBOX_WITHOUT_TESTING_FEATURES
|
---|
360 | AssertCompileMemberAlignment(VMMDEV, TestingData.Value.u64Value, 8);
|
---|
361 | #endif
|
---|
362 |
|
---|
363 |
|
---|
364 | void VMMDevNotifyGuest(VMMDEV *pVMMDevState, uint32_t u32EventMask);
|
---|
365 | void VMMDevCtlSetGuestFilterMask(VMMDEV *pVMMDevState, uint32_t u32OrMask, uint32_t u32NotMask);
|
---|
366 |
|
---|
367 | #endif /* !___VMMDev_VMMDevState_h */
|
---|
368 |
|
---|