Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

virt: Add vboxguest driver for Virtual Box Guest integration UAPI

This commit adds the headers describing the ioctl API for the
/dev/vboxguest device used by the Virtual Box Guest Additions
in Virtual Box virtual machines.

The driver providing the /dev/vboxguest device will allow Virtual Box
Guest Additions features such as copy-and-paste, seamless mode and
OpenGL pass-through.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Hans de Goede and committed by
Greg Kroah-Hartman
f6ddd094 12eaa7a1

+714
+7
MAINTAINERS
··· 14557 14557 F: drivers/virtio/virtio_input.c 14558 14558 F: include/uapi/linux/virtio_input.h 14559 14559 14560 + VIRTUAL BOX GUEST DEVICE DRIVER 14561 + M: Hans de Goede <hdegoede@redhat.com> 14562 + M: Arnd Bergmann <arnd@arndb.de> 14563 + M: Greg Kroah-Hartman <gregkh@linuxfoundation.org> 14564 + S: Maintained 14565 + F: include/uapi/linux/vbox*.h 14566 + 14560 14567 VIRTUAL SERIO DEVICE DRIVER 14561 14568 M: Stephen Chandler Paul <thatslyude@gmail.com> 14562 14569 S: Maintained
+151
include/uapi/linux/vbox_err.h
··· 1 + /* SPDX-License-Identifier: MIT */ 2 + /* Copyright (C) 2017 Oracle Corporation */ 3 + 4 + #ifndef __UAPI_VBOX_ERR_H__ 5 + #define __UAPI_VBOX_ERR_H__ 6 + 7 + #define VINF_SUCCESS 0 8 + #define VERR_GENERAL_FAILURE (-1) 9 + #define VERR_INVALID_PARAMETER (-2) 10 + #define VERR_INVALID_MAGIC (-3) 11 + #define VERR_INVALID_HANDLE (-4) 12 + #define VERR_LOCK_FAILED (-5) 13 + #define VERR_INVALID_POINTER (-6) 14 + #define VERR_IDT_FAILED (-7) 15 + #define VERR_NO_MEMORY (-8) 16 + #define VERR_ALREADY_LOADED (-9) 17 + #define VERR_PERMISSION_DENIED (-10) 18 + #define VERR_VERSION_MISMATCH (-11) 19 + #define VERR_NOT_IMPLEMENTED (-12) 20 + #define VERR_INVALID_FLAGS (-13) 21 + 22 + #define VERR_NOT_EQUAL (-18) 23 + #define VERR_NOT_SYMLINK (-19) 24 + #define VERR_NO_TMP_MEMORY (-20) 25 + #define VERR_INVALID_FMODE (-21) 26 + #define VERR_WRONG_ORDER (-22) 27 + #define VERR_NO_TLS_FOR_SELF (-23) 28 + #define VERR_FAILED_TO_SET_SELF_TLS (-24) 29 + #define VERR_NO_CONT_MEMORY (-26) 30 + #define VERR_NO_PAGE_MEMORY (-27) 31 + #define VERR_THREAD_IS_DEAD (-29) 32 + #define VERR_THREAD_NOT_WAITABLE (-30) 33 + #define VERR_PAGE_TABLE_NOT_PRESENT (-31) 34 + #define VERR_INVALID_CONTEXT (-32) 35 + #define VERR_TIMER_BUSY (-33) 36 + #define VERR_ADDRESS_CONFLICT (-34) 37 + #define VERR_UNRESOLVED_ERROR (-35) 38 + #define VERR_INVALID_FUNCTION (-36) 39 + #define VERR_NOT_SUPPORTED (-37) 40 + #define VERR_ACCESS_DENIED (-38) 41 + #define VERR_INTERRUPTED (-39) 42 + #define VERR_TIMEOUT (-40) 43 + #define VERR_BUFFER_OVERFLOW (-41) 44 + #define VERR_TOO_MUCH_DATA (-42) 45 + #define VERR_MAX_THRDS_REACHED (-43) 46 + #define VERR_MAX_PROCS_REACHED (-44) 47 + #define VERR_SIGNAL_REFUSED (-45) 48 + #define VERR_SIGNAL_PENDING (-46) 49 + #define VERR_SIGNAL_INVALID (-47) 50 + #define VERR_STATE_CHANGED (-48) 51 + #define VERR_INVALID_UUID_FORMAT (-49) 52 + #define VERR_PROCESS_NOT_FOUND (-50) 53 + #define VERR_PROCESS_RUNNING (-51) 54 + #define VERR_TRY_AGAIN (-52) 55 + #define VERR_PARSE_ERROR (-53) 56 + #define VERR_OUT_OF_RANGE (-54) 57 + #define VERR_NUMBER_TOO_BIG (-55) 58 + #define VERR_NO_DIGITS (-56) 59 + #define VERR_NEGATIVE_UNSIGNED (-57) 60 + #define VERR_NO_TRANSLATION (-58) 61 + 62 + #define VERR_NOT_FOUND (-78) 63 + #define VERR_INVALID_STATE (-79) 64 + #define VERR_OUT_OF_RESOURCES (-80) 65 + 66 + #define VERR_FILE_NOT_FOUND (-102) 67 + #define VERR_PATH_NOT_FOUND (-103) 68 + #define VERR_INVALID_NAME (-104) 69 + #define VERR_ALREADY_EXISTS (-105) 70 + #define VERR_TOO_MANY_OPEN_FILES (-106) 71 + #define VERR_SEEK (-107) 72 + #define VERR_NEGATIVE_SEEK (-108) 73 + #define VERR_SEEK_ON_DEVICE (-109) 74 + #define VERR_EOF (-110) 75 + #define VERR_READ_ERROR (-111) 76 + #define VERR_WRITE_ERROR (-112) 77 + #define VERR_WRITE_PROTECT (-113) 78 + #define VERR_SHARING_VIOLATION (-114) 79 + #define VERR_FILE_LOCK_FAILED (-115) 80 + #define VERR_FILE_LOCK_VIOLATION (-116) 81 + #define VERR_CANT_CREATE (-117) 82 + #define VERR_CANT_DELETE_DIRECTORY (-118) 83 + #define VERR_NOT_SAME_DEVICE (-119) 84 + #define VERR_FILENAME_TOO_LONG (-120) 85 + #define VERR_MEDIA_NOT_PRESENT (-121) 86 + #define VERR_MEDIA_NOT_RECOGNIZED (-122) 87 + #define VERR_FILE_NOT_LOCKED (-123) 88 + #define VERR_FILE_LOCK_LOST (-124) 89 + #define VERR_DIR_NOT_EMPTY (-125) 90 + #define VERR_NOT_A_DIRECTORY (-126) 91 + #define VERR_IS_A_DIRECTORY (-127) 92 + #define VERR_FILE_TOO_BIG (-128) 93 + 94 + #define VERR_NET_IO_ERROR (-400) 95 + #define VERR_NET_OUT_OF_RESOURCES (-401) 96 + #define VERR_NET_HOST_NOT_FOUND (-402) 97 + #define VERR_NET_PATH_NOT_FOUND (-403) 98 + #define VERR_NET_PRINT_ERROR (-404) 99 + #define VERR_NET_NO_NETWORK (-405) 100 + #define VERR_NET_NOT_UNIQUE_NAME (-406) 101 + 102 + #define VERR_NET_IN_PROGRESS (-436) 103 + #define VERR_NET_ALREADY_IN_PROGRESS (-437) 104 + #define VERR_NET_NOT_SOCKET (-438) 105 + #define VERR_NET_DEST_ADDRESS_REQUIRED (-439) 106 + #define VERR_NET_MSG_SIZE (-440) 107 + #define VERR_NET_PROTOCOL_TYPE (-441) 108 + #define VERR_NET_PROTOCOL_NOT_AVAILABLE (-442) 109 + #define VERR_NET_PROTOCOL_NOT_SUPPORTED (-443) 110 + #define VERR_NET_SOCKET_TYPE_NOT_SUPPORTED (-444) 111 + #define VERR_NET_OPERATION_NOT_SUPPORTED (-445) 112 + #define VERR_NET_PROTOCOL_FAMILY_NOT_SUPPORTED (-446) 113 + #define VERR_NET_ADDRESS_FAMILY_NOT_SUPPORTED (-447) 114 + #define VERR_NET_ADDRESS_IN_USE (-448) 115 + #define VERR_NET_ADDRESS_NOT_AVAILABLE (-449) 116 + #define VERR_NET_DOWN (-450) 117 + #define VERR_NET_UNREACHABLE (-451) 118 + #define VERR_NET_CONNECTION_RESET (-452) 119 + #define VERR_NET_CONNECTION_ABORTED (-453) 120 + #define VERR_NET_CONNECTION_RESET_BY_PEER (-454) 121 + #define VERR_NET_NO_BUFFER_SPACE (-455) 122 + #define VERR_NET_ALREADY_CONNECTED (-456) 123 + #define VERR_NET_NOT_CONNECTED (-457) 124 + #define VERR_NET_SHUTDOWN (-458) 125 + #define VERR_NET_TOO_MANY_REFERENCES (-459) 126 + #define VERR_NET_CONNECTION_TIMED_OUT (-460) 127 + #define VERR_NET_CONNECTION_REFUSED (-461) 128 + #define VERR_NET_HOST_DOWN (-464) 129 + #define VERR_NET_HOST_UNREACHABLE (-465) 130 + #define VERR_NET_PROTOCOL_ERROR (-466) 131 + #define VERR_NET_INCOMPLETE_TX_PACKET (-467) 132 + 133 + /* misc. unsorted codes */ 134 + #define VERR_RESOURCE_BUSY (-138) 135 + #define VERR_DISK_FULL (-152) 136 + #define VERR_TOO_MANY_SYMLINKS (-156) 137 + #define VERR_NO_MORE_FILES (-201) 138 + #define VERR_INTERNAL_ERROR (-225) 139 + #define VERR_INTERNAL_ERROR_2 (-226) 140 + #define VERR_INTERNAL_ERROR_3 (-227) 141 + #define VERR_INTERNAL_ERROR_4 (-228) 142 + #define VERR_DEV_IO_ERROR (-250) 143 + #define VERR_IO_BAD_LENGTH (-255) 144 + #define VERR_BROKEN_PIPE (-301) 145 + #define VERR_NO_DATA (-304) 146 + #define VERR_SEM_DESTROYED (-363) 147 + #define VERR_DEADLOCK (-365) 148 + #define VERR_BAD_EXE_FORMAT (-608) 149 + #define VINF_HGCM_ASYNC_EXECUTE (2903) 150 + 151 + #endif
+226
include/uapi/linux/vbox_vmmdev_types.h
··· 1 + /* SPDX-License-Identifier: (GPL-2.0 OR CDDL-1.0) */ 2 + /* 3 + * Virtual Device for Guest <-> VMM/Host communication, type definitions 4 + * which are also used for the vboxguest ioctl interface / by vboxsf 5 + * 6 + * Copyright (C) 2006-2016 Oracle Corporation 7 + */ 8 + 9 + #ifndef __UAPI_VBOX_VMMDEV_TYPES_H__ 10 + #define __UAPI_VBOX_VMMDEV_TYPES_H__ 11 + 12 + #include <asm/bitsperlong.h> 13 + #include <linux/types.h> 14 + 15 + /* 16 + * We cannot use linux' compiletime_assert here because it expects to be used 17 + * inside a function only. Use a typedef to a char array with a negative size. 18 + */ 19 + #define VMMDEV_ASSERT_SIZE(type, size) \ 20 + typedef char type ## _asrt_size[1 - 2*!!(sizeof(struct type) != (size))] 21 + 22 + /** enum vmmdev_request_type - VMMDev request types. */ 23 + enum vmmdev_request_type { 24 + VMMDEVREQ_INVALID_REQUEST = 0, 25 + VMMDEVREQ_GET_MOUSE_STATUS = 1, 26 + VMMDEVREQ_SET_MOUSE_STATUS = 2, 27 + VMMDEVREQ_SET_POINTER_SHAPE = 3, 28 + VMMDEVREQ_GET_HOST_VERSION = 4, 29 + VMMDEVREQ_IDLE = 5, 30 + VMMDEVREQ_GET_HOST_TIME = 10, 31 + VMMDEVREQ_GET_HYPERVISOR_INFO = 20, 32 + VMMDEVREQ_SET_HYPERVISOR_INFO = 21, 33 + VMMDEVREQ_REGISTER_PATCH_MEMORY = 22, /* since version 3.0.6 */ 34 + VMMDEVREQ_DEREGISTER_PATCH_MEMORY = 23, /* since version 3.0.6 */ 35 + VMMDEVREQ_SET_POWER_STATUS = 30, 36 + VMMDEVREQ_ACKNOWLEDGE_EVENTS = 41, 37 + VMMDEVREQ_CTL_GUEST_FILTER_MASK = 42, 38 + VMMDEVREQ_REPORT_GUEST_INFO = 50, 39 + VMMDEVREQ_REPORT_GUEST_INFO2 = 58, /* since version 3.2.0 */ 40 + VMMDEVREQ_REPORT_GUEST_STATUS = 59, /* since version 3.2.8 */ 41 + VMMDEVREQ_REPORT_GUEST_USER_STATE = 74, /* since version 4.3 */ 42 + /* Retrieve a display resize request sent by the host, deprecated. */ 43 + VMMDEVREQ_GET_DISPLAY_CHANGE_REQ = 51, 44 + VMMDEVREQ_VIDEMODE_SUPPORTED = 52, 45 + VMMDEVREQ_GET_HEIGHT_REDUCTION = 53, 46 + /** 47 + * @VMMDEVREQ_GET_DISPLAY_CHANGE_REQ2: 48 + * Retrieve a display resize request sent by the host. 49 + * 50 + * Queries a display resize request sent from the host. If the 51 + * event_ack member is sent to true and there is an unqueried request 52 + * available for one of the virtual display then that request will 53 + * be returned. If several displays have unqueried requests the lowest 54 + * numbered display will be chosen first. Only the most recent unseen 55 + * request for each display is remembered. 56 + * If event_ack is set to false, the last host request queried with 57 + * event_ack set is resent, or failing that the most recent received 58 + * from the host. If no host request was ever received then all zeros 59 + * are returned. 60 + */ 61 + VMMDEVREQ_GET_DISPLAY_CHANGE_REQ2 = 54, 62 + VMMDEVREQ_REPORT_GUEST_CAPABILITIES = 55, 63 + VMMDEVREQ_SET_GUEST_CAPABILITIES = 56, 64 + VMMDEVREQ_VIDEMODE_SUPPORTED2 = 57, /* since version 3.2.0 */ 65 + VMMDEVREQ_GET_DISPLAY_CHANGE_REQEX = 80, /* since version 4.2.4 */ 66 + VMMDEVREQ_HGCM_CONNECT = 60, 67 + VMMDEVREQ_HGCM_DISCONNECT = 61, 68 + VMMDEVREQ_HGCM_CALL32 = 62, 69 + VMMDEVREQ_HGCM_CALL64 = 63, 70 + VMMDEVREQ_HGCM_CANCEL = 64, 71 + VMMDEVREQ_HGCM_CANCEL2 = 65, 72 + VMMDEVREQ_VIDEO_ACCEL_ENABLE = 70, 73 + VMMDEVREQ_VIDEO_ACCEL_FLUSH = 71, 74 + VMMDEVREQ_VIDEO_SET_VISIBLE_REGION = 72, 75 + VMMDEVREQ_GET_SEAMLESS_CHANGE_REQ = 73, 76 + VMMDEVREQ_QUERY_CREDENTIALS = 100, 77 + VMMDEVREQ_REPORT_CREDENTIALS_JUDGEMENT = 101, 78 + VMMDEVREQ_REPORT_GUEST_STATS = 110, 79 + VMMDEVREQ_GET_MEMBALLOON_CHANGE_REQ = 111, 80 + VMMDEVREQ_GET_STATISTICS_CHANGE_REQ = 112, 81 + VMMDEVREQ_CHANGE_MEMBALLOON = 113, 82 + VMMDEVREQ_GET_VRDPCHANGE_REQ = 150, 83 + VMMDEVREQ_LOG_STRING = 200, 84 + VMMDEVREQ_GET_CPU_HOTPLUG_REQ = 210, 85 + VMMDEVREQ_SET_CPU_HOTPLUG_STATUS = 211, 86 + VMMDEVREQ_REGISTER_SHARED_MODULE = 212, 87 + VMMDEVREQ_UNREGISTER_SHARED_MODULE = 213, 88 + VMMDEVREQ_CHECK_SHARED_MODULES = 214, 89 + VMMDEVREQ_GET_PAGE_SHARING_STATUS = 215, 90 + VMMDEVREQ_DEBUG_IS_PAGE_SHARED = 216, 91 + VMMDEVREQ_GET_SESSION_ID = 217, /* since version 3.2.8 */ 92 + VMMDEVREQ_WRITE_COREDUMP = 218, 93 + VMMDEVREQ_GUEST_HEARTBEAT = 219, 94 + VMMDEVREQ_HEARTBEAT_CONFIGURE = 220, 95 + /* Ensure the enum is a 32 bit data-type */ 96 + VMMDEVREQ_SIZEHACK = 0x7fffffff 97 + }; 98 + 99 + #if __BITS_PER_LONG == 64 100 + #define VMMDEVREQ_HGCM_CALL VMMDEVREQ_HGCM_CALL64 101 + #else 102 + #define VMMDEVREQ_HGCM_CALL VMMDEVREQ_HGCM_CALL32 103 + #endif 104 + 105 + /** HGCM service location types. */ 106 + enum vmmdev_hgcm_service_location_type { 107 + VMMDEV_HGCM_LOC_INVALID = 0, 108 + VMMDEV_HGCM_LOC_LOCALHOST = 1, 109 + VMMDEV_HGCM_LOC_LOCALHOST_EXISTING = 2, 110 + /* Ensure the enum is a 32 bit data-type */ 111 + VMMDEV_HGCM_LOC_SIZEHACK = 0x7fffffff 112 + }; 113 + 114 + /** HGCM host service location. */ 115 + struct vmmdev_hgcm_service_location_localhost { 116 + /** Service name */ 117 + char service_name[128]; 118 + }; 119 + VMMDEV_ASSERT_SIZE(vmmdev_hgcm_service_location_localhost, 128); 120 + 121 + /** HGCM service location. */ 122 + struct vmmdev_hgcm_service_location { 123 + /** Type of the location. */ 124 + enum vmmdev_hgcm_service_location_type type; 125 + 126 + union { 127 + struct vmmdev_hgcm_service_location_localhost localhost; 128 + } u; 129 + }; 130 + VMMDEV_ASSERT_SIZE(vmmdev_hgcm_service_location, 128 + 4); 131 + 132 + /** HGCM function parameter type. */ 133 + enum vmmdev_hgcm_function_parameter_type { 134 + VMMDEV_HGCM_PARM_TYPE_INVALID = 0, 135 + VMMDEV_HGCM_PARM_TYPE_32BIT = 1, 136 + VMMDEV_HGCM_PARM_TYPE_64BIT = 2, 137 + /** Deprecated Doesn't work, use PAGELIST. */ 138 + VMMDEV_HGCM_PARM_TYPE_PHYSADDR = 3, 139 + /** In and Out, user-memory */ 140 + VMMDEV_HGCM_PARM_TYPE_LINADDR = 4, 141 + /** In, user-memory (read; host<-guest) */ 142 + VMMDEV_HGCM_PARM_TYPE_LINADDR_IN = 5, 143 + /** Out, user-memory (write; host->guest) */ 144 + VMMDEV_HGCM_PARM_TYPE_LINADDR_OUT = 6, 145 + /** In and Out, kernel-memory */ 146 + VMMDEV_HGCM_PARM_TYPE_LINADDR_KERNEL = 7, 147 + /** In, kernel-memory (read; host<-guest) */ 148 + VMMDEV_HGCM_PARM_TYPE_LINADDR_KERNEL_IN = 8, 149 + /** Out, kernel-memory (write; host->guest) */ 150 + VMMDEV_HGCM_PARM_TYPE_LINADDR_KERNEL_OUT = 9, 151 + /** Physical addresses of locked pages for a buffer. */ 152 + VMMDEV_HGCM_PARM_TYPE_PAGELIST = 10, 153 + /* Ensure the enum is a 32 bit data-type */ 154 + VMMDEV_HGCM_PARM_TYPE_SIZEHACK = 0x7fffffff 155 + }; 156 + 157 + /** HGCM function parameter, 32-bit client. */ 158 + struct vmmdev_hgcm_function_parameter32 { 159 + enum vmmdev_hgcm_function_parameter_type type; 160 + union { 161 + __u32 value32; 162 + __u64 value64; 163 + struct { 164 + __u32 size; 165 + union { 166 + __u32 phys_addr; 167 + __u32 linear_addr; 168 + } u; 169 + } pointer; 170 + struct { 171 + /** Size of the buffer described by the page list. */ 172 + __u32 size; 173 + /** Relative to the request header. */ 174 + __u32 offset; 175 + } page_list; 176 + } u; 177 + } __packed; 178 + VMMDEV_ASSERT_SIZE(vmmdev_hgcm_function_parameter32, 4 + 8); 179 + 180 + /** HGCM function parameter, 64-bit client. */ 181 + struct vmmdev_hgcm_function_parameter64 { 182 + enum vmmdev_hgcm_function_parameter_type type; 183 + union { 184 + __u32 value32; 185 + __u64 value64; 186 + struct { 187 + __u32 size; 188 + union { 189 + __u64 phys_addr; 190 + __u64 linear_addr; 191 + } u; 192 + } __packed pointer; 193 + struct { 194 + /** Size of the buffer described by the page list. */ 195 + __u32 size; 196 + /** Relative to the request header. */ 197 + __u32 offset; 198 + } page_list; 199 + } __packed u; 200 + } __packed; 201 + VMMDEV_ASSERT_SIZE(vmmdev_hgcm_function_parameter64, 4 + 12); 202 + 203 + #if __BITS_PER_LONG == 64 204 + #define vmmdev_hgcm_function_parameter vmmdev_hgcm_function_parameter64 205 + #else 206 + #define vmmdev_hgcm_function_parameter vmmdev_hgcm_function_parameter32 207 + #endif 208 + 209 + #define VMMDEV_HGCM_F_PARM_DIRECTION_NONE 0x00000000U 210 + #define VMMDEV_HGCM_F_PARM_DIRECTION_TO_HOST 0x00000001U 211 + #define VMMDEV_HGCM_F_PARM_DIRECTION_FROM_HOST 0x00000002U 212 + #define VMMDEV_HGCM_F_PARM_DIRECTION_BOTH 0x00000003U 213 + 214 + /** 215 + * struct vmmdev_hgcm_pagelist - VMMDEV_HGCM_PARM_TYPE_PAGELIST parameters 216 + * point to this structure to actually describe the buffer. 217 + */ 218 + struct vmmdev_hgcm_pagelist { 219 + __u32 flags; /** VMMDEV_HGCM_F_PARM_*. */ 220 + __u16 offset_first_page; /** Data offset in the first page. */ 221 + __u16 page_count; /** Number of pages. */ 222 + __u64 pages[1]; /** Page addresses. */ 223 + }; 224 + VMMDEV_ASSERT_SIZE(vmmdev_hgcm_pagelist, 4 + 2 + 2 + 8); 225 + 226 + #endif
+330
include/uapi/linux/vboxguest.h
··· 1 + /* SPDX-License-Identifier: (GPL-2.0 OR CDDL-1.0) */ 2 + /* 3 + * VBoxGuest - VirtualBox Guest Additions Driver Interface. 4 + * 5 + * Copyright (C) 2006-2016 Oracle Corporation 6 + */ 7 + 8 + #ifndef __UAPI_VBOXGUEST_H__ 9 + #define __UAPI_VBOXGUEST_H__ 10 + 11 + #include <asm/bitsperlong.h> 12 + #include <linux/ioctl.h> 13 + #include <linux/vbox_err.h> 14 + #include <linux/vbox_vmmdev_types.h> 15 + 16 + /* Version of vbg_ioctl_hdr structure. */ 17 + #define VBG_IOCTL_HDR_VERSION 0x10001 18 + /* Default request type. Use this for non-VMMDev requests. */ 19 + #define VBG_IOCTL_HDR_TYPE_DEFAULT 0 20 + 21 + /** 22 + * Common ioctl header. 23 + * 24 + * This is a mirror of vmmdev_request_header to prevent duplicating data and 25 + * needing to verify things multiple times. 26 + */ 27 + struct vbg_ioctl_hdr { 28 + /** IN: The request input size, and output size if size_out is zero. */ 29 + __u32 size_in; 30 + /** IN: Structure version (VBG_IOCTL_HDR_VERSION) */ 31 + __u32 version; 32 + /** IN: The VMMDev request type or VBG_IOCTL_HDR_TYPE_DEFAULT. */ 33 + __u32 type; 34 + /** 35 + * OUT: The VBox status code of the operation, out direction only. 36 + * This is a VINF_ or VERR_ value as defined in vbox_err.h. 37 + */ 38 + __s32 rc; 39 + /** IN: Output size. Set to zero to use size_in as output size. */ 40 + __u32 size_out; 41 + /** Reserved, MBZ. */ 42 + __u32 reserved; 43 + }; 44 + VMMDEV_ASSERT_SIZE(vbg_ioctl_hdr, 24); 45 + 46 + 47 + /* 48 + * The VBoxGuest I/O control version. 49 + * 50 + * As usual, the high word contains the major version and changes to it 51 + * signifies incompatible changes. 52 + * 53 + * The lower word is the minor version number, it is increased when new 54 + * functions are added or existing changed in a backwards compatible manner. 55 + */ 56 + #define VBG_IOC_VERSION 0x00010000u 57 + 58 + /** 59 + * VBG_IOCTL_DRIVER_VERSION_INFO data structure 60 + * 61 + * Note VBG_IOCTL_DRIVER_VERSION_INFO may switch the session to a backwards 62 + * compatible interface version if uClientVersion indicates older client code. 63 + */ 64 + struct vbg_ioctl_driver_version_info { 65 + /** The header. */ 66 + struct vbg_ioctl_hdr hdr; 67 + union { 68 + struct { 69 + /** Requested interface version (VBG_IOC_VERSION). */ 70 + __u32 req_version; 71 + /** 72 + * Minimum interface version number (typically the 73 + * major version part of VBG_IOC_VERSION). 74 + */ 75 + __u32 min_version; 76 + /** Reserved, MBZ. */ 77 + __u32 reserved1; 78 + /** Reserved, MBZ. */ 79 + __u32 reserved2; 80 + } in; 81 + struct { 82 + /** Version for this session (typ. VBG_IOC_VERSION). */ 83 + __u32 session_version; 84 + /** Version of the IDC interface (VBG_IOC_VERSION). */ 85 + __u32 driver_version; 86 + /** The SVN revision of the driver, or 0. */ 87 + __u32 driver_revision; 88 + /** Reserved \#1 (zero until defined). */ 89 + __u32 reserved1; 90 + /** Reserved \#2 (zero until defined). */ 91 + __u32 reserved2; 92 + } out; 93 + } u; 94 + }; 95 + VMMDEV_ASSERT_SIZE(vbg_ioctl_driver_version_info, 24 + 20); 96 + 97 + #define VBG_IOCTL_DRIVER_VERSION_INFO \ 98 + _IOWR('V', 0, struct vbg_ioctl_driver_version_info) 99 + 100 + 101 + /* IOCTL to perform a VMM Device request less than 1KB in size. */ 102 + #define VBG_IOCTL_VMMDEV_REQUEST(s) _IOC(_IOC_READ | _IOC_WRITE, 'V', 2, s) 103 + 104 + 105 + /* IOCTL to perform a VMM Device request larger then 1KB. */ 106 + #define VBG_IOCTL_VMMDEV_REQUEST_BIG _IOC(_IOC_READ | _IOC_WRITE, 'V', 3, 0) 107 + 108 + 109 + /** VBG_IOCTL_HGCM_CONNECT data structure. */ 110 + struct vbg_ioctl_hgcm_connect { 111 + struct vbg_ioctl_hdr hdr; 112 + union { 113 + struct { 114 + struct vmmdev_hgcm_service_location loc; 115 + } in; 116 + struct { 117 + __u32 client_id; 118 + } out; 119 + } u; 120 + }; 121 + VMMDEV_ASSERT_SIZE(vbg_ioctl_hgcm_connect, 24 + 132); 122 + 123 + #define VBG_IOCTL_HGCM_CONNECT \ 124 + _IOWR('V', 4, struct vbg_ioctl_hgcm_connect) 125 + 126 + 127 + /** VBG_IOCTL_HGCM_DISCONNECT data structure. */ 128 + struct vbg_ioctl_hgcm_disconnect { 129 + struct vbg_ioctl_hdr hdr; 130 + union { 131 + struct { 132 + __u32 client_id; 133 + } in; 134 + } u; 135 + }; 136 + VMMDEV_ASSERT_SIZE(vbg_ioctl_hgcm_disconnect, 24 + 4); 137 + 138 + #define VBG_IOCTL_HGCM_DISCONNECT \ 139 + _IOWR('V', 5, struct vbg_ioctl_hgcm_disconnect) 140 + 141 + 142 + /** VBG_IOCTL_HGCM_CALL data structure. */ 143 + struct vbg_ioctl_hgcm_call { 144 + /** The header. */ 145 + struct vbg_ioctl_hdr hdr; 146 + /** Input: The id of the caller. */ 147 + __u32 client_id; 148 + /** Input: Function number. */ 149 + __u32 function; 150 + /** 151 + * Input: How long to wait (milliseconds) for completion before 152 + * cancelling the call. Set to -1 to wait indefinitely. 153 + */ 154 + __u32 timeout_ms; 155 + /** Interruptable flag, ignored for userspace calls. */ 156 + __u8 interruptible; 157 + /** Explicit padding, MBZ. */ 158 + __u8 reserved; 159 + /** 160 + * Input: How many parameters following this structure. 161 + * 162 + * The parameters are either HGCMFunctionParameter64 or 32, 163 + * depending on whether we're receiving a 64-bit or 32-bit request. 164 + * 165 + * The current maximum is 61 parameters (given a 1KB max request size, 166 + * and a 64-bit parameter size of 16 bytes). 167 + */ 168 + __u16 parm_count; 169 + /* 170 + * Parameters follow in form: 171 + * struct hgcm_function_parameter<32|64> parms[parm_count] 172 + */ 173 + }; 174 + VMMDEV_ASSERT_SIZE(vbg_ioctl_hgcm_call, 24 + 16); 175 + 176 + #define VBG_IOCTL_HGCM_CALL_32(s) _IOC(_IOC_READ | _IOC_WRITE, 'V', 6, s) 177 + #define VBG_IOCTL_HGCM_CALL_64(s) _IOC(_IOC_READ | _IOC_WRITE, 'V', 7, s) 178 + #if __BITS_PER_LONG == 64 179 + #define VBG_IOCTL_HGCM_CALL(s) VBG_IOCTL_HGCM_CALL_64(s) 180 + #else 181 + #define VBG_IOCTL_HGCM_CALL(s) VBG_IOCTL_HGCM_CALL_32(s) 182 + #endif 183 + 184 + 185 + /** VBG_IOCTL_LOG data structure. */ 186 + struct vbg_ioctl_log { 187 + /** The header. */ 188 + struct vbg_ioctl_hdr hdr; 189 + union { 190 + struct { 191 + /** 192 + * The log message, this may be zero terminated. If it 193 + * is not zero terminated then the length is determined 194 + * from the input size. 195 + */ 196 + char msg[1]; 197 + } in; 198 + } u; 199 + }; 200 + 201 + #define VBG_IOCTL_LOG(s) _IOC(_IOC_READ | _IOC_WRITE, 'V', 9, s) 202 + 203 + 204 + /** VBG_IOCTL_WAIT_FOR_EVENTS data structure. */ 205 + struct vbg_ioctl_wait_for_events { 206 + /** The header. */ 207 + struct vbg_ioctl_hdr hdr; 208 + union { 209 + struct { 210 + /** Timeout in milliseconds. */ 211 + __u32 timeout_ms; 212 + /** Events to wait for. */ 213 + __u32 events; 214 + } in; 215 + struct { 216 + /** Events that occurred. */ 217 + __u32 events; 218 + } out; 219 + } u; 220 + }; 221 + VMMDEV_ASSERT_SIZE(vbg_ioctl_wait_for_events, 24 + 8); 222 + 223 + #define VBG_IOCTL_WAIT_FOR_EVENTS \ 224 + _IOWR('V', 10, struct vbg_ioctl_wait_for_events) 225 + 226 + 227 + /* 228 + * IOCTL to VBoxGuest to interrupt (cancel) any pending 229 + * VBG_IOCTL_WAIT_FOR_EVENTS and return. 230 + * 231 + * Handled inside the vboxguest driver and not seen by the host at all. 232 + * After calling this, VBG_IOCTL_WAIT_FOR_EVENTS should no longer be called in 233 + * the same session. Any VBOXGUEST_IOCTL_WAITEVENT calls in the same session 234 + * done after calling this will directly exit with -EINTR. 235 + */ 236 + #define VBG_IOCTL_INTERRUPT_ALL_WAIT_FOR_EVENTS \ 237 + _IOWR('V', 11, struct vbg_ioctl_hdr) 238 + 239 + 240 + /** VBG_IOCTL_CHANGE_FILTER_MASK data structure. */ 241 + struct vbg_ioctl_change_filter { 242 + /** The header. */ 243 + struct vbg_ioctl_hdr hdr; 244 + union { 245 + struct { 246 + /** Flags to set. */ 247 + __u32 or_mask; 248 + /** Flags to remove. */ 249 + __u32 not_mask; 250 + } in; 251 + } u; 252 + }; 253 + VMMDEV_ASSERT_SIZE(vbg_ioctl_change_filter, 24 + 8); 254 + 255 + /* IOCTL to VBoxGuest to control the event filter mask. */ 256 + #define VBG_IOCTL_CHANGE_FILTER_MASK \ 257 + _IOWR('V', 12, struct vbg_ioctl_change_filter) 258 + 259 + 260 + /** VBG_IOCTL_CHANGE_GUEST_CAPABILITIES data structure. */ 261 + struct vbg_ioctl_set_guest_caps { 262 + /** The header. */ 263 + struct vbg_ioctl_hdr hdr; 264 + union { 265 + struct { 266 + /** Capabilities to set (VMMDEV_GUEST_SUPPORTS_XXX). */ 267 + __u32 or_mask; 268 + /** Capabilities to drop (VMMDEV_GUEST_SUPPORTS_XXX). */ 269 + __u32 not_mask; 270 + } in; 271 + struct { 272 + /** Capabilities held by the session after the call. */ 273 + __u32 session_caps; 274 + /** Capabilities for all the sessions after the call. */ 275 + __u32 global_caps; 276 + } out; 277 + } u; 278 + }; 279 + VMMDEV_ASSERT_SIZE(vbg_ioctl_set_guest_caps, 24 + 8); 280 + 281 + #define VBG_IOCTL_CHANGE_GUEST_CAPABILITIES \ 282 + _IOWR('V', 14, struct vbg_ioctl_set_guest_caps) 283 + 284 + 285 + /** VBG_IOCTL_CHECK_BALLOON data structure. */ 286 + struct vbg_ioctl_check_balloon { 287 + /** The header. */ 288 + struct vbg_ioctl_hdr hdr; 289 + union { 290 + struct { 291 + /** The size of the balloon in chunks of 1MB. */ 292 + __u32 balloon_chunks; 293 + /** 294 + * false = handled in R0, no further action required. 295 + * true = allocate balloon memory in R3. 296 + */ 297 + __u8 handle_in_r3; 298 + /** Explicit padding, MBZ. */ 299 + __u8 padding[3]; 300 + } out; 301 + } u; 302 + }; 303 + VMMDEV_ASSERT_SIZE(vbg_ioctl_check_balloon, 24 + 8); 304 + 305 + /* 306 + * IOCTL to check memory ballooning. 307 + * 308 + * The guest kernel module will ask the host for the current size of the 309 + * balloon and adjust the size. Or it will set handle_in_r3 = true and R3 is 310 + * responsible for allocating memory and calling VBG_IOCTL_CHANGE_BALLOON. 311 + */ 312 + #define VBG_IOCTL_CHECK_BALLOON \ 313 + _IOWR('V', 17, struct vbg_ioctl_check_balloon) 314 + 315 + 316 + /** VBG_IOCTL_WRITE_CORE_DUMP data structure. */ 317 + struct vbg_ioctl_write_coredump { 318 + struct vbg_ioctl_hdr hdr; 319 + union { 320 + struct { 321 + __u32 flags; /** Flags (reserved, MBZ). */ 322 + } in; 323 + } u; 324 + }; 325 + VMMDEV_ASSERT_SIZE(vbg_ioctl_write_coredump, 24 + 4); 326 + 327 + #define VBG_IOCTL_WRITE_CORE_DUMP \ 328 + _IOWR('V', 19, struct vbg_ioctl_write_coredump) 329 + 330 + #endif