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, unsigned long 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 long 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 #ifdef CONFIG_SYSCTL 198 sysctl(xen_sysctl_t *u_sysctl) 199 #endif 200 #if defined(CONFIG_X86) && defined(CONFIG_PAGING) 201 paging_domctl_cont(xen_domctl_t *u_domctl) 202 #endif 203 #ifndef CONFIG_PV_SHIM_EXCLUSIVE 204 domctl(xen_domctl_t *u_domctl) 205 platform_op(xen_platform_op_t *u_xenpf_op) 206 #endif 207 #ifdef CONFIG_HVM 208 hvm_op(unsigned long op, void *arg) 209 #endif 210 #ifdef CONFIG_HYPFS 211 hypfs_op(unsigned int cmd, const char *arg1, unsigned long arg2, void *arg3, unsigned long arg4) 212 #endif 213 #ifdef CONFIG_X86 214 xenpmu_op(unsigned int op, xen_pmu_params_t *arg) 215 #endif 216 217 #ifdef CONFIG_PV 218 caller: pv64 219 #ifdef CONFIG_PV32 220 caller: pv32 221 #endif 222 #endif 223 #if defined(CONFIG_HVM) && defined(CONFIG_X86) 224 caller: hvm64 225 #ifdef CONFIG_COMPAT 226 caller: hvm32 227 #endif 228 #endif 229 #ifdef CONFIG_ARM 230 caller: arm 231 #endif 232 233 table: pv32 pv64 hvm32 hvm64 arm 234 set_trap_table compat do - - - 235 mmu_update do:1 do:1 - - - 236 set_gdt compat do - - - 237 stack_switch do:2 do:2 - - - 238 set_callbacks compat do - - - 239 fpu_taskswitch do do - - - 240 sched_op_compat do do - - dep 241 #ifndef CONFIG_PV_SHIM_EXCLUSIVE 242 platform_op compat do compat do do 243 #endif 244 set_debugreg do do - - - 245 get_debugreg do do - - - 246 update_descriptor compat do - - - 247 memory_op compat do hvm hvm do 248 multicall compat:2 do:2 compat do do 249 update_va_mapping compat do - - - 250 set_timer_op compat do compat do - 251 event_channel_op_compat do do - - dep 252 xen_version do do do do do 253 console_io do do do do do 254 physdev_op_compat compat do - - dep 255 #if defined(CONFIG_GRANT_TABLE) 256 grant_table_op compat do hvm hvm do 257 #elif defined(CONFIG_PV_SHIM) 258 grant_table_op compat do - - - 259 #endif 260 vm_assist do do do do do 261 update_va_mapping_otherdomain compat do - - - 262 iret compat:1 do:1 - - - 263 vcpu_op compat do compat:1 do:1 do 264 set_segment_base do:2 do:2 - - - 265 #ifdef CONFIG_PV 266 mmuext_op compat:2 do:2 compat do - 267 #endif 268 xsm_op compat do compat do do 269 nmi_op compat do - - - 270 sched_op compat do compat do do 271 callback_op compat do - - - 272 #ifdef CONFIG_XENOPROF 273 xenoprof_op compat do - - - 274 #endif 275 event_channel_op do do do:1 do:1 do:1 276 physdev_op compat do hvm hvm do_arm 277 #ifdef CONFIG_HVM 278 hvm_op do do do do do 279 #endif 280 #ifdef CONFIG_SYSCTL 281 sysctl do do do do do 282 #endif 283 #ifndef CONFIG_PV_SHIM_EXCLUSIVE 284 domctl do do do do do 285 #endif 286 #ifdef CONFIG_KEXEC 287 kexec_op compat do - - - 288 #endif 289 tmem_op - - - - - 290 #ifdef CONFIG_ARGO 291 argo_op compat do compat do do 292 #endif 293 xenpmu_op do do do do - 294 #ifdef CONFIG_IOREQ_SERVER 295 dm_op compat do compat do do 296 #endif 297 #ifdef CONFIG_HYPFS 298 hypfs_op do do do do do 299 #endif 300 mca do do - - - 301 #if defined(CONFIG_X86) && defined(CONFIG_PAGING) 302 paging_domctl_cont do do do do - 303 #endif 304 305 #endif /* !CPPCHECK */ 306