logo

oasis-root

Compiled tree of Oasis Linux based on own branch at <https://hacktivis.me/git/oasis/> git clone https://anongit.hacktivis.me/git/oasis-root.git

vbox_vmmdev_types.h (11748B)


  1. /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) 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. #ifndef __UAPI_VBOX_VMMDEV_TYPES_H__
  9. #define __UAPI_VBOX_VMMDEV_TYPES_H__
  10. #include <asm/bitsperlong.h>
  11. #include <linux/types.h>
  12. /*
  13. * We cannot use linux' compiletime_assert here because it expects to be used
  14. * inside a function only. Use a typedef to a char array with a negative size.
  15. */
  16. #define VMMDEV_ASSERT_SIZE(type, size) \
  17. typedef char type ## _asrt_size[1 - 2*!!(sizeof(struct type) != (size))]
  18. /** enum vmmdev_request_type - VMMDev request types. */
  19. enum vmmdev_request_type {
  20. VMMDEVREQ_INVALID_REQUEST = 0,
  21. VMMDEVREQ_GET_MOUSE_STATUS = 1,
  22. VMMDEVREQ_SET_MOUSE_STATUS = 2,
  23. VMMDEVREQ_SET_POINTER_SHAPE = 3,
  24. VMMDEVREQ_GET_HOST_VERSION = 4,
  25. VMMDEVREQ_IDLE = 5,
  26. VMMDEVREQ_GET_HOST_TIME = 10,
  27. VMMDEVREQ_GET_HYPERVISOR_INFO = 20,
  28. VMMDEVREQ_SET_HYPERVISOR_INFO = 21,
  29. VMMDEVREQ_REGISTER_PATCH_MEMORY = 22, /* since version 3.0.6 */
  30. VMMDEVREQ_DEREGISTER_PATCH_MEMORY = 23, /* since version 3.0.6 */
  31. VMMDEVREQ_SET_POWER_STATUS = 30,
  32. VMMDEVREQ_ACKNOWLEDGE_EVENTS = 41,
  33. VMMDEVREQ_CTL_GUEST_FILTER_MASK = 42,
  34. VMMDEVREQ_REPORT_GUEST_INFO = 50,
  35. VMMDEVREQ_REPORT_GUEST_INFO2 = 58, /* since version 3.2.0 */
  36. VMMDEVREQ_REPORT_GUEST_STATUS = 59, /* since version 3.2.8 */
  37. VMMDEVREQ_REPORT_GUEST_USER_STATE = 74, /* since version 4.3 */
  38. /* Retrieve a display resize request sent by the host, deprecated. */
  39. VMMDEVREQ_GET_DISPLAY_CHANGE_REQ = 51,
  40. VMMDEVREQ_VIDEMODE_SUPPORTED = 52,
  41. VMMDEVREQ_GET_HEIGHT_REDUCTION = 53,
  42. /**
  43. * @VMMDEVREQ_GET_DISPLAY_CHANGE_REQ2:
  44. * Retrieve a display resize request sent by the host.
  45. *
  46. * Queries a display resize request sent from the host. If the
  47. * event_ack member is sent to true and there is an unqueried request
  48. * available for one of the virtual display then that request will
  49. * be returned. If several displays have unqueried requests the lowest
  50. * numbered display will be chosen first. Only the most recent unseen
  51. * request for each display is remembered.
  52. * If event_ack is set to false, the last host request queried with
  53. * event_ack set is resent, or failing that the most recent received
  54. * from the host. If no host request was ever received then all zeros
  55. * are returned.
  56. */
  57. VMMDEVREQ_GET_DISPLAY_CHANGE_REQ2 = 54,
  58. VMMDEVREQ_REPORT_GUEST_CAPABILITIES = 55,
  59. VMMDEVREQ_SET_GUEST_CAPABILITIES = 56,
  60. VMMDEVREQ_VIDEMODE_SUPPORTED2 = 57, /* since version 3.2.0 */
  61. VMMDEVREQ_GET_DISPLAY_CHANGE_REQEX = 80, /* since version 4.2.4 */
  62. VMMDEVREQ_GET_DISPLAY_CHANGE_REQ_MULTI = 81,
  63. VMMDEVREQ_HGCM_CONNECT = 60,
  64. VMMDEVREQ_HGCM_DISCONNECT = 61,
  65. VMMDEVREQ_HGCM_CALL32 = 62,
  66. VMMDEVREQ_HGCM_CALL64 = 63,
  67. VMMDEVREQ_HGCM_CANCEL = 64,
  68. VMMDEVREQ_HGCM_CANCEL2 = 65,
  69. VMMDEVREQ_VIDEO_ACCEL_ENABLE = 70,
  70. VMMDEVREQ_VIDEO_ACCEL_FLUSH = 71,
  71. VMMDEVREQ_VIDEO_SET_VISIBLE_REGION = 72,
  72. VMMDEVREQ_GET_SEAMLESS_CHANGE_REQ = 73,
  73. VMMDEVREQ_QUERY_CREDENTIALS = 100,
  74. VMMDEVREQ_REPORT_CREDENTIALS_JUDGEMENT = 101,
  75. VMMDEVREQ_REPORT_GUEST_STATS = 110,
  76. VMMDEVREQ_GET_MEMBALLOON_CHANGE_REQ = 111,
  77. VMMDEVREQ_GET_STATISTICS_CHANGE_REQ = 112,
  78. VMMDEVREQ_CHANGE_MEMBALLOON = 113,
  79. VMMDEVREQ_GET_VRDPCHANGE_REQ = 150,
  80. VMMDEVREQ_LOG_STRING = 200,
  81. VMMDEVREQ_GET_CPU_HOTPLUG_REQ = 210,
  82. VMMDEVREQ_SET_CPU_HOTPLUG_STATUS = 211,
  83. VMMDEVREQ_REGISTER_SHARED_MODULE = 212,
  84. VMMDEVREQ_UNREGISTER_SHARED_MODULE = 213,
  85. VMMDEVREQ_CHECK_SHARED_MODULES = 214,
  86. VMMDEVREQ_GET_PAGE_SHARING_STATUS = 215,
  87. VMMDEVREQ_DEBUG_IS_PAGE_SHARED = 216,
  88. VMMDEVREQ_GET_SESSION_ID = 217, /* since version 3.2.8 */
  89. VMMDEVREQ_WRITE_COREDUMP = 218,
  90. VMMDEVREQ_GUEST_HEARTBEAT = 219,
  91. VMMDEVREQ_HEARTBEAT_CONFIGURE = 220,
  92. VMMDEVREQ_NT_BUG_CHECK = 221,
  93. VMMDEVREQ_VIDEO_UPDATE_MONITOR_POSITIONS = 222,
  94. /* Ensure the enum is a 32 bit data-type */
  95. VMMDEVREQ_SIZEHACK = 0x7fffffff
  96. };
  97. #if __BITS_PER_LONG == 64
  98. #define VMMDEVREQ_HGCM_CALL VMMDEVREQ_HGCM_CALL64
  99. #else
  100. #define VMMDEVREQ_HGCM_CALL VMMDEVREQ_HGCM_CALL32
  101. #endif
  102. /* vmmdev_request_header.requestor defines */
  103. /* Requestor user not given. */
  104. #define VMMDEV_REQUESTOR_USR_NOT_GIVEN 0x00000000
  105. /* The kernel driver (vboxguest) is the requestor. */
  106. #define VMMDEV_REQUESTOR_USR_DRV 0x00000001
  107. /* Some other kernel driver is the requestor. */
  108. #define VMMDEV_REQUESTOR_USR_DRV_OTHER 0x00000002
  109. /* The root or a admin user is the requestor. */
  110. #define VMMDEV_REQUESTOR_USR_ROOT 0x00000003
  111. /* Regular joe user is making the request. */
  112. #define VMMDEV_REQUESTOR_USR_USER 0x00000006
  113. /* User classification mask. */
  114. #define VMMDEV_REQUESTOR_USR_MASK 0x00000007
  115. /* Kernel mode request. Note this is 0, check for !USERMODE instead. */
  116. #define VMMDEV_REQUESTOR_KERNEL 0x00000000
  117. /* User mode request. */
  118. #define VMMDEV_REQUESTOR_USERMODE 0x00000008
  119. /* User or kernel mode classification mask. */
  120. #define VMMDEV_REQUESTOR_MODE_MASK 0x00000008
  121. /* Don't know the physical console association of the requestor. */
  122. #define VMMDEV_REQUESTOR_CON_DONT_KNOW 0x00000000
  123. /*
  124. * The request originates with a process that is NOT associated with the
  125. * physical console.
  126. */
  127. #define VMMDEV_REQUESTOR_CON_NO 0x00000010
  128. /* Requestor process is associated with the physical console. */
  129. #define VMMDEV_REQUESTOR_CON_YES 0x00000020
  130. /* Console classification mask. */
  131. #define VMMDEV_REQUESTOR_CON_MASK 0x00000030
  132. /* Requestor is member of special VirtualBox user group. */
  133. #define VMMDEV_REQUESTOR_GRP_VBOX 0x00000080
  134. /* Note: trust level is for windows guests only, linux always uses not-given */
  135. /* Requestor trust level: Unspecified */
  136. #define VMMDEV_REQUESTOR_TRUST_NOT_GIVEN 0x00000000
  137. /* Requestor trust level: Untrusted (SID S-1-16-0) */
  138. #define VMMDEV_REQUESTOR_TRUST_UNTRUSTED 0x00001000
  139. /* Requestor trust level: Untrusted (SID S-1-16-4096) */
  140. #define VMMDEV_REQUESTOR_TRUST_LOW 0x00002000
  141. /* Requestor trust level: Medium (SID S-1-16-8192) */
  142. #define VMMDEV_REQUESTOR_TRUST_MEDIUM 0x00003000
  143. /* Requestor trust level: Medium plus (SID S-1-16-8448) */
  144. #define VMMDEV_REQUESTOR_TRUST_MEDIUM_PLUS 0x00004000
  145. /* Requestor trust level: High (SID S-1-16-12288) */
  146. #define VMMDEV_REQUESTOR_TRUST_HIGH 0x00005000
  147. /* Requestor trust level: System (SID S-1-16-16384) */
  148. #define VMMDEV_REQUESTOR_TRUST_SYSTEM 0x00006000
  149. /* Requestor trust level >= Protected (SID S-1-16-20480, S-1-16-28672) */
  150. #define VMMDEV_REQUESTOR_TRUST_PROTECTED 0x00007000
  151. /* Requestor trust level mask */
  152. #define VMMDEV_REQUESTOR_TRUST_MASK 0x00007000
  153. /* Requestor is using the less trusted user device node (/dev/vboxuser) */
  154. #define VMMDEV_REQUESTOR_USER_DEVICE 0x00008000
  155. /** HGCM service location types. */
  156. enum vmmdev_hgcm_service_location_type {
  157. VMMDEV_HGCM_LOC_INVALID = 0,
  158. VMMDEV_HGCM_LOC_LOCALHOST = 1,
  159. VMMDEV_HGCM_LOC_LOCALHOST_EXISTING = 2,
  160. /* Ensure the enum is a 32 bit data-type */
  161. VMMDEV_HGCM_LOC_SIZEHACK = 0x7fffffff
  162. };
  163. /** HGCM host service location. */
  164. struct vmmdev_hgcm_service_location_localhost {
  165. /** Service name */
  166. char service_name[128];
  167. };
  168. VMMDEV_ASSERT_SIZE(vmmdev_hgcm_service_location_localhost, 128);
  169. /** HGCM service location. */
  170. struct vmmdev_hgcm_service_location {
  171. /** Type of the location. */
  172. enum vmmdev_hgcm_service_location_type type;
  173. union {
  174. struct vmmdev_hgcm_service_location_localhost localhost;
  175. } u;
  176. };
  177. VMMDEV_ASSERT_SIZE(vmmdev_hgcm_service_location, 128 + 4);
  178. /** HGCM function parameter type. */
  179. enum vmmdev_hgcm_function_parameter_type {
  180. VMMDEV_HGCM_PARM_TYPE_INVALID = 0,
  181. VMMDEV_HGCM_PARM_TYPE_32BIT = 1,
  182. VMMDEV_HGCM_PARM_TYPE_64BIT = 2,
  183. /** Deprecated Doesn't work, use PAGELIST. */
  184. VMMDEV_HGCM_PARM_TYPE_PHYSADDR = 3,
  185. /** In and Out, user-memory */
  186. VMMDEV_HGCM_PARM_TYPE_LINADDR = 4,
  187. /** In, user-memory (read; host<-guest) */
  188. VMMDEV_HGCM_PARM_TYPE_LINADDR_IN = 5,
  189. /** Out, user-memory (write; host->guest) */
  190. VMMDEV_HGCM_PARM_TYPE_LINADDR_OUT = 6,
  191. /** In and Out, kernel-memory */
  192. VMMDEV_HGCM_PARM_TYPE_LINADDR_KERNEL = 7,
  193. /** In, kernel-memory (read; host<-guest) */
  194. VMMDEV_HGCM_PARM_TYPE_LINADDR_KERNEL_IN = 8,
  195. /** Out, kernel-memory (write; host->guest) */
  196. VMMDEV_HGCM_PARM_TYPE_LINADDR_KERNEL_OUT = 9,
  197. /** Physical addresses of locked pages for a buffer. */
  198. VMMDEV_HGCM_PARM_TYPE_PAGELIST = 10,
  199. /* Ensure the enum is a 32 bit data-type */
  200. VMMDEV_HGCM_PARM_TYPE_SIZEHACK = 0x7fffffff
  201. };
  202. /** HGCM function parameter, 32-bit client. */
  203. struct vmmdev_hgcm_function_parameter32 {
  204. enum vmmdev_hgcm_function_parameter_type type;
  205. union {
  206. __u32 value32;
  207. __u64 value64;
  208. struct {
  209. __u32 size;
  210. union {
  211. __u32 phys_addr;
  212. __u32 linear_addr;
  213. } u;
  214. } pointer;
  215. struct {
  216. /** Size of the buffer described by the page list. */
  217. __u32 size;
  218. /** Relative to the request header. */
  219. __u32 offset;
  220. } page_list;
  221. } u;
  222. } __attribute__((packed));
  223. VMMDEV_ASSERT_SIZE(vmmdev_hgcm_function_parameter32, 4 + 8);
  224. /** HGCM function parameter, 64-bit client. */
  225. struct vmmdev_hgcm_function_parameter64 {
  226. enum vmmdev_hgcm_function_parameter_type type;
  227. union {
  228. __u32 value32;
  229. __u64 value64;
  230. struct {
  231. __u32 size;
  232. union {
  233. __u64 phys_addr;
  234. __u64 linear_addr;
  235. } u;
  236. } __attribute__((packed)) pointer;
  237. struct {
  238. /** Size of the buffer described by the page list. */
  239. __u32 size;
  240. /** Relative to the request header. */
  241. __u32 offset;
  242. } page_list;
  243. } __attribute__((packed)) u;
  244. } __attribute__((packed));
  245. VMMDEV_ASSERT_SIZE(vmmdev_hgcm_function_parameter64, 4 + 12);
  246. #if __BITS_PER_LONG == 64
  247. #define vmmdev_hgcm_function_parameter vmmdev_hgcm_function_parameter64
  248. #else
  249. #define vmmdev_hgcm_function_parameter vmmdev_hgcm_function_parameter32
  250. #endif
  251. #define VMMDEV_HGCM_F_PARM_DIRECTION_NONE 0x00000000U
  252. #define VMMDEV_HGCM_F_PARM_DIRECTION_TO_HOST 0x00000001U
  253. #define VMMDEV_HGCM_F_PARM_DIRECTION_FROM_HOST 0x00000002U
  254. #define VMMDEV_HGCM_F_PARM_DIRECTION_BOTH 0x00000003U
  255. /**
  256. * struct vmmdev_hgcm_pagelist - VMMDEV_HGCM_PARM_TYPE_PAGELIST parameters
  257. * point to this structure to actually describe the buffer.
  258. */
  259. struct vmmdev_hgcm_pagelist {
  260. __u32 flags; /** VMMDEV_HGCM_F_PARM_*. */
  261. __u16 offset_first_page; /** Data offset in the first page. */
  262. __u16 page_count; /** Number of pages. */
  263. union {
  264. __u64 unused; /** Deprecated place-holder for first "pages" entry. */
  265. __DECLARE_FLEX_ARRAY(__u64, pages); /** Page addresses. */
  266. };
  267. };
  268. VMMDEV_ASSERT_SIZE(vmmdev_hgcm_pagelist, 4 + 2 + 2 + 8);
  269. #endif