1 /*
2  * Hypercall interface description:
3  * Used by scripts/gen_hypercall.awk to generate hypercall prototypes and call
4  * sequences.
5  *
6  * Syntax is like a prototype, but without return type and without the ";" at
7  * the end. Pointer types will be automatically converted to use the
8  * XEN_GUEST_HANDLE_PARAM() macro. Handlers with no parameters just use a
9  * definition like "fn()".
10  * Hypercall/function names are without the leading "__HYPERVISOR_"/"do_"
11  * strings.
12  *
13  * The return type of a class of prototypes using the same prefix is set via:
14  * rettype: <prefix> <type>
15  * Default return type is "long". A return type for a prefix can be set only
16  * once and it needs to be set before that prefix is being used via the
17  * "prefix:" directive.
18  *
19  * The prefix of the prototypes is set via a line:
20  * prefix: <prefix> ...
21  * Multiple prefixes are possible (restriction see below). Prefixes are without
22  * a trailing "_". The current prefix settings are active until a new "prefix:"
23  * line.
24  *
25  * Caller macros are suffixed with a selectable name via lines like:
26  * caller: <suffix>
27  * When a caller suffix is active, there is only one active prefix allowed.
28  *
29  * With a "defhandle:" line it is possible to add a DEFINE_XEN_GUEST_HANDLE()
30  * to the generated header:
31  * defhandle: <handle-type> [<type>]
32  * Without specifying <type> only a DEFINE_XEN_GUEST_HANDLE(<handle-type>)
33  * will be generated, otherwise it will be a
34  * __DEFINE_XEN_GUEST_HANDLE(<handle-type>, <type>) being generated. Note that
35  * the latter will include the related "const" handle "const_<handle-type>".
36  *
37  * In order to support using coding style compliant pointers in the
38  * prototypes it is possible to add translation entries to generate the correct
39  * handle types:
40  * handle: <handle-type> <type>
41  * This will result in the prototype translation from "<type> *" to
42  * "XEN_GUEST_HANDLE_PARAM(<handle-type>)".
43  *
44  * The hypercall handler calling code will be generated from a final table in
45  * the source file, which is started via the line:
46  * table: <caller> <caller> ...
47  * with the <caller>s specifying the designated caller macro of each column of
48  * the table. Any column of a <caller> not having been set via a "caller:"
49  * line will be ignored.
50  * The first column of the table contains the hypercall/prototype, each
51  * <caller> column contains the prefix for the function to use for that caller.
52  * A function prefix can be annotated with a priority by adding ":<prio>" to it
53  * ("1" being the highest priority, higher numbers mean lower priority, no
54  * priority specified is the lowest priority). The generated code will try to
55  * achieve better performance for calling high priority handlers.
56  * A column not being supported by a <caller> is marked with "-". Lines with all
57  * entries being "-" after removal of inactive <caller> columns are ignored.
58  *
59  * This file is being preprocessed using $(CPP), so #ifdef CONFIG_* conditionals
60  * are possible.
61  */
62 
63 /*
64  * Cppcheck thinks this file needs to be analysed because it is preprocessed by
65  * the compiler, but it gets confused because this file does not contains C
66  * code. Hence protect the code when CPPCHECK is used.
67  */
68 #ifndef CPPCHECK
69 
70 #ifdef CONFIG_HVM
71 #define PREFIX_hvm hvm
72 #else
73 #define PREFIX_hvm
74 #endif
75 
76 #ifdef CONFIG_COMPAT
77 #define PREFIX_compat compat
78 rettype: compat int
79 #else
80 #define PREFIX_compat
81 #endif
82 
83 #ifdef CONFIG_ARM
84 #define PREFIX_dep dep
85 #define PREFIX_do_arm do_arm
86 rettype: do_arm int
87 #else
88 #define PREFIX_dep
89 #define PREFIX_do_arm
90 #endif
91 
92 handle: uint unsigned int
93 handle: const_void const void
94 handle: const_char const char
95 
96 #ifdef CONFIG_COMPAT
97 defhandle: multicall_entry_compat_t
98 #ifndef CONFIG_PV_SHIM_EXCLUSIVE
99 defhandle: compat_platform_op_t
100 #endif
101 #endif
102 #ifdef CONFIG_PV32
103 defhandle: trap_info_compat_t
104 defhandle: physdev_op_compat_t
105 #endif
106 
107 prefix: do PREFIX_hvm PREFIX_compat PREFIX_do_arm
108 physdev_op(int cmd, void *arg)
109 
110 prefix: do PREFIX_hvm PREFIX_compat
111 #if defined(CONFIG_GRANT_TABLE) || defined(CONFIG_PV_SHIM)
112 grant_table_op(unsigned int cmd, void *uop, unsigned int count)
113 #endif
114 
115 prefix: do PREFIX_hvm
116 memory_op(unsigned long cmd, void *arg)
117 
118 prefix: do PREFIX_compat
119 xen_version(int cmd, void *arg)
120 vcpu_op(int cmd, unsigned int vcpuid, void *arg)
121 sched_op(int cmd, void *arg)
122 xsm_op(void *op)
123 callback_op(int cmd, const void *arg)
124 #ifdef CONFIG_ARGO
125 argo_op(unsigned int cmd, void *arg1, void *arg2, unsigned long arg3, unsigned long arg4)
126 #endif
127 #ifdef CONFIG_PV
128 iret()
129 nmi_op(unsigned int cmd, void *arg)
130 #ifdef CONFIG_XENOPROF
131 xenoprof_op(int op, void *arg)
132 #endif
133 #endif /* CONFIG_PV */
134 
135 #ifdef CONFIG_COMPAT
136 prefix: compat
137 set_timer_op(uint32_t lo, uint32_t hi)
138 multicall(multicall_entry_compat_t *call_list, uint32_t nr_calls)
139 memory_op(unsigned int cmd, void *arg)
140 #ifdef CONFIG_IOREQ_SERVER
141 dm_op(domid_t domid, unsigned int nr_bufs, void *bufs)
142 #endif
143 mmuext_op(void *arg, unsigned int count, uint *pdone, unsigned int foreigndom)
144 #ifdef CONFIG_PV32
145 set_trap_table(trap_info_compat_t *traps)
146 set_gdt(unsigned int *frame_list, unsigned int entries)
147 set_callbacks(unsigned long event_selector, unsigned long event_address, unsigned long failsafe_selector, unsigned long failsafe_address)
148 update_descriptor(uint32_t pa_lo, uint32_t pa_hi, uint32_t desc_lo, uint32_t desc_hi)
149 update_va_mapping(unsigned int va, uint32_t lo, uint32_t hi, unsigned int flags)
150 physdev_op_compat(physdev_op_compat_t *uop)
151 update_va_mapping_otherdomain(unsigned int va, uint32_t lo, uint32_t hi, unsigned int flags, domid_t domid)
152 #endif
153 #ifndef CONFIG_PV_SHIM_EXCLUSIVE
154 platform_op(compat_platform_op_t *u_xenpf_op)
155 #endif
156 #ifdef CONFIG_KEXEC
157 kexec_op(unsigned int op, void *uarg)
158 #endif
159 #endif /* CONFIG_COMPAT */
160 
161 #if defined(CONFIG_PV) || defined(CONFIG_ARM)
162 prefix: do PREFIX_dep
163 event_channel_op_compat(evtchn_op_t *uop)
164 physdev_op_compat(physdev_op_t *uop)
165 /* Legacy hypercall (as of 0x00030101). */
166 sched_op_compat(int cmd, unsigned long arg)
167 #endif
168 
169 prefix: do
170 set_timer_op(s_time_t timeout)
171 console_io(unsigned int cmd, unsigned int count, char *buffer)
172 vm_assist(unsigned int cmd, unsigned int type)
173 event_channel_op(int cmd, void *arg)
174 mmuext_op(mmuext_op_t *uops, unsigned int count, unsigned int *pdone, unsigned int foreigndom)
175 multicall(multicall_entry_t *call_list, unsigned int nr_calls)
176 #ifdef CONFIG_PV
177 mmu_update(mmu_update_t *ureqs, unsigned int count, unsigned int *pdone, unsigned int foreigndom)
178 stack_switch(unsigned long ss, unsigned long esp)
179 fpu_taskswitch(int set)
180 set_debugreg(int reg, unsigned long value)
181 get_debugreg(int reg)
182 set_segment_base(unsigned int which, unsigned long base)
183 mca(xen_mc_t *u_xen_mc)
184 set_trap_table(const_trap_info_t *traps)
185 set_gdt(xen_ulong_t *frame_list, unsigned int entries)
186 set_callbacks(unsigned long event_address, unsigned long failsafe_address, unsigned long syscall_address)
187 update_descriptor(uint64_t gaddr, seg_desc_t desc)
188 update_va_mapping(unsigned long va, uint64_t val64, unsigned long flags)
189 update_va_mapping_otherdomain(unsigned long va, uint64_t val64, unsigned long flags, domid_t domid)
190 #endif
191 #ifdef CONFIG_KEXEC
192 kexec_op(unsigned long op, void *uarg)
193 #endif
194 #ifdef CONFIG_IOREQ_SERVER
195 dm_op(domid_t domid, unsigned int nr_bufs, xen_dm_op_buf_t *bufs)
196 #endif
197 #ifndef CONFIG_PV_SHIM_EXCLUSIVE
198 sysctl(xen_sysctl_t *u_sysctl)
199 domctl(xen_domctl_t *u_domctl)
200 paging_domctl_cont(xen_domctl_t *u_domctl)
201 platform_op(xen_platform_op_t *u_xenpf_op)
202 #endif
203 #ifdef CONFIG_HVM
204 hvm_op(unsigned long op, void *arg)
205 #endif
206 #ifdef CONFIG_HYPFS
207 hypfs_op(unsigned int cmd, const char *arg1, unsigned long arg2, void *arg3, unsigned long arg4)
208 #endif
209 #ifdef CONFIG_X86
210 xenpmu_op(unsigned int op, xen_pmu_params_t *arg)
211 #endif
212 
213 #ifdef CONFIG_PV
214 caller: pv64
215 #ifdef CONFIG_PV32
216 caller: pv32
217 #endif
218 #endif
219 #if defined(CONFIG_HVM) && defined(CONFIG_X86)
220 caller: hvm64
221 #ifdef CONFIG_COMPAT
222 caller: hvm32
223 #endif
224 #endif
225 #ifdef CONFIG_ARM
226 caller: arm
227 #endif
228 
229 table:                             pv32     pv64     hvm32    hvm64    arm
230 set_trap_table                     compat   do       -        -        -
231 mmu_update                         do:1     do:1     -        -        -
232 set_gdt                            compat   do       -        -        -
233 stack_switch                       do:2     do:2     -        -        -
234 set_callbacks                      compat   do       -        -        -
235 fpu_taskswitch                     do       do       -        -        -
236 sched_op_compat                    do       do       -        -        dep
237 #ifndef CONFIG_PV_SHIM_EXCLUSIVE
238 platform_op                        compat   do       compat   do       do
239 #endif
240 set_debugreg                       do       do       -        -        -
241 get_debugreg                       do       do       -        -        -
242 update_descriptor                  compat   do       -        -        -
243 memory_op                          compat   do       hvm      hvm      do
244 multicall                          compat:2 do:2     compat   do       do
245 update_va_mapping                  compat   do       -        -        -
246 set_timer_op                       compat   do       compat   do       -
247 event_channel_op_compat            do       do       -        -        dep
248 xen_version                        do       do       do       do       do
249 console_io                         do       do       do       do       do
250 physdev_op_compat                  compat   do       -        -        dep
251 #if defined(CONFIG_GRANT_TABLE)
252 grant_table_op                     compat   do       hvm      hvm      do
253 #elif defined(CONFIG_PV_SHIM)
254 grant_table_op                     compat   do       -        -        -
255 #endif
256 vm_assist                          do       do       do       do       do
257 update_va_mapping_otherdomain      compat   do       -        -        -
258 iret                               compat:1 do:1     -        -        -
259 vcpu_op                            compat   do       compat:1 do:1     do
260 set_segment_base                   do:2     do:2     -        -        -
261 #ifdef CONFIG_PV
262 mmuext_op                          compat:2 do:2     compat   do       -
263 #endif
264 xsm_op                             compat   do       compat   do       do
265 nmi_op                             compat   do       -        -        -
266 sched_op                           compat   do       compat   do       do
267 callback_op                        compat   do       -        -        -
268 #ifdef CONFIG_XENOPROF
269 xenoprof_op                        compat   do       -        -        -
270 #endif
271 event_channel_op                   do       do       do:1     do:1     do:1
272 physdev_op                         compat   do       hvm      hvm      do_arm
273 #ifdef CONFIG_HVM
274 hvm_op                             do       do       do       do       do
275 #endif
276 #ifndef CONFIG_PV_SHIM_EXCLUSIVE
277 sysctl                             do       do       do       do       do
278 domctl                             do       do       do       do       do
279 #endif
280 #ifdef CONFIG_KEXEC
281 kexec_op                           compat   do       -        -        -
282 #endif
283 tmem_op                            -        -        -        -        -
284 #ifdef CONFIG_ARGO
285 argo_op                            compat   do       compat   do       do
286 #endif
287 xenpmu_op                          do       do       do       do       -
288 #ifdef CONFIG_IOREQ_SERVER
289 dm_op                              compat   do       compat   do       do
290 #endif
291 #ifdef CONFIG_HYPFS
292 hypfs_op                           do       do       do       do       do
293 #endif
294 mca                                do       do       -        -        -
295 #ifndef CONFIG_PV_SHIM_EXCLUSIVE
296 paging_domctl_cont                 do       do       do       do       -
297 #endif
298 
299 #endif /* !CPPCHECK */
300