1 /* SPDX-License-Identifier: ((GPL-2.0 WITH Lin 1 2 /* 3 * VBoxGuest - VirtualBox Guest Additions Driv 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 0x1000 18 /* Default request type. Use this for non-VMM 19 #define VBG_IOCTL_HDR_TYPE_DEFAULT 20 21 /** 22 * Common ioctl header. 23 * 24 * This is a mirror of vmmdev_request_header t 25 * needing to verify things multiple times. 26 */ 27 struct vbg_ioctl_hdr { 28 /** IN: The request input size, and ou 29 __u32 size_in; 30 /** IN: Structure version (VBG_IOCTL_H 31 __u32 version; 32 /** IN: The VMMDev request type or VBG 33 __u32 type; 34 /** 35 * OUT: The VBox status code of the op 36 * This is a VINF_ or VERR_ value as d 37 */ 38 __s32 rc; 39 /** IN: Output size. Set to zero to us 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 51 * signifies incompatible changes. 52 * 53 * The lower word is the minor version number, 54 * functions are added or existing changed in 55 */ 56 #define VBG_IOC_VERSION 0x00010000u 57 58 /** 59 * VBG_IOCTL_DRIVER_VERSION_INFO data structur 60 * 61 * Note VBG_IOCTL_DRIVER_VERSION_INFO may swit 62 * compatible interface version if uClientVers 63 */ 64 struct vbg_ioctl_driver_version_info { 65 /** The header. */ 66 struct vbg_ioctl_hdr hdr; 67 union { 68 struct { 69 /** Requested interfac 70 __u32 req_version; 71 /** 72 * Minimum interface v 73 * major version part 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 s 83 __u32 session_version; 84 /** Version of the IDC 85 __u32 driver_version; 86 /** The SVN revision o 87 __u32 driver_revision; 88 /** Reserved \#1 (zero 89 __u32 reserved1; 90 /** Reserved \#2 (zero 91 __u32 reserved2; 92 } out; 93 } u; 94 }; 95 VMMDEV_ASSERT_SIZE(vbg_ioctl_driver_version_in 96 97 #define VBG_IOCTL_DRIVER_VERSION_INFO \ 98 _IOWR('V', 0, struct vbg_ioctl_driver_ 99 100 101 /* IOCTL to perform a VMM Device request less 102 #define VBG_IOCTL_VMMDEV_REQUEST(s) _IOC(_ 103 104 105 /* IOCTL to perform a VMM Device request large 106 #define VBG_IOCTL_VMMDEV_REQUEST_BIG _IO('V 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_ser 115 } in; 116 struct { 117 __u32 client_id; 118 } out; 119 } u; 120 }; 121 VMMDEV_ASSERT_SIZE(vbg_ioctl_hgcm_connect, 24 122 123 #define VBG_IOCTL_HGCM_CONNECT \ 124 _IOWR('V', 4, struct vbg_ioctl_hgcm_co 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, 137 138 #define VBG_IOCTL_HGCM_DISCONNECT \ 139 _IOWR('V', 5, struct vbg_ioctl_hgcm_di 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 (millisecon 152 * cancelling the call. Set to -1 to w 153 */ 154 __u32 timeout_ms; 155 /** Interruptable flag, ignored for us 156 __u8 interruptible; 157 /** Explicit padding, MBZ. */ 158 __u8 reserved; 159 /** 160 * Input: How many parameters followin 161 * 162 * The parameters are either HGCMFunct 163 * depending on whether we're receivin 164 * 165 * The current maximum is 61 parameter 166 * and a 64-bit parameter size of 16 b 167 */ 168 __u16 parm_count; 169 /* 170 * Parameters follow in form: 171 * struct hgcm_function_parameter<32|6 172 */ 173 }; 174 VMMDEV_ASSERT_SIZE(vbg_ioctl_hgcm_call, 24 + 1 175 176 #define VBG_IOCTL_HGCM_CALL_32(s) _IOC(_ 177 #define VBG_IOCTL_HGCM_CALL_64(s) _IOC(_ 178 #if __BITS_PER_LONG == 64 179 #define VBG_IOCTL_HGCM_CALL(s) VBG_IO 180 #else 181 #define VBG_IOCTL_HGCM_CALL(s) VBG_IO 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, th 193 * is not zero termina 194 * from the input size 195 */ 196 char msg[1]; 197 } in; 198 } u; 199 }; 200 201 #define VBG_IOCTL_LOG(s) _IO('V 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 millise 211 __u32 timeout_ms; 212 /** Events to wait for 213 __u32 events; 214 } in; 215 struct { 216 /** Events that occurr 217 __u32 events; 218 } out; 219 } u; 220 }; 221 VMMDEV_ASSERT_SIZE(vbg_ioctl_wait_for_events, 222 223 #define VBG_IOCTL_WAIT_FOR_EVENTS \ 224 _IOWR('V', 10, struct vbg_ioctl_wait_f 225 226 227 /* 228 * IOCTL to VBoxGuest to interrupt (cancel) an 229 * VBG_IOCTL_WAIT_FOR_EVENTS and return. 230 * 231 * Handled inside the vboxguest driver and not 232 * After calling this, VBG_IOCTL_WAIT_FOR_EVEN 233 * the same session. Any VBOXGUEST_IOCTL_WAITE 234 * done after calling this will directly exit 235 */ 236 #define VBG_IOCTL_INTERRUPT_ALL_WAIT_FOR_EVENT 237 _IOWR('V', 11, struct vbg_ioctl_hdr) 238 239 240 /** VBG_IOCTL_CHANGE_FILTER_MASK data structur 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 254 255 /* IOCTL to VBoxGuest to control the event fil 256 #define VBG_IOCTL_CHANGE_FILTER_MASK \ 257 _IOWR('V', 12, struct vbg_ioctl_change 258 259 260 /** VBG_IOCTL_ACQUIRE_GUEST_CAPABILITIES data 261 struct vbg_ioctl_acquire_guest_caps { 262 /** The header. */ 263 struct vbg_ioctl_hdr hdr; 264 union { 265 struct { 266 /** Flags (VBGL_IOC_AG 267 __u32 flags; 268 /** Capabilities to se 269 __u32 or_mask; 270 /** Capabilities to dr 271 __u32 not_mask; 272 } in; 273 } u; 274 }; 275 VMMDEV_ASSERT_SIZE(vbg_ioctl_acquire_guest_cap 276 277 #define VBGL_IOC_AGC_FLAGS_CONFIG_ACQUIRE_MODE 278 #define VBGL_IOC_AGC_FLAGS_VALID_MASK 279 280 #define VBG_IOCTL_ACQUIRE_GUEST_CAPABILITIES \ 281 _IOWR('V', 13, struct vbg_ioctl_acquir 282 283 284 /** VBG_IOCTL_CHANGE_GUEST_CAPABILITIES data s 285 struct vbg_ioctl_set_guest_caps { 286 /** The header. */ 287 struct vbg_ioctl_hdr hdr; 288 union { 289 struct { 290 /** Capabilities to se 291 __u32 or_mask; 292 /** Capabilities to dr 293 __u32 not_mask; 294 } in; 295 struct { 296 /** Capabilities held 297 __u32 session_caps; 298 /** Capabilities for a 299 __u32 global_caps; 300 } out; 301 } u; 302 }; 303 VMMDEV_ASSERT_SIZE(vbg_ioctl_set_guest_caps, 2 304 305 #define VBG_IOCTL_CHANGE_GUEST_CAPABILITIES \ 306 _IOWR('V', 14, struct vbg_ioctl_set_gu 307 308 309 /** VBG_IOCTL_CHECK_BALLOON data structure. */ 310 struct vbg_ioctl_check_balloon { 311 /** The header. */ 312 struct vbg_ioctl_hdr hdr; 313 union { 314 struct { 315 /** The size of the ba 316 __u32 balloon_chunks; 317 /** 318 * false = handled in 319 * true = allocate ba 320 */ 321 __u8 handle_in_r3; 322 /** Explicit padding, 323 __u8 padding[3]; 324 } out; 325 } u; 326 }; 327 VMMDEV_ASSERT_SIZE(vbg_ioctl_check_balloon, 24 328 329 /* 330 * IOCTL to check memory ballooning. 331 * 332 * The guest kernel module will ask the host f 333 * balloon and adjust the size. Or it will set 334 * responsible for allocating memory and calli 335 */ 336 #define VBG_IOCTL_CHECK_BALLOON \ 337 _IOWR('V', 17, struct vbg_ioctl_check_ 338 339 340 /** VBG_IOCTL_WRITE_CORE_DUMP data structure. 341 struct vbg_ioctl_write_coredump { 342 struct vbg_ioctl_hdr hdr; 343 union { 344 struct { 345 __u32 flags; /** Flags 346 } in; 347 } u; 348 }; 349 VMMDEV_ASSERT_SIZE(vbg_ioctl_write_coredump, 2 350 351 #define VBG_IOCTL_WRITE_CORE_DUMP \ 352 _IOWR('V', 19, struct vbg_ioctl_write_ 353 354 #endif 355
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.