• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2    This file is part of Valgrind, a dynamic binary instrumentation
3    framework.
4 
5    Copyright (C) 2012-2017 Citrix
6 
7    This program is free software; you can redistribute it and/or
8    modify it under the terms of the GNU General Public License as
9    published by the Free Software Foundation; either version 2 of the
10    License, or (at your option) any later version.
11 
12    This program is distributed in the hope that it will be useful, but
13    WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15    General Public License for more details.
16 
17    You should have received a copy of the GNU General Public License
18    along with this program; if not, write to the Free Software
19    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
20    02111-1307, USA.
21 
22    The GNU General Public License is contained in the file COPYING.
23 */
24 
25 /* Contributed by Andrew Cooper <andrew.cooper3@citrix.com>
26    and Ian Campbell <ian.campbell@citrix.com> */
27 
28 #ifndef __VKI_XEN_DOMCTL_H
29 #define __VKI_XEN_DOMCTL_H
30 
31 /*
32  * The domctl interface is versioned via the interface_version
33  * field. This structures in this header supports domctl interfaces:
34  *
35  * - 0x00000007: Xen 4.1
36  * - 0x00000008: Xen 4.2
37  * - 0x00000009: Xen 4.3 & 4.4
38  * - 0x0000000a: Xen 4.5
39  * - 0x0000000b: Xen 4.6
40  * - 0x0000000c: Xen 4.7
41  *
42  * When adding a new subop be sure to include the variants used by all
43  * of the above, both here and in syswrap-xen.c
44  *
45  * Structs which are identical in all supported versions have no
46  * version suffix. Structs which do differ are defined multiple times
47  * and use the suffix of the latest version to contain that particular
48  * variant.
49  */
50 
51 #define VKI_XEN_DOMCTL_createdomain                   1
52 #define VKI_XEN_DOMCTL_destroydomain                  2
53 #define VKI_XEN_DOMCTL_pausedomain                    3
54 #define VKI_XEN_DOMCTL_unpausedomain                  4
55 #define VKI_XEN_DOMCTL_getdomaininfo                  5
56 #define VKI_XEN_DOMCTL_getmemlist                     6
57 #define VKI_XEN_DOMCTL_getpageframeinfo               7
58 #define VKI_XEN_DOMCTL_getpageframeinfo2              8
59 #define VKI_XEN_DOMCTL_setvcpuaffinity                9
60 #define VKI_XEN_DOMCTL_shadow_op                     10
61 #define VKI_XEN_DOMCTL_max_mem                       11
62 #define VKI_XEN_DOMCTL_setvcpucontext                12
63 #define VKI_XEN_DOMCTL_getvcpucontext                13
64 #define VKI_XEN_DOMCTL_getvcpuinfo                   14
65 #define VKI_XEN_DOMCTL_max_vcpus                     15
66 #define VKI_XEN_DOMCTL_scheduler_op                  16
67 #define VKI_XEN_DOMCTL_setdomainhandle               17
68 #define VKI_XEN_DOMCTL_setdebugging                  18
69 #define VKI_XEN_DOMCTL_irq_permission                19
70 #define VKI_XEN_DOMCTL_iomem_permission              20
71 #define VKI_XEN_DOMCTL_ioport_permission             21
72 #define VKI_XEN_DOMCTL_hypercall_init                22
73 #define VKI_XEN_DOMCTL_arch_setup                    23
74 #define VKI_XEN_DOMCTL_settimeoffset                 24
75 #define VKI_XEN_DOMCTL_getvcpuaffinity               25
76 #define VKI_XEN_DOMCTL_real_mode_area                26
77 #define VKI_XEN_DOMCTL_resumedomain                  27
78 #define VKI_XEN_DOMCTL_sendtrigger                   28
79 #define VKI_XEN_DOMCTL_subscribe                     29
80 #define VKI_XEN_DOMCTL_gethvmcontext                 33
81 #define VKI_XEN_DOMCTL_sethvmcontext                 34
82 #define VKI_XEN_DOMCTL_set_address_size              35
83 #define VKI_XEN_DOMCTL_get_address_size              36
84 #define VKI_XEN_DOMCTL_assign_device                 37
85 #define VKI_XEN_DOMCTL_bind_pt_irq                   38
86 #define VKI_XEN_DOMCTL_memory_mapping                39
87 #define VKI_XEN_DOMCTL_ioport_mapping                40
88 #define VKI_XEN_DOMCTL_pin_mem_cacheattr             41
89 #define VKI_XEN_DOMCTL_set_ext_vcpucontext           42
90 #define VKI_XEN_DOMCTL_get_ext_vcpucontext           43
91 #define VKI_XEN_DOMCTL_set_opt_feature               44 /*Obsolete IA64 only */
92 #define VKI_XEN_DOMCTL_test_assign_device            45
93 #define VKI_XEN_DOMCTL_set_target                    46
94 #define VKI_XEN_DOMCTL_deassign_device               47
95 #define VKI_XEN_DOMCTL_unbind_pt_irq                 48
96 #define VKI_XEN_DOMCTL_set_cpuid                     49
97 #define VKI_XEN_DOMCTL_get_device_group              50
98 #define VKI_XEN_DOMCTL_set_machine_address_size      51
99 #define VKI_XEN_DOMCTL_get_machine_address_size      52
100 #define VKI_XEN_DOMCTL_suppress_spurious_page_faults 53
101 #define VKI_XEN_DOMCTL_debug_op                      54
102 #define VKI_XEN_DOMCTL_gethvmcontext_partial         55
103 #define VKI_XEN_DOMCTL_mem_event_op                  56
104 #define VKI_XEN_DOMCTL_vm_event_op                   56 /* name change in 4.6 */
105 #define VKI_XEN_DOMCTL_mem_sharing_op                57
106 #define VKI_XEN_DOMCTL_disable_migrate               58
107 #define VKI_XEN_DOMCTL_gettscinfo                    59
108 #define VKI_XEN_DOMCTL_settscinfo                    60
109 #define VKI_XEN_DOMCTL_getpageframeinfo3             61
110 #define VKI_XEN_DOMCTL_setvcpuextstate               62
111 #define VKI_XEN_DOMCTL_getvcpuextstate               63
112 #define VKI_XEN_DOMCTL_set_access_required           64
113 #define VKI_XEN_DOMCTL_audit_p2m                     65
114 #define VKI_XEN_DOMCTL_set_virq_handler              66
115 #define VKI_XEN_DOMCTL_set_broken_page_p2m           67
116 #define VKI_XEN_DOMCTL_setnodeaffinity               68
117 #define VKI_XEN_DOMCTL_getnodeaffinity               69
118 #define VKI_XEN_DOMCTL_set_max_evtchn                70
119 #define VKI_XEN_DOMCTL_cacheflush                    71
120 #define VKI_XEN_DOMCTL_get_vcpu_msrs                 72
121 #define VKI_XEN_DOMCTL_set_vcpu_msrs                 73
122 #define VKI_XEN_DOMCTL_monitor_op                    77 /* new in 4.6 */
123 #define VKI_XEN_DOMCTL_gdbsx_guestmemio            1000
124 #define VKI_XEN_DOMCTL_gdbsx_pausevcpu             1001
125 #define VKI_XEN_DOMCTL_gdbsx_unpausevcpu           1002
126 #define VKI_XEN_DOMCTL_gdbsx_domstatus             1003
127 
128 struct vki_xen_domctl_createdomain {
129     /* IN parameters */
130     vki_uint32_t ssidref;
131     vki_xen_domain_handle_t handle;
132     vki_uint32_t flags;
133 };
134 
135 struct vki_xen_domctl_getdomaininfo_00000007 {
136     /* OUT variables. */
137     vki_xen_domid_t  domain;
138     vki_uint32_t flags;
139     vki_xen_uint64_aligned_t tot_pages;
140     vki_xen_uint64_aligned_t max_pages;
141     vki_xen_uint64_aligned_t shr_pages;
142     vki_xen_uint64_aligned_t paged_pages;
143     vki_xen_uint64_aligned_t shared_info_frame;
144     vki_xen_uint64_aligned_t cpu_time;
145     vki_uint32_t nr_online_vcpus;
146     vki_uint32_t max_vcpu_id;
147     vki_uint32_t ssidref;
148     vki_xen_domain_handle_t handle;
149     vki_uint32_t cpupool;
150 };
151 typedef struct vki_xen_domctl_getdomaininfo_00000007 vki_xen_domctl_getdomaininfo_00000007_t;
152 DEFINE_VKI_XEN_GUEST_HANDLE(vki_xen_domctl_getdomaininfo_00000007_t);
153 
154 struct vki_xen_domctl_getdomaininfo_00000008 {
155     /* OUT variables. */
156     vki_xen_domid_t  domain;
157     vki_uint32_t flags;
158     vki_xen_uint64_aligned_t tot_pages;
159     vki_xen_uint64_aligned_t max_pages;
160     vki_xen_uint64_aligned_t shr_pages;
161     vki_xen_uint64_aligned_t paged_pages;
162     vki_xen_uint64_aligned_t shared_info_frame;
163     vki_xen_uint64_aligned_t cpu_time;
164     vki_uint32_t nr_online_vcpus;
165     vki_uint32_t max_vcpu_id;
166     vki_uint32_t ssidref;
167     vki_xen_domain_handle_t handle;
168     vki_uint32_t cpupool;
169 };
170 typedef struct vki_xen_domctl_getdomaininfo_00000008 vki_xen_domctl_getdomaininfo_00000008_t;
171 DEFINE_VKI_XEN_GUEST_HANDLE(vki_xen_domctl_getdomaininfo_00000008_t);
172 
173 struct vki_xen_domctl_getdomaininfo_00000009 {
174     /* OUT variables. */
175     vki_xen_domid_t  domain;
176     vki_uint32_t flags;
177     vki_xen_uint64_aligned_t tot_pages;
178     vki_xen_uint64_aligned_t max_pages;
179     vki_xen_uint64_aligned_t outstanding_pages;
180     vki_xen_uint64_aligned_t shr_pages;
181     vki_xen_uint64_aligned_t paged_pages;
182     vki_xen_uint64_aligned_t shared_info_frame;
183     vki_xen_uint64_aligned_t cpu_time;
184     vki_uint32_t nr_online_vcpus;
185     vki_uint32_t max_vcpu_id;
186     vki_uint32_t ssidref;
187     vki_xen_domain_handle_t handle;
188     vki_uint32_t cpupool;
189 };
190 typedef struct vki_xen_domctl_getdomaininfo_00000009 vki_xen_domctl_getdomaininfo_00000009_t;
191 DEFINE_VKI_XEN_GUEST_HANDLE(vki_xen_domctl_getdomaininfo_00000009_t);
192 
193 /* vki_xen_domctl_getdomaininfo_0000000a is the same as 00000009 */
194 
195 /* Get/set the NUMA node(s) with which the guest has affinity with. */
196 /* XEN_DOMCTL_setnodeaffinity */
197 /* XEN_DOMCTL_getnodeaffinity */
198 struct vki_xen_domctl_nodeaffinity {
199     struct vki_xenctl_bitmap nodemap;/* IN */
200 };
201 typedef struct vki_xen_domctl_nodeaffinity vki_xen_domctl_nodeaffinity_t;
202 DEFINE_VKI_XEN_GUEST_HANDLE(vki_xen_domctl_nodeaffinity_t);
203 
204 struct vki_xen_domctl_getpageframeinfo3 {
205     vki_xen_uint64_aligned_t num; /* IN */
206     VKI_XEN_GUEST_HANDLE_64(vki_xen_pfn_t) array; /* IN/OUT */
207 };
208 
209 struct vki_xen_domctl_vcpuaffinity_00000009 {
210     vki_uint32_t  vcpu;              /* IN */
211     struct vki_xenctl_bitmap cpumap; /* IN/OUT */
212 };
213 
214 struct vki_xen_domctl_vcpuaffinity_0000000a {
215     vki_uint32_t  vcpu;              /* IN */
216 #define VKI_XEN_VCPUAFFINITY_HARD   (1U<<0)
217 #define VKI_XEN_VCPUAFFINITY_SOFT   (1U<<1)
218     vki_uint32_t  flags;              /* IN */
219     struct vki_xenctl_bitmap cpumap_hard; /* IN/OUT */
220     struct vki_xenctl_bitmap cpumap_soft; /* IN/OUT */
221 };
222 
223 struct vki_xen_domctl_shadow_op_stats {
224     vki_uint32_t fault_count;
225     vki_uint32_t dirty_count;
226 };
227 
228 /* vki_xen_domctl_shadow_op.op is an utter mess for compatibily reasons. */
229 
230 struct vki_xen_domctl_shadow_op {
231     vki_uint32_t op; /* IN */
232 
233 #define VKI_XEN_DOMCTL_SHADOW_OP_OFF               0
234 #define VKI_XEN_DOMCTL_SHADOW_OP_ENABLE           32
235 #define VKI_XEN_DOMCTL_SHADOW_OP_CLEAN            11
236 #define VKI_XEN_DOMCTL_SHADOW_OP_PEEK             12
237 #define VKI_XEN_DOMCTL_SHADOW_OP_GET_ALLOCATION   30
238 #define VKI_XEN_DOMCTL_SHADOW_OP_SET_ALLOCATION   31
239 
240 #define VKI_XEN_DOMCTL_SHADOW_OP_ENABLE_TEST       1
241 #define VKI_XEN_DOMCTL_SHADOW_OP_ENABLE_LOGDIRTY   2
242 #define VKI_XEN_DOMCTL_SHADOW_OP_ENABLE_TRANSLATE  3
243 
244     vki_uint32_t mode;
245 
246 #define XEN_DOMCTL_SHADOW_ENABLE_REFCOUNT  (1 << 1)
247 #define XEN_DOMCTL_SHADOW_ENABLE_LOG_DIRTY (1 << 2)
248 #define XEN_DOMCTL_SHADOW_ENABLE_TRANSLATE (1 << 3)
249 #define XEN_DOMCTL_SHADOW_ENABLE_EXTERNAL  (1 << 4)
250 
251     vki_uint32_t mb;
252     VKI_XEN_GUEST_HANDLE_64(vki_uint8) dirty_bitmap;
253     vki_xen_uint64_aligned_t pages;
254     struct vki_xen_domctl_shadow_op_stats stats;
255 };
256 
257 struct vki_xen_domctl_max_mem {
258     /* IN variables. */
259     vki_xen_uint64_aligned_t max_memkb;
260 };
261 
262 struct vki_xen_domctl_vcpucontext {
263     vki_uint32_t              vcpu;                  /* IN */
264     VKI_XEN_GUEST_HANDLE_64(vki_xen_vcpu_guest_context_t) ctxt; /* IN/OUT */
265 };
266 
267 struct vki_xen_domctl_getvcpuinfo {
268     /* IN variables. */
269     vki_uint32_t vcpu;
270     /* OUT variables. */
271     vki_uint8_t  online;              /* currently online (not hotplugged)? */
272     vki_uint8_t  blocked;             /* blocked waiting for an event? */
273     vki_uint8_t  running;             /* currently scheduled on its CPU? */
274     vki_xen_uint64_aligned_t cpu_time;/* total cpu time consumed (ns) */
275     vki_uint32_t cpu;                 /* current mapping   */
276 };
277 
278 struct vki_xen_domctl_scheduler_op {
279     vki_uint32_t sched_id;  /* VKI_XEN_SCHEDULER_* */
280 #define VKI_XEN_SCHEDULER_SEDF     4
281 #define VKI_XEN_SCHEDULER_CREDIT   5
282 #define VKI_XEN_SCHEDULER_CREDIT2  6
283 #define VKI_XEN_SCHEDULER_ARINC653 7
284 #define VKI_XEN_SCHEDULER_RTDS     8
285     vki_uint32_t cmd;       /* VKI_XEN_DOMCTL_SCHEDOP_* */
286 #define VKI_XEN_DOMCTL_SCHEDOP_putinfo 0
287 #define VKI_XEN_DOMCTL_SCHEDOP_getinfo 1
288     union {
289         struct xen_domctl_sched_sedf {
290             vki_xen_uint64_aligned_t period;
291             vki_xen_uint64_aligned_t slice;
292             vki_xen_uint64_aligned_t latency;
293             vki_uint32_t extratime;
294             vki_uint32_t weight;
295         } sedf;
296         struct xen_domctl_sched_credit {
297             vki_uint16_t weight;
298             vki_uint16_t cap;
299         } credit;
300         struct xen_domctl_sched_credit2 {
301             vki_uint16_t weight;
302         } credit2;
303         struct xen_domctl_sched_rtds {
304             vki_uint32_t period;
305             vki_uint32_t budget;
306         } rtds;
307     } u;
308 };
309 
310 struct vki_xen_domctl_max_vcpus {
311     vki_uint32_t max;           /* maximum number of vcpus */
312 };
313 
314 /* XEN_DOMCTL_irq_permission */
315 struct vki_xen_domctl_irq_permission {
316     vki_uint8_t pirq;
317     vki_uint8_t allow_access;    /* flag to specify enable/disable of IRQ access */
318 };
319 
320 struct vki_xen_domctl_iomem_permission {
321     vki_xen_uint64_aligned_t first_mfn;/* first page (physical page number) in range */
322     vki_xen_uint64_aligned_t nr_mfns;  /* number of pages in range (>0) */
323     vki_uint8_t  allow_access;     /* allow (!0) or deny (0) access to range? */
324 };
325 
326 struct vki_xen_domctl_ioport_permission {
327     vki_uint32_t first_port;              /* IN */
328     vki_uint32_t nr_ports;                /* IN */
329     vki_uint8_t  allow_access;            /* IN */
330 };
331 
332 struct vki_xen_domctl_hypercall_init {
333     vki_xen_uint64_aligned_t  gmfn;           /* GMFN to be initialised */
334 };
335 
336 struct vki_xen_domctl_settimeoffset {
337     vki_int32_t time_offset_seconds;
338 };
339 
340 struct vki_xen_domctl_cpuid {
341   vki_uint32_t input[2];
342   vki_uint32_t eax;
343   vki_uint32_t ebx;
344   vki_uint32_t ecx;
345   vki_uint32_t edx;
346 };
347 
348 struct vki_xen_guest_tsc_info {
349     vki_uint32_t tsc_mode;
350     vki_uint32_t gtsc_khz;
351     vki_uint32_t incarnation;
352     vki_uint32_t pad;
353     vki_xen_uint64_aligned_t elapsed_nsec;
354 };
355 typedef struct vki_xen_guest_tsc_info vki_xen_guest_tsc_info_t;
356 DEFINE_VKI_XEN_GUEST_HANDLE(vki_xen_guest_tsc_info_t);
357 
358 struct vki_xen_domctl_tsc_info_00000007 {
359     VKI_XEN_GUEST_HANDLE_64(vki_xen_guest_tsc_info_t) out_info; /* OUT */
360     vki_xen_guest_tsc_info_t info; /* IN */
361 };
362 
363 /* 4.6 removed the output pointer */
364 struct vki_xen_domctl_tsc_info_0000000b {
365     /* IN/OUT */
366     vki_uint32_t tsc_mode;
367     vki_uint32_t gtsc_khz;
368     vki_uint32_t incarnation;
369     vki_uint32_t pad;
370     vki_xen_uint64_aligned_t elapsed_nsec;
371 };
372 
373 
374 struct vki_xen_domctl_hvmcontext {
375     vki_uint32_t size; /* IN/OUT size of buffer */
376     VKI_XEN_GUEST_HANDLE_64(vki_uint8) buffer; /* IN/OUT */
377 };
378 typedef struct vki_xen_domctl_hvmcontext vki_xen_domctl_hvmcontext_t;
379 DEFINE_VKI_XEN_GUEST_HANDLE(vki_xen_domctl_hvmcontext_t);
380 
381 struct vki_xen_domctl_hvmcontext_partial {
382     vki_uint32_t type; /* IN */
383     vki_uint32_t instance; /* IN */
384     VKI_XEN_GUEST_HANDLE_64(vki_uint8) buffer; /* IN/OUT buffer */
385 };
386 typedef struct vki_xen_domctl_hvmcontext_partial vki_xen_domctl_hvmcontext_partial_t;
387 DEFINE_VKI_XEN_GUEST_HANDLE(vki_xen_domctl_hvmcontext_partial_t);
388 
389 
390 struct vki_xen_domctl_pin_mem_cacheattr {
391     vki_xen_uint64_aligned_t start, end; /* IN */
392     vki_uint32_t type;                   /* IN */
393 };
394 
395 struct vki_xen_domctl_ext_vcpucontext_00000008 {
396     vki_uint32_t             vcpu; /* IN */
397 
398     /* IN  for XEN_DOMCTL_set_ext_vcpucontext
399      * OUT for XEN_DOMCTL_get_ext_vcpucontext */
400     vki_uint32_t             size;
401 #if defined(__i386__) || defined(__x86_64__)
402     vki_xen_uint64_aligned_t syscall32_callback_eip;
403     vki_xen_uint64_aligned_t sysenter_callback_eip;
404     vki_uint16_t             syscall32_callback_cs;
405     vki_uint16_t             sysenter_callback_cs;
406     vki_uint8_t              syscall32_disables_events;
407     vki_uint8_t              sysenter_disables_events;
408     vki_xen_uint64_aligned_t mcg_cap;
409 #endif
410 };
411 
412 struct vki_xen_domctl_ext_vcpucontext_00000009 {
413     vki_uint32_t             vcpu; /* IN */
414 
415     /* IN  for XEN_DOMCTL_set_ext_vcpucontext
416      * OUT for XEN_DOMCTL_get_ext_vcpucontext */
417     vki_uint32_t             size;
418 #if defined(__i386__) || defined(__x86_64__)
419     vki_xen_uint64_aligned_t syscall32_callback_eip;
420     vki_xen_uint64_aligned_t sysenter_callback_eip;
421     vki_uint16_t             syscall32_callback_cs;
422     vki_uint16_t             sysenter_callback_cs;
423     vki_uint8_t              syscall32_disables_events;
424     vki_uint8_t              sysenter_disables_events;
425     vki_uint64_t             caps;
426     vki_uint64_t             mci_ctl2_bank0;
427     vki_uint64_t             mci_ctl2_bank1;
428 #endif
429 };
430 
431 /* vki_xen_domctl_ext_vcpucontext_0000000a is the same as 00000009 */
432 
433 struct vki_xen_domctl_vcpuextstate {
434     vki_uint32_t         vcpu;
435     vki_xen_uint64_aligned_t         xfeature_mask;
436     vki_xen_uint64_aligned_t         size;
437     VKI_XEN_GUEST_HANDLE_64(vki_uint64) buffer;
438 };
439 
440 struct vki_xen_domctl_address_size {
441     vki_uint32_t size;
442 };
443 
444 /* vki_xen_domctl_assign_device_00000007 is the same up to version 0x0000000b */
445 struct vki_xen_domctl_assign_device_00000007 {
446     vki_uint32_t  machine_sbdf;   /* machine PCI ID of assigned device */
447 };
448 
449 #define VKI_XEN_DOMCTL_DEV_PCI      0
450 #define VKI_XEN_DOMCTL_DEV_DT       1
451 struct vki_xen_domctl_assign_device_0000000b {
452     vki_uint32_t dev;   /* XEN_DOMCTL_DEV_* */
453     union {
454         struct {
455             vki_uint32_t machine_sbdf;   /* machine PCI ID of assigned device */
456         } pci;
457         struct {
458             vki_uint32_t size; /* Length of the path */
459             VKI_XEN_GUEST_HANDLE_64(vki_uint8) path; /* path to the device tree node */
460         } dt;
461     } u;
462     /* IN */
463 //#define XEN_DOMCTL_DEV_RDM_RELAXED      1
464     vki_uint32_t  flag;   /* flag of assigned device */
465 };
466 
467 struct vki_xen_domctl_debug_op {
468     vki_uint32_t op;   /* IN */
469     vki_uint32_t vcpu; /* IN */
470 };
471 typedef struct vki_xen_domctl_debug_op vki_xen_domctl_debug_op_t;
472 
473 struct vki_xen_domctl_mem_event_op_00000007 {
474     vki_uint32_t op; /* IN */
475     vki_uint32_t mode; /* IN */
476     vki_uint32_t port; /* OUT */
477 };
478 
479 /* only a name change in 4.6 */
480 typedef struct vki_xen_domctl_mem_event_op_00000007 vki_xen_domctl_vm_event_op_0000000b;
481 
482 struct vki_xen_domctl_set_access_required {
483     vki_uint8_t access_required; /* IN */
484 };
485 
486 struct vki_xen_domctl_set_max_evtchn {
487     vki_uint32_t max_port;
488 };
489 
490 struct vki_xen_domctl_cacheflush {
491     /* IN: page range to flush. */
492     vki_xen_pfn_t start_pfn, nr_pfns;
493 };
494 
495 struct vki_xen_domctl_vcpu_msr {
496     vki_uint32_t             index;
497     vki_uint32_t             reserved;
498     vki_xen_uint64_aligned_t value;
499 };
500 typedef struct vki_xen_domctl_vcpu_msr vki_xen_domctl_vcpu_msr_t;
501 DEFINE_VKI_XEN_GUEST_HANDLE(vki_xen_domctl_vcpu_msr_t);
502 
503 struct vki_xen_domctl_vcpu_msrs {
504     vki_uint32_t vcpu;
505     vki_uint32_t msr_count;
506     VKI_XEN_GUEST_HANDLE_64(vki_xen_domctl_vcpu_msr_t) msrs;
507 };
508 
509 #define VKI_XEN_DOMCTL_MONITOR_OP_ENABLE            0
510 #define VKI_XEN_DOMCTL_MONITOR_OP_DISABLE           1
511 #define VKI_XEN_DOMCTL_MONITOR_OP_GET_CAPABILITIES  2
512 
513 #define VKI_XEN_DOMCTL_MONITOR_EVENT_WRITE_CTRLREG         0
514 #define VKI_XEN_DOMCTL_MONITOR_EVENT_MOV_TO_MSR            1
515 #define VKI_XEN_DOMCTL_MONITOR_EVENT_SINGLESTEP            2
516 #define VKI_XEN_DOMCTL_MONITOR_EVENT_SOFTWARE_BREAKPOINT   3
517 #define VKI_XEN_DOMCTL_MONITOR_EVENT_GUEST_REQUEST         4
518 
519 struct vki_xen_domctl_monitor_op_0000000b {
520     vki_uint32_t op; /* vki_xen_DOMCTL_MONITOR_OP_* */
521 
522     /*
523      * When used with ENABLE/DISABLE this has to be set to
524      * the requested vki_xen_DOMCTL_MONITOR_EVENT_* value.
525      * With GET_CAPABILITIES this field returns a bitmap of
526      * events supported by the platform, in the format
527      * (1 << vki_xen_DOMCTL_MONITOR_EVENT_*).
528      */
529     vki_uint32_t event;
530 
531     /*
532      * Further options when issuing vki_xen_DOMCTL_MONITOR_OP_ENABLE.
533      */
534     union {
535         struct {
536             /* Which control register */
537             vki_uint8_t index;
538             /* Pause vCPU until response */
539             vki_uint8_t sync;
540             /* Send event only on a change of value */
541             vki_uint8_t onchangeonly;
542         } mov_to_cr;
543 
544         struct {
545             /* Enable the capture of an extended set of MSRs */
546             vki_uint8_t extended_capture;
547         } mov_to_msr;
548 
549         struct {
550             /* Pause vCPU until response */
551             vki_uint8_t sync;
552         } guest_request;
553     } u;
554 };
555 
556 
557 struct vki_xen_domctl_monitor_op {
558     vki_uint32_t op;
559 #define VKI_XEN_DOMCTL_MONITOR_OP_ENABLE            0
560 #define VKI_XEN_DOMCTL_MONITOR_OP_DISABLE           1
561 #define VKI_XEN_DOMCTL_MONITOR_OP_GET_CAPABILITIES  2
562 #define VKI_XEN_DOMCTL_MONITOR_OP_EMULATE_EACH_REP  3
563     vki_uint32_t event;
564     union {
565         struct {
566             vki_uint8_t index;
567             vki_uint8_t sync;
568             vki_uint8_t onchangeonly;
569         } mov_to_cr;
570         struct {
571             vki_uint8_t extended_capture;
572         } mov_to_msr;
573         struct {
574             vki_uint8_t sync;
575         } guest_request;
576     } u;
577 };
578 
579 struct vki_xen_domctl {
580     vki_uint32_t cmd;
581     vki_uint32_t interface_version; /* XEN_DOMCTL_INTERFACE_VERSION */
582     vki_xen_domid_t  domain;
583     union {
584         struct vki_xen_domctl_createdomain      createdomain;
585         struct vki_xen_domctl_getdomaininfo_00000007 getdomaininfo_00000007;
586         struct vki_xen_domctl_getdomaininfo_00000008 getdomaininfo_00000008;
587         struct vki_xen_domctl_getdomaininfo_00000009 getdomaininfo_00000009;
588         //struct vki_xen_domctl_getmemlist        getmemlist;
589         //struct vki_xen_domctl_getpageframeinfo  getpageframeinfo;
590         //struct vki_xen_domctl_getpageframeinfo2 getpageframeinfo2;
591         struct vki_xen_domctl_getpageframeinfo3 getpageframeinfo3;
592         struct vki_xen_domctl_nodeaffinity      nodeaffinity;
593         struct vki_xen_domctl_vcpuaffinity_00000009 vcpuaffinity_00000009;
594         struct vki_xen_domctl_vcpuaffinity_0000000a vcpuaffinity_0000000a;
595         struct vki_xen_domctl_shadow_op         shadow_op;
596         struct vki_xen_domctl_max_mem           max_mem;
597         struct vki_xen_domctl_vcpucontext       vcpucontext;
598         struct vki_xen_domctl_getvcpuinfo       getvcpuinfo;
599         struct vki_xen_domctl_max_vcpus         max_vcpus;
600         struct vki_xen_domctl_scheduler_op      scheduler_op;
601         //struct vki_xen_domctl_setdomainhandle   setdomainhandle;
602         //struct vki_xen_domctl_setdebugging      setdebugging;
603         struct vki_xen_domctl_irq_permission    irq_permission;
604         struct vki_xen_domctl_iomem_permission  iomem_permission;
605         struct vki_xen_domctl_ioport_permission ioport_permission;
606         struct vki_xen_domctl_hypercall_init    hypercall_init;
607         //struct vki_xen_domctl_arch_setup        arch_setup;
608         struct vki_xen_domctl_settimeoffset     settimeoffset;
609         //struct vki_xen_domctl_disable_migrate   disable_migrate;
610         struct vki_xen_domctl_tsc_info_00000007   tsc_info_00000007;
611         struct vki_xen_domctl_tsc_info_0000000b   tsc_info_0000000b;
612         //struct vki_xen_domctl_real_mode_area    real_mode_area;
613         struct vki_xen_domctl_hvmcontext        hvmcontext;
614         struct vki_xen_domctl_hvmcontext_partial hvmcontext_partial;
615         struct vki_xen_domctl_address_size      address_size;
616         //struct vki_xen_domctl_sendtrigger       sendtrigger;
617         //struct vki_xen_domctl_get_device_group  get_device_group;
618         struct vki_xen_domctl_assign_device_00000007 assign_device_00000007;
619         struct vki_xen_domctl_assign_device_0000000b assign_device_0000000b;
620         //struct vki_xen_domctl_bind_pt_irq       bind_pt_irq;
621         //struct vki_xen_domctl_memory_mapping    memory_mapping;
622         //struct vki_xen_domctl_ioport_mapping    ioport_mapping;
623         struct vki_xen_domctl_pin_mem_cacheattr pin_mem_cacheattr;
624         struct vki_xen_domctl_ext_vcpucontext_00000008 ext_vcpucontext_00000008;
625         struct vki_xen_domctl_ext_vcpucontext_00000009 ext_vcpucontext_00000009;
626         //struct vki_xen_domctl_set_target        set_target;
627         //struct vki_xen_domctl_subscribe         subscribe;
628         struct vki_xen_domctl_debug_op          debug_op;
629         struct vki_xen_domctl_mem_event_op_00000007 mem_event_op_00000007;
630         vki_xen_domctl_vm_event_op_0000000b vm_event_op_0000000b;
631         //struct vki_xen_domctl_mem_sharing_op    mem_sharing_op;
632 #if defined(__i386__) || defined(__x86_64__)
633         struct vki_xen_domctl_cpuid             cpuid;
634         struct vki_xen_domctl_vcpuextstate      vcpuextstate;
635         struct vki_xen_domctl_vcpu_msrs         vcpu_msrs;
636 #endif
637         struct vki_xen_domctl_set_access_required access_required;
638         //struct vki_xen_domctl_audit_p2m         audit_p2m;
639         //struct vki_xen_domctl_set_virq_handler  set_virq_handler;
640         struct vki_xen_domctl_set_max_evtchn    set_max_evtchn;
641         //struct vki_xen_domctl_gdbsx_memio       gdbsx_guest_memio;
642         //struct vki_xen_domctl_set_broken_page_p2m set_broken_page_p2m;
643         struct vki_xen_domctl_cacheflush        cacheflush;
644         //struct vki_xen_domctl_gdbsx_pauseunp_vcpu gdbsx_pauseunp_vcpu;
645         //struct vki_xen_domctl_gdbsx_domstatus   gdbsx_domstatus;
646         struct vki_xen_domctl_monitor_op_0000000b monitor_op_0000000b;
647         vki_uint8_t                         pad[128];
648     } u;
649 };
650 
651 #endif // __VKI_XEN_DOMCTL_H
652 
653 /*--------------------------------------------------------------------*/
654 /*--- end                                                          ---*/
655 /*--------------------------------------------------------------------*/
656