cpp-d1064d
[cross.git] / i686-linux-gnu-4.7 / usr / include / 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 } __attribute__((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                 } __attribute__((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         } __attribute__((packed)) u;
200 } __attribute__((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