]> git.ipfire.org Git - thirdparty/linux.git/blame - include/uapi/linux/vbox_vmmdev_types.h
virt: vbox: Implement passing requestor info to the host for VirtualBox 6.0.x
[thirdparty/linux.git] / include / uapi / linux / vbox_vmmdev_types.h
CommitLineData
f6ddd094
HG
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. */
23enum 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
0532a1b0
HG
105/* vmmdev_request_header.requestor defines */
106
107/* Requestor user not given. */
108#define VMMDEV_REQUESTOR_USR_NOT_GIVEN 0x00000000
109/* The kernel driver (vboxguest) is the requestor. */
110#define VMMDEV_REQUESTOR_USR_DRV 0x00000001
111/* Some other kernel driver is the requestor. */
112#define VMMDEV_REQUESTOR_USR_DRV_OTHER 0x00000002
113/* The root or a admin user is the requestor. */
114#define VMMDEV_REQUESTOR_USR_ROOT 0x00000003
115/* Regular joe user is making the request. */
116#define VMMDEV_REQUESTOR_USR_USER 0x00000006
117/* User classification mask. */
118#define VMMDEV_REQUESTOR_USR_MASK 0x00000007
119
120/* Kernel mode request. Note this is 0, check for !USERMODE instead. */
121#define VMMDEV_REQUESTOR_KERNEL 0x00000000
122/* User mode request. */
123#define VMMDEV_REQUESTOR_USERMODE 0x00000008
124/* User or kernel mode classification mask. */
125#define VMMDEV_REQUESTOR_MODE_MASK 0x00000008
126
127/* Don't know the physical console association of the requestor. */
128#define VMMDEV_REQUESTOR_CON_DONT_KNOW 0x00000000
129/*
130 * The request originates with a process that is NOT associated with the
131 * physical console.
132 */
133#define VMMDEV_REQUESTOR_CON_NO 0x00000010
134/* Requestor process is associated with the physical console. */
135#define VMMDEV_REQUESTOR_CON_YES 0x00000020
136/* Console classification mask. */
137#define VMMDEV_REQUESTOR_CON_MASK 0x00000030
138
139/* Requestor is member of special VirtualBox user group. */
140#define VMMDEV_REQUESTOR_GRP_VBOX 0x00000080
141
142/* Note: trust level is for windows guests only, linux always uses not-given */
143/* Requestor trust level: Unspecified */
144#define VMMDEV_REQUESTOR_TRUST_NOT_GIVEN 0x00000000
145/* Requestor trust level: Untrusted (SID S-1-16-0) */
146#define VMMDEV_REQUESTOR_TRUST_UNTRUSTED 0x00001000
147/* Requestor trust level: Untrusted (SID S-1-16-4096) */
148#define VMMDEV_REQUESTOR_TRUST_LOW 0x00002000
149/* Requestor trust level: Medium (SID S-1-16-8192) */
150#define VMMDEV_REQUESTOR_TRUST_MEDIUM 0x00003000
151/* Requestor trust level: Medium plus (SID S-1-16-8448) */
152#define VMMDEV_REQUESTOR_TRUST_MEDIUM_PLUS 0x00004000
153/* Requestor trust level: High (SID S-1-16-12288) */
154#define VMMDEV_REQUESTOR_TRUST_HIGH 0x00005000
155/* Requestor trust level: System (SID S-1-16-16384) */
156#define VMMDEV_REQUESTOR_TRUST_SYSTEM 0x00006000
157/* Requestor trust level >= Protected (SID S-1-16-20480, S-1-16-28672) */
158#define VMMDEV_REQUESTOR_TRUST_PROTECTED 0x00007000
159/* Requestor trust level mask */
160#define VMMDEV_REQUESTOR_TRUST_MASK 0x00007000
161
162/* Requestor is using the less trusted user device node (/dev/vboxuser) */
163#define VMMDEV_REQUESTOR_USER_DEVICE 0x00008000
164
f6ddd094
HG
165/** HGCM service location types. */
166enum vmmdev_hgcm_service_location_type {
167 VMMDEV_HGCM_LOC_INVALID = 0,
168 VMMDEV_HGCM_LOC_LOCALHOST = 1,
169 VMMDEV_HGCM_LOC_LOCALHOST_EXISTING = 2,
170 /* Ensure the enum is a 32 bit data-type */
171 VMMDEV_HGCM_LOC_SIZEHACK = 0x7fffffff
172};
173
174/** HGCM host service location. */
175struct vmmdev_hgcm_service_location_localhost {
176 /** Service name */
177 char service_name[128];
178};
179VMMDEV_ASSERT_SIZE(vmmdev_hgcm_service_location_localhost, 128);
180
181/** HGCM service location. */
182struct vmmdev_hgcm_service_location {
183 /** Type of the location. */
184 enum vmmdev_hgcm_service_location_type type;
185
186 union {
187 struct vmmdev_hgcm_service_location_localhost localhost;
188 } u;
189};
190VMMDEV_ASSERT_SIZE(vmmdev_hgcm_service_location, 128 + 4);
191
192/** HGCM function parameter type. */
193enum vmmdev_hgcm_function_parameter_type {
194 VMMDEV_HGCM_PARM_TYPE_INVALID = 0,
195 VMMDEV_HGCM_PARM_TYPE_32BIT = 1,
196 VMMDEV_HGCM_PARM_TYPE_64BIT = 2,
197 /** Deprecated Doesn't work, use PAGELIST. */
198 VMMDEV_HGCM_PARM_TYPE_PHYSADDR = 3,
199 /** In and Out, user-memory */
200 VMMDEV_HGCM_PARM_TYPE_LINADDR = 4,
201 /** In, user-memory (read; host<-guest) */
202 VMMDEV_HGCM_PARM_TYPE_LINADDR_IN = 5,
203 /** Out, user-memory (write; host->guest) */
204 VMMDEV_HGCM_PARM_TYPE_LINADDR_OUT = 6,
205 /** In and Out, kernel-memory */
206 VMMDEV_HGCM_PARM_TYPE_LINADDR_KERNEL = 7,
207 /** In, kernel-memory (read; host<-guest) */
208 VMMDEV_HGCM_PARM_TYPE_LINADDR_KERNEL_IN = 8,
209 /** Out, kernel-memory (write; host->guest) */
210 VMMDEV_HGCM_PARM_TYPE_LINADDR_KERNEL_OUT = 9,
211 /** Physical addresses of locked pages for a buffer. */
212 VMMDEV_HGCM_PARM_TYPE_PAGELIST = 10,
213 /* Ensure the enum is a 32 bit data-type */
214 VMMDEV_HGCM_PARM_TYPE_SIZEHACK = 0x7fffffff
215};
216
217/** HGCM function parameter, 32-bit client. */
218struct vmmdev_hgcm_function_parameter32 {
219 enum vmmdev_hgcm_function_parameter_type type;
220 union {
221 __u32 value32;
222 __u64 value64;
223 struct {
224 __u32 size;
225 union {
226 __u32 phys_addr;
227 __u32 linear_addr;
228 } u;
229 } pointer;
230 struct {
231 /** Size of the buffer described by the page list. */
232 __u32 size;
233 /** Relative to the request header. */
234 __u32 offset;
235 } page_list;
236 } u;
237} __packed;
238VMMDEV_ASSERT_SIZE(vmmdev_hgcm_function_parameter32, 4 + 8);
239
240/** HGCM function parameter, 64-bit client. */
241struct vmmdev_hgcm_function_parameter64 {
242 enum vmmdev_hgcm_function_parameter_type type;
243 union {
244 __u32 value32;
245 __u64 value64;
246 struct {
247 __u32 size;
248 union {
249 __u64 phys_addr;
250 __u64 linear_addr;
251 } u;
252 } __packed pointer;
253 struct {
254 /** Size of the buffer described by the page list. */
255 __u32 size;
256 /** Relative to the request header. */
257 __u32 offset;
258 } page_list;
259 } __packed u;
260} __packed;
261VMMDEV_ASSERT_SIZE(vmmdev_hgcm_function_parameter64, 4 + 12);
262
263#if __BITS_PER_LONG == 64
264#define vmmdev_hgcm_function_parameter vmmdev_hgcm_function_parameter64
265#else
266#define vmmdev_hgcm_function_parameter vmmdev_hgcm_function_parameter32
267#endif
268
269#define VMMDEV_HGCM_F_PARM_DIRECTION_NONE 0x00000000U
270#define VMMDEV_HGCM_F_PARM_DIRECTION_TO_HOST 0x00000001U
271#define VMMDEV_HGCM_F_PARM_DIRECTION_FROM_HOST 0x00000002U
272#define VMMDEV_HGCM_F_PARM_DIRECTION_BOTH 0x00000003U
273
274/**
275 * struct vmmdev_hgcm_pagelist - VMMDEV_HGCM_PARM_TYPE_PAGELIST parameters
276 * point to this structure to actually describe the buffer.
277 */
278struct vmmdev_hgcm_pagelist {
279 __u32 flags; /** VMMDEV_HGCM_F_PARM_*. */
280 __u16 offset_first_page; /** Data offset in the first page. */
281 __u16 page_count; /** Number of pages. */
282 __u64 pages[1]; /** Page addresses. */
283};
284VMMDEV_ASSERT_SIZE(vmmdev_hgcm_pagelist, 4 + 2 + 2 + 8);
285
286#endif