1 #ifndef __VKI_XEN_DOMCTL_H
2 #define __VKI_XEN_DOMCTL_H
5 * The domctl interface is versioned via the interface_version
6 * field. This structures in this header supports domctl interfaces:
8 * - 0x00000007: Xen 4.1
9 * - 0x00000008: Xen 4.2
10 * - 0x00000009: Xen 4.3 & 4.4
11 * - 0x0000000a: Xen 4.5
13 * When adding a new subop be sure to include the variants used by all
14 * of the above, both here and in syswrap-xen.c
16 * Structs which are identical in all supported versions have no
17 * version suffix. Structs which do differ are defined multiple times
18 * and use the suffix of the latest version to contain that particular
22 #define VKI_XEN_DOMCTL_createdomain 1
23 #define VKI_XEN_DOMCTL_destroydomain 2
24 #define VKI_XEN_DOMCTL_pausedomain 3
25 #define VKI_XEN_DOMCTL_unpausedomain 4
26 #define VKI_XEN_DOMCTL_getdomaininfo 5
27 #define VKI_XEN_DOMCTL_getmemlist 6
28 #define VKI_XEN_DOMCTL_getpageframeinfo 7
29 #define VKI_XEN_DOMCTL_getpageframeinfo2 8
30 #define VKI_XEN_DOMCTL_setvcpuaffinity 9
31 #define VKI_XEN_DOMCTL_shadow_op 10
32 #define VKI_XEN_DOMCTL_max_mem 11
33 #define VKI_XEN_DOMCTL_setvcpucontext 12
34 #define VKI_XEN_DOMCTL_getvcpucontext 13
35 #define VKI_XEN_DOMCTL_getvcpuinfo 14
36 #define VKI_XEN_DOMCTL_max_vcpus 15
37 #define VKI_XEN_DOMCTL_scheduler_op 16
38 #define VKI_XEN_DOMCTL_setdomainhandle 17
39 #define VKI_XEN_DOMCTL_setdebugging 18
40 #define VKI_XEN_DOMCTL_irq_permission 19
41 #define VKI_XEN_DOMCTL_iomem_permission 20
42 #define VKI_XEN_DOMCTL_ioport_permission 21
43 #define VKI_XEN_DOMCTL_hypercall_init 22
44 #define VKI_XEN_DOMCTL_arch_setup 23
45 #define VKI_XEN_DOMCTL_settimeoffset 24
46 #define VKI_XEN_DOMCTL_getvcpuaffinity 25
47 #define VKI_XEN_DOMCTL_real_mode_area 26
48 #define VKI_XEN_DOMCTL_resumedomain 27
49 #define VKI_XEN_DOMCTL_sendtrigger 28
50 #define VKI_XEN_DOMCTL_subscribe 29
51 #define VKI_XEN_DOMCTL_gethvmcontext 33
52 #define VKI_XEN_DOMCTL_sethvmcontext 34
53 #define VKI_XEN_DOMCTL_set_address_size 35
54 #define VKI_XEN_DOMCTL_get_address_size 36
55 #define VKI_XEN_DOMCTL_assign_device 37
56 #define VKI_XEN_DOMCTL_bind_pt_irq 38
57 #define VKI_XEN_DOMCTL_memory_mapping 39
58 #define VKI_XEN_DOMCTL_ioport_mapping 40
59 #define VKI_XEN_DOMCTL_pin_mem_cacheattr 41
60 #define VKI_XEN_DOMCTL_set_ext_vcpucontext 42
61 #define VKI_XEN_DOMCTL_get_ext_vcpucontext 43
62 #define VKI_XEN_DOMCTL_set_opt_feature 44 /*Obsolete IA64 only */
63 #define VKI_XEN_DOMCTL_test_assign_device 45
64 #define VKI_XEN_DOMCTL_set_target 46
65 #define VKI_XEN_DOMCTL_deassign_device 47
66 #define VKI_XEN_DOMCTL_unbind_pt_irq 48
67 #define VKI_XEN_DOMCTL_set_cpuid 49
68 #define VKI_XEN_DOMCTL_get_device_group 50
69 #define VKI_XEN_DOMCTL_set_machine_address_size 51
70 #define VKI_XEN_DOMCTL_get_machine_address_size 52
71 #define VKI_XEN_DOMCTL_suppress_spurious_page_faults 53
72 #define VKI_XEN_DOMCTL_debug_op 54
73 #define VKI_XEN_DOMCTL_gethvmcontext_partial 55
74 #define VKI_XEN_DOMCTL_mem_event_op 56
75 #define VKI_XEN_DOMCTL_mem_sharing_op 57
76 #define VKI_XEN_DOMCTL_disable_migrate 58
77 #define VKI_XEN_DOMCTL_gettscinfo 59
78 #define VKI_XEN_DOMCTL_settscinfo 60
79 #define VKI_XEN_DOMCTL_getpageframeinfo3 61
80 #define VKI_XEN_DOMCTL_setvcpuextstate 62
81 #define VKI_XEN_DOMCTL_getvcpuextstate 63
82 #define VKI_XEN_DOMCTL_set_access_required 64
83 #define VKI_XEN_DOMCTL_audit_p2m 65
84 #define VKI_XEN_DOMCTL_set_virq_handler 66
85 #define VKI_XEN_DOMCTL_set_broken_page_p2m 67
86 #define VKI_XEN_DOMCTL_setnodeaffinity 68
87 #define VKI_XEN_DOMCTL_getnodeaffinity 69
88 #define VKI_XEN_DOMCTL_set_max_evtchn 70
89 #define VKI_XEN_DOMCTL_cacheflush 71
90 #define VKI_XEN_DOMCTL_gdbsx_guestmemio 1000
91 #define VKI_XEN_DOMCTL_gdbsx_pausevcpu 1001
92 #define VKI_XEN_DOMCTL_gdbsx_unpausevcpu 1002
93 #define VKI_XEN_DOMCTL_gdbsx_domstatus 1003
95 struct vki_xen_domctl_createdomain
{
98 vki_xen_domain_handle_t handle
;
102 struct vki_xen_domctl_getdomaininfo_00000007
{
104 vki_xen_domid_t domain
;
106 vki_xen_uint64_aligned_t tot_pages
;
107 vki_xen_uint64_aligned_t max_pages
;
108 vki_xen_uint64_aligned_t shr_pages
;
109 vki_xen_uint64_aligned_t paged_pages
;
110 vki_xen_uint64_aligned_t shared_info_frame
;
111 vki_xen_uint64_aligned_t cpu_time
;
112 vki_uint32_t nr_online_vcpus
;
113 vki_uint32_t max_vcpu_id
;
114 vki_uint32_t ssidref
;
115 vki_xen_domain_handle_t handle
;
116 vki_uint32_t cpupool
;
118 typedef struct vki_xen_domctl_getdomaininfo_00000007 vki_xen_domctl_getdomaininfo_00000007_t
;
119 DEFINE_VKI_XEN_GUEST_HANDLE(vki_xen_domctl_getdomaininfo_00000007_t
);
121 struct vki_xen_domctl_getdomaininfo_00000008
{
123 vki_xen_domid_t domain
;
125 vki_xen_uint64_aligned_t tot_pages
;
126 vki_xen_uint64_aligned_t max_pages
;
127 vki_xen_uint64_aligned_t shr_pages
;
128 vki_xen_uint64_aligned_t paged_pages
;
129 vki_xen_uint64_aligned_t shared_info_frame
;
130 vki_xen_uint64_aligned_t cpu_time
;
131 vki_uint32_t nr_online_vcpus
;
132 vki_uint32_t max_vcpu_id
;
133 vki_uint32_t ssidref
;
134 vki_xen_domain_handle_t handle
;
135 vki_uint32_t cpupool
;
137 typedef struct vki_xen_domctl_getdomaininfo_00000008 vki_xen_domctl_getdomaininfo_00000008_t
;
138 DEFINE_VKI_XEN_GUEST_HANDLE(vki_xen_domctl_getdomaininfo_00000008_t
);
140 struct vki_xen_domctl_getdomaininfo_00000009
{
142 vki_xen_domid_t domain
;
144 vki_xen_uint64_aligned_t tot_pages
;
145 vki_xen_uint64_aligned_t max_pages
;
146 vki_xen_uint64_aligned_t outstanding_pages
;
147 vki_xen_uint64_aligned_t shr_pages
;
148 vki_xen_uint64_aligned_t paged_pages
;
149 vki_xen_uint64_aligned_t shared_info_frame
;
150 vki_xen_uint64_aligned_t cpu_time
;
151 vki_uint32_t nr_online_vcpus
;
152 vki_uint32_t max_vcpu_id
;
153 vki_uint32_t ssidref
;
154 vki_xen_domain_handle_t handle
;
155 vki_uint32_t cpupool
;
157 typedef struct vki_xen_domctl_getdomaininfo_00000009 vki_xen_domctl_getdomaininfo_00000009_t
;
158 DEFINE_VKI_XEN_GUEST_HANDLE(vki_xen_domctl_getdomaininfo_00000009_t
);
160 /* vki_xen_domctl_getdomaininfo_0000000a is the same as 00000009 */
162 /* Get/set the NUMA node(s) with which the guest has affinity with. */
163 /* XEN_DOMCTL_setnodeaffinity */
164 /* XEN_DOMCTL_getnodeaffinity */
165 struct vki_xen_domctl_nodeaffinity
{
166 struct vki_xenctl_bitmap nodemap
;/* IN */
168 typedef struct vki_xen_domctl_nodeaffinity vki_xen_domctl_nodeaffinity_t
;
169 DEFINE_VKI_XEN_GUEST_HANDLE(vki_xen_domctl_nodeaffinity_t
);
171 struct vki_xen_domctl_getpageframeinfo3
{
172 vki_xen_uint64_aligned_t num
; /* IN */
173 VKI_XEN_GUEST_HANDLE_64(vki_xen_pfn_t
) array
; /* IN/OUT */
176 struct vki_xen_domctl_vcpuaffinity_00000009
{
177 vki_uint32_t vcpu
; /* IN */
178 struct vki_xenctl_bitmap cpumap
; /* IN/OUT */
181 struct vki_xen_domctl_vcpuaffinity_0000000a
{
182 vki_uint32_t vcpu
; /* IN */
183 #define VKI_XEN_VCPUAFFINITY_HARD (1U<<0)
184 #define VKI_XEN_VCPUAFFINITY_SOFT (1U<<1)
185 vki_uint32_t flags
; /* IN */
186 struct vki_xenctl_bitmap cpumap_hard
; /* IN/OUT */
187 struct vki_xenctl_bitmap cpumap_soft
; /* IN/OUT */
190 struct vki_xen_domctl_shadow_op_stats
{
191 vki_uint32_t fault_count
;
192 vki_uint32_t dirty_count
;
195 /* vki_xen_domctl_shadow_op.op is an utter mess for compatibily reasons. */
197 struct vki_xen_domctl_shadow_op
{
198 vki_uint32_t op
; /* IN */
200 #define VKI_XEN_DOMCTL_SHADOW_OP_OFF 0
201 #define VKI_XEN_DOMCTL_SHADOW_OP_ENABLE 32
202 #define VKI_XEN_DOMCTL_SHADOW_OP_CLEAN 11
203 #define VKI_XEN_DOMCTL_SHADOW_OP_PEEK 12
204 #define VKI_XEN_DOMCTL_SHADOW_OP_GET_ALLOCATION 30
205 #define VKI_XEN_DOMCTL_SHADOW_OP_SET_ALLOCATION 31
207 #define VKI_XEN_DOMCTL_SHADOW_OP_ENABLE_TEST 1
208 #define VKI_XEN_DOMCTL_SHADOW_OP_ENABLE_LOGDIRTY 2
209 #define VKI_XEN_DOMCTL_SHADOW_OP_ENABLE_TRANSLATE 3
213 #define XEN_DOMCTL_SHADOW_ENABLE_REFCOUNT (1 << 1)
214 #define XEN_DOMCTL_SHADOW_ENABLE_LOG_DIRTY (1 << 2)
215 #define XEN_DOMCTL_SHADOW_ENABLE_TRANSLATE (1 << 3)
216 #define XEN_DOMCTL_SHADOW_ENABLE_EXTERNAL (1 << 4)
219 VKI_XEN_GUEST_HANDLE_64(vki_uint8
) dirty_bitmap
;
220 vki_xen_uint64_aligned_t pages
;
221 struct vki_xen_domctl_shadow_op_stats stats
;
224 struct vki_xen_domctl_max_mem
{
226 vki_xen_uint64_aligned_t max_memkb
;
229 struct vki_xen_domctl_vcpucontext
{
230 vki_uint32_t vcpu
; /* IN */
231 VKI_XEN_GUEST_HANDLE_64(vki_xen_vcpu_guest_context_t
) ctxt
; /* IN/OUT */
234 struct vki_xen_domctl_getvcpuinfo
{
238 vki_uint8_t online
; /* currently online (not hotplugged)? */
239 vki_uint8_t blocked
; /* blocked waiting for an event? */
240 vki_uint8_t running
; /* currently scheduled on its CPU? */
241 vki_xen_uint64_aligned_t cpu_time
;/* total cpu time consumed (ns) */
242 vki_uint32_t cpu
; /* current mapping */
245 struct vki_xen_domctl_scheduler_op
{
246 vki_uint32_t sched_id
; /* VKI_XEN_SCHEDULER_* */
247 #define VKI_XEN_SCHEDULER_SEDF 4
248 #define VKI_XEN_SCHEDULER_CREDIT 5
249 #define VKI_XEN_SCHEDULER_CREDIT2 6
250 #define VKI_XEN_SCHEDULER_ARINC653 7
251 #define VKI_XEN_SCHEDULER_RTDS 8
252 vki_uint32_t cmd
; /* VKI_XEN_DOMCTL_SCHEDOP_* */
253 #define VKI_XEN_DOMCTL_SCHEDOP_putinfo 0
254 #define VKI_XEN_DOMCTL_SCHEDOP_getinfo 1
256 struct xen_domctl_sched_sedf
{
257 vki_xen_uint64_aligned_t period
;
258 vki_xen_uint64_aligned_t slice
;
259 vki_xen_uint64_aligned_t latency
;
260 vki_uint32_t extratime
;
263 struct xen_domctl_sched_credit
{
267 struct xen_domctl_sched_credit2
{
270 struct xen_domctl_sched_rtds
{
277 struct vki_xen_domctl_max_vcpus
{
278 vki_uint32_t max
; /* maximum number of vcpus */
281 struct vki_xen_domctl_ioport_permission
{
282 vki_uint32_t first_port
; /* IN */
283 vki_uint32_t nr_ports
; /* IN */
284 vki_uint8_t allow_access
; /* IN */
287 struct vki_xen_domctl_hypercall_init
{
288 vki_xen_uint64_aligned_t gmfn
; /* GMFN to be initialised */
291 struct vki_xen_domctl_settimeoffset
{
292 vki_int32_t time_offset_seconds
;
295 struct vki_xen_domctl_cpuid
{
296 vki_uint32_t input
[2];
303 struct vki_xen_guest_tsc_info
{
304 vki_uint32_t tsc_mode
;
305 vki_uint32_t gtsc_khz
;
306 vki_uint32_t incarnation
;
308 vki_xen_uint64_aligned_t elapsed_nsec
;
310 typedef struct vki_xen_guest_tsc_info vki_xen_guest_tsc_info_t
;
311 DEFINE_VKI_XEN_GUEST_HANDLE(vki_xen_guest_tsc_info_t
);
313 struct vki_xen_domctl_hvmcontext
{
314 vki_uint32_t size
; /* IN/OUT size of buffer */
315 VKI_XEN_GUEST_HANDLE_64(vki_uint8
) buffer
; /* IN/OUT */
317 typedef struct vki_xen_domctl_hvmcontext vki_xen_domctl_hvmcontext_t
;
318 DEFINE_VKI_XEN_GUEST_HANDLE(vki_xen_domctl_hvmcontext_t
);
320 struct vki_xen_domctl_hvmcontext_partial
{
321 vki_uint32_t type
; /* IN */
322 vki_uint32_t instance
; /* IN */
323 VKI_XEN_GUEST_HANDLE_64(vki_uint8
) buffer
; /* IN/OUT buffer */
325 typedef struct vki_xen_domctl_hvmcontext_partial vki_xen_domctl_hvmcontext_partial_t
;
326 DEFINE_VKI_XEN_GUEST_HANDLE(vki_xen_domctl_hvmcontext_partial_t
);
328 struct vki_xen_domctl_tsc_info
{
329 VKI_XEN_GUEST_HANDLE_64(vki_xen_guest_tsc_info_t
) out_info
; /* OUT */
330 vki_xen_guest_tsc_info_t info
; /* IN */
333 struct vki_xen_domctl_ext_vcpucontext_00000008
{
334 vki_uint32_t vcpu
; /* IN */
336 /* IN for XEN_DOMCTL_set_ext_vcpucontext
337 * OUT for XEN_DOMCTL_get_ext_vcpucontext */
339 #if defined(__i386__) || defined(__x86_64__)
340 vki_xen_uint64_aligned_t syscall32_callback_eip
;
341 vki_xen_uint64_aligned_t sysenter_callback_eip
;
342 vki_uint16_t syscall32_callback_cs
;
343 vki_uint16_t sysenter_callback_cs
;
344 vki_uint8_t syscall32_disables_events
;
345 vki_uint8_t sysenter_disables_events
;
346 vki_xen_uint64_aligned_t mcg_cap
;
350 struct vki_xen_domctl_ext_vcpucontext_00000009
{
351 vki_uint32_t vcpu
; /* IN */
353 /* IN for XEN_DOMCTL_set_ext_vcpucontext
354 * OUT for XEN_DOMCTL_get_ext_vcpucontext */
356 #if defined(__i386__) || defined(__x86_64__)
357 vki_xen_uint64_aligned_t syscall32_callback_eip
;
358 vki_xen_uint64_aligned_t sysenter_callback_eip
;
359 vki_uint16_t syscall32_callback_cs
;
360 vki_uint16_t sysenter_callback_cs
;
361 vki_uint8_t syscall32_disables_events
;
362 vki_uint8_t sysenter_disables_events
;
364 vki_uint64_t mci_ctl2_bank0
;
365 vki_uint64_t mci_ctl2_bank1
;
369 /* vki_xen_domctl_ext_vcpucontext_0000000a is the same as 00000009 */
371 struct vki_xen_domctl_vcpuextstate
{
373 vki_xen_uint64_aligned_t xfeature_mask
;
374 vki_xen_uint64_aligned_t size
;
375 VKI_XEN_GUEST_HANDLE_64(vki_uint64
) buffer
;
378 struct vki_xen_domctl_address_size
{
382 struct vki_xen_domctl_debug_op
{
383 vki_uint32_t op
; /* IN */
384 vki_uint32_t vcpu
; /* IN */
386 typedef struct vki_xen_domctl_debug_op vki_xen_domctl_debug_op_t
;
388 struct vki_xen_domctl_mem_event_op
{
389 vki_uint32_t op
; /* IN */
390 vki_uint32_t mode
; /* IN */
391 vki_uint32_t port
; /* OUT */
394 struct vki_xen_domctl_set_access_required
{
395 vki_uint8_t access_required
; /* IN */
398 struct vki_xen_domctl_set_max_evtchn
{
399 vki_uint32_t max_port
;
402 struct vki_xen_domctl_cacheflush
{
403 /* IN: page range to flush. */
404 vki_xen_pfn_t start_pfn
, nr_pfns
;
407 struct vki_xen_domctl
{
409 vki_uint32_t interface_version
; /* XEN_DOMCTL_INTERFACE_VERSION */
410 vki_xen_domid_t domain
;
412 struct vki_xen_domctl_createdomain createdomain
;
413 struct vki_xen_domctl_getdomaininfo_00000007 getdomaininfo_00000007
;
414 struct vki_xen_domctl_getdomaininfo_00000008 getdomaininfo_00000008
;
415 struct vki_xen_domctl_getdomaininfo_00000009 getdomaininfo_00000009
;
416 //struct vki_xen_domctl_getmemlist getmemlist;
417 //struct vki_xen_domctl_getpageframeinfo getpageframeinfo;
418 //struct vki_xen_domctl_getpageframeinfo2 getpageframeinfo2;
419 struct vki_xen_domctl_getpageframeinfo3 getpageframeinfo3
;
420 struct vki_xen_domctl_nodeaffinity nodeaffinity
;
421 struct vki_xen_domctl_vcpuaffinity_00000009 vcpuaffinity_00000009
;
422 struct vki_xen_domctl_vcpuaffinity_0000000a vcpuaffinity_0000000a
;
423 struct vki_xen_domctl_shadow_op shadow_op
;
424 struct vki_xen_domctl_max_mem max_mem
;
425 struct vki_xen_domctl_vcpucontext vcpucontext
;
426 struct vki_xen_domctl_getvcpuinfo getvcpuinfo
;
427 struct vki_xen_domctl_max_vcpus max_vcpus
;
428 struct vki_xen_domctl_scheduler_op scheduler_op
;
429 //struct vki_xen_domctl_setdomainhandle setdomainhandle;
430 //struct vki_xen_domctl_setdebugging setdebugging;
431 //struct vki_xen_domctl_irq_permission irq_permission;
432 //struct vki_xen_domctl_iomem_permission iomem_permission;
433 struct vki_xen_domctl_ioport_permission ioport_permission
;
434 struct vki_xen_domctl_hypercall_init hypercall_init
;
435 //struct vki_xen_domctl_arch_setup arch_setup;
436 struct vki_xen_domctl_settimeoffset settimeoffset
;
437 //struct vki_xen_domctl_disable_migrate disable_migrate;
438 struct vki_xen_domctl_tsc_info tsc_info
;
439 //struct vki_xen_domctl_real_mode_area real_mode_area;
440 struct vki_xen_domctl_hvmcontext hvmcontext
;
441 struct vki_xen_domctl_hvmcontext_partial hvmcontext_partial
;
442 struct vki_xen_domctl_address_size address_size
;
443 //struct vki_xen_domctl_sendtrigger sendtrigger;
444 //struct vki_xen_domctl_get_device_group get_device_group;
445 //struct vki_xen_domctl_assign_device assign_device;
446 //struct vki_xen_domctl_bind_pt_irq bind_pt_irq;
447 //struct vki_xen_domctl_memory_mapping memory_mapping;
448 //struct vki_xen_domctl_ioport_mapping ioport_mapping;
449 //struct vki_xen_domctl_pin_mem_cacheattr pin_mem_cacheattr;
450 struct vki_xen_domctl_ext_vcpucontext_00000008 ext_vcpucontext_00000008
;
451 struct vki_xen_domctl_ext_vcpucontext_00000009 ext_vcpucontext_00000009
;
452 //struct vki_xen_domctl_set_target set_target;
453 //struct vki_xen_domctl_subscribe subscribe;
454 struct vki_xen_domctl_debug_op debug_op
;
455 struct vki_xen_domctl_mem_event_op mem_event_op
;
456 //struct vki_xen_domctl_mem_sharing_op mem_sharing_op;
457 #if defined(__i386__) || defined(__x86_64__)
458 struct vki_xen_domctl_cpuid cpuid
;
459 struct vki_xen_domctl_vcpuextstate vcpuextstate
;
461 struct vki_xen_domctl_set_access_required access_required
;
462 //struct vki_xen_domctl_audit_p2m audit_p2m;
463 //struct vki_xen_domctl_set_virq_handler set_virq_handler;
464 struct vki_xen_domctl_set_max_evtchn set_max_evtchn
;
465 //struct vki_xen_domctl_gdbsx_memio gdbsx_guest_memio;
466 //struct vki_xen_domctl_set_broken_page_p2m set_broken_page_p2m;
467 struct vki_xen_domctl_cacheflush cacheflush
;
468 //struct vki_xen_domctl_gdbsx_pauseunp_vcpu gdbsx_pauseunp_vcpu;
469 //struct vki_xen_domctl_gdbsx_domstatus gdbsx_domstatus;
470 vki_uint8_t pad
[128];
474 #endif // __VKI_XEN_DOMCTL_H
476 /*--------------------------------------------------------------------*/
478 /*--------------------------------------------------------------------*/