| 1 |
|
| 2 | |
| 3 | * Virtual Device for Guest <-> VMM/Host communication interface
|
| 4 | *
|
| 5 | * Copyright (C) 2006-2016 Oracle Corporation
|
| 6 |
|
| 7 |
|
| 8 | #ifndef __VBOX_VMMDEV_H__
|
| 9 | #define __VBOX_VMMDEV_H__
|
| 10 |
|
| 11 | #include <asm/bitsperlong.h>
|
| 12 | #include <linux/sizes.h>
|
| 13 | #include <linux/types.h>
|
| 14 | #include <linux/vbox_vmmdev_types.h>
|
| 15 |
|
| 16 |
|
| 17 | #define VMMDEV_PORT_OFF_REQUEST 0
|
| 18 |
|
| 19 |
|
| 20 | struct vmmdev_memory {
|
| 21 |
|
| 22 | u32 size;
|
| 23 |
|
| 24 | u32 version;
|
| 25 |
|
| 26 | union {
|
| 27 | struct {
|
| 28 |
|
| 29 | u8 have_events;
|
| 30 |
|
| 31 | u8 padding[3];
|
| 32 | } V1_04;
|
| 33 |
|
| 34 | struct {
|
| 35 |
|
| 36 | u32 host_events;
|
| 37 |
|
| 38 | u32 guest_event_mask;
|
| 39 | } V1_03;
|
| 40 | } V;
|
| 41 |
|
| 42 |
|
| 43 | };
|
| 44 | VMMDEV_ASSERT_SIZE(vmmdev_memory, 8 + 8);
|
| 45 |
|
| 46 |
|
| 47 | #define VMMDEV_MEMORY_VERSION (1)
|
| 48 |
|
| 49 |
|
| 50 | #define VMMDEV_EVENT_MOUSE_CAPABILITIES_CHANGED BIT(0)
|
| 51 |
|
| 52 | #define VMMDEV_EVENT_HGCM BIT(1)
|
| 53 |
|
| 54 | #define VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST BIT(2)
|
| 55 |
|
| 56 | #define VMMDEV_EVENT_JUDGE_CREDENTIALS BIT(3)
|
| 57 |
|
| 58 | #define VMMDEV_EVENT_RESTORED BIT(4)
|
| 59 |
|
| 60 | #define VMMDEV_EVENT_SEAMLESS_MODE_CHANGE_REQUEST BIT(5)
|
| 61 |
|
| 62 | #define VMMDEV_EVENT_BALLOON_CHANGE_REQUEST BIT(6)
|
| 63 |
|
| 64 | #define VMMDEV_EVENT_STATISTICS_INTERVAL_CHANGE_REQUEST BIT(7)
|
| 65 |
|
| 66 | #define VMMDEV_EVENT_VRDP BIT(8)
|
| 67 |
|
| 68 | #define VMMDEV_EVENT_MOUSE_POSITION_CHANGED BIT(9)
|
| 69 |
|
| 70 | #define VMMDEV_EVENT_CPU_HOTPLUG BIT(10)
|
| 71 |
|
| 72 | #define VMMDEV_EVENT_VALID_EVENT_MASK 0x000007ffU
|
| 73 |
|
| 74 | |
| 75 | * Additions are allowed to work only if additions_major == vmmdev_current &&
|
| 76 | * additions_minor <= vmmdev_current. Additions version is reported to host
|
| 77 | * (VMMDev) by VMMDEVREQ_REPORT_GUEST_INFO.
|
| 78 |
|
| 79 | #define VMMDEV_VERSION 0x00010004
|
| 80 | #define VMMDEV_VERSION_MAJOR (VMMDEV_VERSION >> 16)
|
| 81 | #define VMMDEV_VERSION_MINOR (VMMDEV_VERSION & 0xffff)
|
| 82 |
|
| 83 |
|
| 84 | #define VMMDEV_MAX_VMMDEVREQ_SIZE 1048576
|
| 85 |
|
| 86 |
|
| 87 | #define VMMDEV_REQUEST_HEADER_VERSION 0x10001
|
| 88 |
|
| 89 |
|
| 90 | struct vmmdev_request_header {
|
| 91 |
|
| 92 | u32 size;
|
| 93 |
|
| 94 | u32 version;
|
| 95 |
|
| 96 | enum vmmdev_request_type request_type;
|
| 97 |
|
| 98 | s32 rc;
|
| 99 |
|
| 100 | u32 reserved1;
|
| 101 |
|
| 102 | u32 requestor;
|
| 103 | };
|
| 104 | VMMDEV_ASSERT_SIZE(vmmdev_request_header, 24);
|
| 105 |
|
| 106 | |
| 107 | * struct vmmdev_mouse_status - Mouse status request structure.
|
| 108 | *
|
| 109 | * Used by VMMDEVREQ_GET_MOUSE_STATUS and VMMDEVREQ_SET_MOUSE_STATUS.
|
| 110 |
|
| 111 | struct vmmdev_mouse_status {
|
| 112 |
|
| 113 | struct vmmdev_request_header header;
|
| 114 |
|
| 115 | u32 mouse_features;
|
| 116 |
|
| 117 | s32 pointer_pos_x;
|
| 118 |
|
| 119 | s32 pointer_pos_y;
|
| 120 | };
|
| 121 | VMMDEV_ASSERT_SIZE(vmmdev_mouse_status, 24 + 12);
|
| 122 |
|
| 123 |
|
| 124 | #define VMMDEV_MOUSE_GUEST_CAN_ABSOLUTE BIT(0)
|
| 125 | |
| 126 | * The host can (== wants to) send absolute coordinates.
|
| 127 | * (Input not captured.)
|
| 128 |
|
| 129 | #define VMMDEV_MOUSE_HOST_WANTS_ABSOLUTE BIT(1)
|
| 130 | |
| 131 | * The guest can *NOT* switch to software cursor and therefore depends on the
|
| 132 | * host cursor.
|
| 133 | *
|
| 134 | * When guest additions are installed and the host has promised to display the
|
| 135 | * cursor itself, the guest installs a hardware mouse driver. Don't ask the
|
| 136 | * guest to switch to a software cursor then.
|
| 137 |
|
| 138 | #define VMMDEV_MOUSE_GUEST_NEEDS_HOST_CURSOR BIT(2)
|
| 139 |
|
| 140 | #define VMMDEV_MOUSE_HOST_CANNOT_HWPOINTER BIT(3)
|
| 141 |
|
| 142 | #define VMMDEV_MOUSE_NEW_PROTOCOL BIT(4)
|
| 143 | |
| 144 | * If the guest changes the status of the VMMDEV_MOUSE_GUEST_NEEDS_HOST_CURSOR
|
| 145 | * bit, the host will honour this.
|
| 146 |
|
| 147 | #define VMMDEV_MOUSE_HOST_RECHECKS_NEEDS_HOST_CURSOR BIT(5)
|
| 148 | |
| 149 | * The host supplies an absolute pointing device. The Guest Additions may
|
| 150 | * wish to use this to decide whether to install their own driver.
|
| 151 |
|
| 152 | #define VMMDEV_MOUSE_HOST_HAS_ABS_DEV BIT(6)
|
| 153 |
|
| 154 |
|
| 155 | #define VMMDEV_MOUSE_RANGE_MIN 0
|
| 156 |
|
| 157 | #define VMMDEV_MOUSE_RANGE_MAX 0xFFFF
|
| 158 |
|
| 159 | |
| 160 | * struct vmmdev_host_version - VirtualBox host version request structure.
|
| 161 | *
|
| 162 | * VBG uses this to detect the precense of new features in the interface.
|
| 163 |
|
| 164 | struct vmmdev_host_version {
|
| 165 |
|
| 166 | struct vmmdev_request_header header;
|
| 167 |
|
| 168 | u16 major;
|
| 169 |
|
| 170 | u16 minor;
|
| 171 |
|
| 172 | u32 build;
|
| 173 |
|
| 174 | u32 revision;
|
| 175 |
|
| 176 | u32 features;
|
| 177 | };
|
| 178 | VMMDEV_ASSERT_SIZE(vmmdev_host_version, 24 + 16);
|
| 179 |
|
| 180 |
|
| 181 | #define VMMDEV_HVF_HGCM_PHYS_PAGE_LIST BIT(0)
|
| 182 |
|
| 183 | |
| 184 | * struct vmmdev_mask - Structure to set / clear bits in a mask used for
|
| 185 | * VMMDEVREQ_SET_GUEST_CAPABILITIES and VMMDEVREQ_CTL_GUEST_FILTER_MASK.
|
| 186 |
|
| 187 | struct vmmdev_mask {
|
| 188 |
|
| 189 | struct vmmdev_request_header header;
|
| 190 |
|
| 191 | u32 or_mask;
|
| 192 |
|
| 193 | u32 not_mask;
|
| 194 | };
|
| 195 | VMMDEV_ASSERT_SIZE(vmmdev_mask, 24 + 8);
|
| 196 |
|
| 197 |
|
| 198 | #define VMMDEV_GUEST_SUPPORTS_SEAMLESS BIT(0)
|
| 199 |
|
| 200 | #define VMMDEV_GUEST_SUPPORTS_GUEST_HOST_WINDOW_MAPPING BIT(1)
|
| 201 | |
| 202 | * The guest graphical additions are active.
|
| 203 | * Used for fast activation and deactivation of certain graphical operations
|
| 204 | * (e.g. resizing & seamless). The legacy VMMDEVREQ_REPORT_GUEST_CAPABILITIES
|
| 205 | * request sets this automatically, but VMMDEVREQ_SET_GUEST_CAPABILITIES does
|
| 206 | * not.
|
| 207 |
|
| 208 | #define VMMDEV_GUEST_SUPPORTS_GRAPHICS BIT(2)
|
| 209 |
|
| 210 | #define VMMDEV_GUEST_CAPABILITIES_MASK 0x00000007U
|
| 211 |
|
| 212 |
|
| 213 | struct vmmdev_hypervisorinfo {
|
| 214 |
|
| 215 | struct vmmdev_request_header header;
|
| 216 | |
| 217 | * Guest virtual address of proposed hypervisor start.
|
| 218 | * Not used by VMMDEVREQ_GET_HYPERVISOR_INFO.
|
| 219 |
|
| 220 | u32 hypervisor_start;
|
| 221 |
|
| 222 | u32 hypervisor_size;
|
| 223 | };
|
| 224 | VMMDEV_ASSERT_SIZE(vmmdev_hypervisorinfo, 24 + 8);
|
| 225 |
|
| 226 |
|
| 227 | struct vmmdev_events {
|
| 228 |
|
| 229 | struct vmmdev_request_header header;
|
| 230 |
|
| 231 | u32 events;
|
| 232 | };
|
| 233 | VMMDEV_ASSERT_SIZE(vmmdev_events, 24 + 4);
|
| 234 |
|
| 235 | #define VMMDEV_OSTYPE_LINUX26 0x53000
|
| 236 | #define VMMDEV_OSTYPE_X64 BIT(8)
|
| 237 |
|
| 238 |
|
| 239 | struct vmmdev_guest_info {
|
| 240 |
|
| 241 | struct vmmdev_request_header header;
|
| 242 | |
| 243 | * The VMMDev interface version expected by additions.
|
| 244 | * *Deprecated*, do not use anymore! Will be removed.
|
| 245 |
|
| 246 | u32 interface_version;
|
| 247 |
|
| 248 | u32 os_type;
|
| 249 | };
|
| 250 | VMMDEV_ASSERT_SIZE(vmmdev_guest_info, 24 + 8);
|
| 251 |
|
| 252 | #define VMMDEV_GUEST_INFO2_ADDITIONS_FEATURES_REQUESTOR_INFO BIT(0)
|
| 253 |
|
| 254 |
|
| 255 | struct vmmdev_guest_info2 {
|
| 256 |
|
| 257 | struct vmmdev_request_header header;
|
| 258 |
|
| 259 | u16 additions_major;
|
| 260 |
|
| 261 | u16 additions_minor;
|
| 262 |
|
| 263 | u32 additions_build;
|
| 264 |
|
| 265 | u32 additions_revision;
|
| 266 |
|
| 267 | u32 additions_features;
|
| 268 | |
| 269 | * The intentional meaning of this field was:
|
| 270 | * Some additional information, for example 'Beta 1' or something like
|
| 271 | * that.
|
| 272 | *
|
| 273 | * The way it was implemented was implemented: VBG_VERSION_STRING.
|
| 274 | *
|
| 275 | * This means the first three members are duplicated in this field (if
|
| 276 | * the guest build config is sane). So, the user must check this and
|
| 277 | * chop it off before usage. There is, because of the Main code's blind
|
| 278 | * trust in the field's content, no way back.
|
| 279 |
|
| 280 | char name[128];
|
| 281 | };
|
| 282 | VMMDEV_ASSERT_SIZE(vmmdev_guest_info2, 24 + 144);
|
| 283 |
|
| 284 | enum vmmdev_guest_facility_type {
|
| 285 | VBOXGUEST_FACILITY_TYPE_UNKNOWN = 0,
|
| 286 | VBOXGUEST_FACILITY_TYPE_VBOXGUEST_DRIVER = 20,
|
| 287 |
|
| 288 | VBOXGUEST_FACILITY_TYPE_AUTO_LOGON = 90,
|
| 289 | VBOXGUEST_FACILITY_TYPE_VBOX_SERVICE = 100,
|
| 290 |
|
| 291 | VBOXGUEST_FACILITY_TYPE_VBOX_TRAY_CLIENT = 101,
|
| 292 | VBOXGUEST_FACILITY_TYPE_SEAMLESS = 1000,
|
| 293 | VBOXGUEST_FACILITY_TYPE_GRAPHICS = 1100,
|
| 294 | VBOXGUEST_FACILITY_TYPE_ALL = 0x7ffffffe,
|
| 295 |
|
| 296 | VBOXGUEST_FACILITY_TYPE_SIZEHACK = 0x7fffffff
|
| 297 | };
|
| 298 |
|
| 299 | enum vmmdev_guest_facility_status {
|
| 300 | VBOXGUEST_FACILITY_STATUS_INACTIVE = 0,
|
| 301 | VBOXGUEST_FACILITY_STATUS_PAUSED = 1,
|
| 302 | VBOXGUEST_FACILITY_STATUS_PRE_INIT = 20,
|
| 303 | VBOXGUEST_FACILITY_STATUS_INIT = 30,
|
| 304 | VBOXGUEST_FACILITY_STATUS_ACTIVE = 50,
|
| 305 | VBOXGUEST_FACILITY_STATUS_TERMINATING = 100,
|
| 306 | VBOXGUEST_FACILITY_STATUS_TERMINATED = 101,
|
| 307 | VBOXGUEST_FACILITY_STATUS_FAILED = 800,
|
| 308 | VBOXGUEST_FACILITY_STATUS_UNKNOWN = 999,
|
| 309 |
|
| 310 | VBOXGUEST_FACILITY_STATUS_SIZEHACK = 0x7fffffff
|
| 311 | };
|
| 312 |
|
| 313 |
|
| 314 | struct vmmdev_guest_status {
|
| 315 |
|
| 316 | struct vmmdev_request_header header;
|
| 317 |
|
| 318 | enum vmmdev_guest_facility_type facility;
|
| 319 |
|
| 320 | enum vmmdev_guest_facility_status status;
|
| 321 |
|
| 322 | u32 flags;
|
| 323 | };
|
| 324 | VMMDEV_ASSERT_SIZE(vmmdev_guest_status, 24 + 12);
|
| 325 |
|
| 326 | #define VMMDEV_MEMORY_BALLOON_CHUNK_SIZE (1048576)
|
| 327 | #define VMMDEV_MEMORY_BALLOON_CHUNK_PAGES (1048576 / 4096)
|
| 328 |
|
| 329 |
|
| 330 | struct vmmdev_memballoon_info {
|
| 331 |
|
| 332 | struct vmmdev_request_header header;
|
| 333 |
|
| 334 | u32 balloon_chunks;
|
| 335 |
|
| 336 | u32 phys_mem_chunks;
|
| 337 | |
| 338 | * Setting this to VMMDEV_EVENT_BALLOON_CHANGE_REQUEST indicates that
|
| 339 | * the request is a response to that event.
|
| 340 | * (Don't confuse this with VMMDEVREQ_ACKNOWLEDGE_EVENTS.)
|
| 341 |
|
| 342 | u32 event_ack;
|
| 343 | };
|
| 344 | VMMDEV_ASSERT_SIZE(vmmdev_memballoon_info, 24 + 12);
|
| 345 |
|
| 346 |
|
| 347 | struct vmmdev_memballoon_change {
|
| 348 |
|
| 349 | struct vmmdev_request_header header;
|
| 350 |
|
| 351 | u32 pages;
|
| 352 |
|
| 353 | u32 inflate;
|
| 354 |
|
| 355 | u64 phys_page[VMMDEV_MEMORY_BALLOON_CHUNK_PAGES];
|
| 356 | };
|
| 357 |
|
| 358 |
|
| 359 | struct vmmdev_write_core_dump {
|
| 360 |
|
| 361 | struct vmmdev_request_header header;
|
| 362 |
|
| 363 | u32 flags;
|
| 364 | };
|
| 365 | VMMDEV_ASSERT_SIZE(vmmdev_write_core_dump, 24 + 4);
|
| 366 |
|
| 367 |
|
| 368 | struct vmmdev_heartbeat {
|
| 369 |
|
| 370 | struct vmmdev_request_header header;
|
| 371 |
|
| 372 | u64 interval_ns;
|
| 373 |
|
| 374 | u8 enabled;
|
| 375 |
|
| 376 | u8 padding[3];
|
| 377 | } __packed;
|
| 378 | VMMDEV_ASSERT_SIZE(vmmdev_heartbeat, 24 + 12);
|
| 379 |
|
| 380 | #define VMMDEV_HGCM_REQ_DONE BIT(0)
|
| 381 | #define VMMDEV_HGCM_REQ_CANCELLED BIT(1)
|
| 382 |
|
| 383 |
|
| 384 | struct vmmdev_hgcmreq_header {
|
| 385 |
|
| 386 | struct vmmdev_request_header header;
|
| 387 |
|
| 388 |
|
| 389 | u32 flags;
|
| 390 |
|
| 391 |
|
| 392 | s32 result;
|
| 393 | };
|
| 394 | VMMDEV_ASSERT_SIZE(vmmdev_hgcmreq_header, 24 + 8);
|
| 395 |
|
| 396 |
|
| 397 | struct vmmdev_hgcm_connect {
|
| 398 |
|
| 399 | struct vmmdev_hgcmreq_header header;
|
| 400 |
|
| 401 |
|
| 402 | struct vmmdev_hgcm_service_location loc;
|
| 403 |
|
| 404 |
|
| 405 | u32 client_id;
|
| 406 | };
|
| 407 | VMMDEV_ASSERT_SIZE(vmmdev_hgcm_connect, 32 + 132 + 4);
|
| 408 |
|
| 409 |
|
| 410 | struct vmmdev_hgcm_disconnect {
|
| 411 |
|
| 412 | struct vmmdev_hgcmreq_header header;
|
| 413 |
|
| 414 |
|
| 415 | u32 client_id;
|
| 416 | };
|
| 417 | VMMDEV_ASSERT_SIZE(vmmdev_hgcm_disconnect, 32 + 4);
|
| 418 |
|
| 419 | #define VMMDEV_HGCM_MAX_PARMS 32
|
| 420 |
|
| 421 |
|
| 422 | struct vmmdev_hgcm_call {
|
| 423 |
|
| 424 | struct vmmdev_hgcmreq_header header;
|
| 425 |
|
| 426 |
|
| 427 | u32 client_id;
|
| 428 |
|
| 429 | u32 function;
|
| 430 |
|
| 431 | u32 parm_count;
|
| 432 |
|
| 433 | };
|
| 434 | VMMDEV_ASSERT_SIZE(vmmdev_hgcm_call, 32 + 12);
|
| 435 |
|
| 436 | |
| 437 | * struct vmmdev_hgcm_cancel2 - HGCM cancel request structure, version 2.
|
| 438 | *
|
| 439 | * After the request header.rc will be:
|
| 440 | *
|
| 441 | * VINF_SUCCESS when cancelled.
|
| 442 | * VERR_NOT_FOUND if the specified request cannot be found.
|
| 443 | * VERR_INVALID_PARAMETER if the address is invalid valid.
|
| 444 |
|
| 445 | struct vmmdev_hgcm_cancel2 {
|
| 446 |
|
| 447 | struct vmmdev_request_header header;
|
| 448 |
|
| 449 | u32 phys_req_to_cancel;
|
| 450 | };
|
| 451 | VMMDEV_ASSERT_SIZE(vmmdev_hgcm_cancel2, 24 + 4);
|
| 452 |
|
| 453 | #endif
|