1 /******************************************************************************
2  * domctl.h
3  *
4  * Domain management operations. For use by node control stack.
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a copy
7  * of this software and associated documentation files (the "Software"), to
8  * deal in the Software without restriction, including without limitation the
9  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10  * sell copies of the Software, and to permit persons to whom the Software is
11  * furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included in
14  * all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22  * DEALINGS IN THE SOFTWARE.
23  *
24  * Copyright (c) 2002-2003, B Dragovic
25  * Copyright (c) 2002-2006, K Fraser
26  */
27 
28 #ifndef __XEN_PUBLIC_DOMCTL_H__
29 #define __XEN_PUBLIC_DOMCTL_H__
30 
31 #if !defined(__XEN__) && !defined(__XEN_TOOLS__)
32 #error "domctl operations are intended for use by node control tools only"
33 #endif
34 
35 #include "xen.h"
36 #include "event_channel.h"
37 #include "grant_table.h"
38 #include "hvm/save.h"
39 #include "memory.h"
40 
41 #define XEN_DOMCTL_INTERFACE_VERSION 0x0000000f
42 
43 /*
44  * NB. xen_domctl.domain is an IN/OUT parameter for this operation.
45  * If it is specified as zero, an id is auto-allocated and returned.
46  */
47 /* XEN_DOMCTL_createdomain */
48 struct xen_domctl_createdomain {
49     /* IN parameters */
50     uint32_t ssidref;
51     xen_domain_handle_t handle;
52  /* Is this an HVM guest (as opposed to a PVH or PV guest)? */
53 #define _XEN_DOMCTL_CDF_hvm_guest     0
54 #define XEN_DOMCTL_CDF_hvm_guest      (1U<<_XEN_DOMCTL_CDF_hvm_guest)
55  /* Use hardware-assisted paging if available? */
56 #define _XEN_DOMCTL_CDF_hap           1
57 #define XEN_DOMCTL_CDF_hap            (1U<<_XEN_DOMCTL_CDF_hap)
58  /* Should domain memory integrity be verifed by tboot during Sx? */
59 #define _XEN_DOMCTL_CDF_s3_integrity  2
60 #define XEN_DOMCTL_CDF_s3_integrity   (1U<<_XEN_DOMCTL_CDF_s3_integrity)
61  /* Disable out-of-sync shadow page tables? */
62 #define _XEN_DOMCTL_CDF_oos_off       3
63 #define XEN_DOMCTL_CDF_oos_off        (1U<<_XEN_DOMCTL_CDF_oos_off)
64  /* Is this a xenstore domain? */
65 #define _XEN_DOMCTL_CDF_xs_domain     4
66 #define XEN_DOMCTL_CDF_xs_domain      (1U<<_XEN_DOMCTL_CDF_xs_domain)
67     uint32_t flags;
68     struct xen_arch_domainconfig config;
69 };
70 
71 /* XEN_DOMCTL_getdomaininfo */
72 struct xen_domctl_getdomaininfo {
73     /* OUT variables. */
74     domid_t  domain;              /* Also echoed in domctl.domain */
75  /* Domain is scheduled to die. */
76 #define _XEN_DOMINF_dying     0
77 #define XEN_DOMINF_dying      (1U<<_XEN_DOMINF_dying)
78  /* Domain is an HVM guest (as opposed to a PV guest). */
79 #define _XEN_DOMINF_hvm_guest 1
80 #define XEN_DOMINF_hvm_guest  (1U<<_XEN_DOMINF_hvm_guest)
81  /* The guest OS has shut down. */
82 #define _XEN_DOMINF_shutdown  2
83 #define XEN_DOMINF_shutdown   (1U<<_XEN_DOMINF_shutdown)
84  /* Currently paused by control software. */
85 #define _XEN_DOMINF_paused    3
86 #define XEN_DOMINF_paused     (1U<<_XEN_DOMINF_paused)
87  /* Currently blocked pending an event.     */
88 #define _XEN_DOMINF_blocked   4
89 #define XEN_DOMINF_blocked    (1U<<_XEN_DOMINF_blocked)
90  /* Domain is currently running.            */
91 #define _XEN_DOMINF_running   5
92 #define XEN_DOMINF_running    (1U<<_XEN_DOMINF_running)
93  /* Being debugged.  */
94 #define _XEN_DOMINF_debugged  6
95 #define XEN_DOMINF_debugged   (1U<<_XEN_DOMINF_debugged)
96 /* domain is a xenstore domain */
97 #define _XEN_DOMINF_xs_domain 7
98 #define XEN_DOMINF_xs_domain  (1U<<_XEN_DOMINF_xs_domain)
99 /* domain has hardware assisted paging */
100 #define _XEN_DOMINF_hap       8
101 #define XEN_DOMINF_hap        (1U<<_XEN_DOMINF_hap)
102  /* XEN_DOMINF_shutdown guest-supplied code.  */
103 #define XEN_DOMINF_shutdownmask 255
104 #define XEN_DOMINF_shutdownshift 16
105     uint32_t flags;              /* XEN_DOMINF_* */
106     uint64_aligned_t tot_pages;
107     uint64_aligned_t max_pages;
108     uint64_aligned_t outstanding_pages;
109     uint64_aligned_t shr_pages;
110     uint64_aligned_t paged_pages;
111     uint64_aligned_t shared_info_frame; /* GMFN of shared_info struct */
112     uint64_aligned_t cpu_time;
113     uint32_t nr_online_vcpus;    /* Number of VCPUs currently online. */
114 #define XEN_INVALID_MAX_VCPU_ID (~0U) /* Domain has no vcpus? */
115     uint32_t max_vcpu_id;        /* Maximum VCPUID in use by this domain. */
116     uint32_t ssidref;
117     xen_domain_handle_t handle;
118     uint32_t cpupool;
119     struct xen_arch_domainconfig arch_config;
120 };
121 typedef struct xen_domctl_getdomaininfo xen_domctl_getdomaininfo_t;
122 DEFINE_XEN_GUEST_HANDLE(xen_domctl_getdomaininfo_t);
123 
124 
125 /* XEN_DOMCTL_getmemlist */
126 struct xen_domctl_getmemlist {
127     /* IN variables. */
128     /* Max entries to write to output buffer. */
129     uint64_aligned_t max_pfns;
130     /* Start index in guest's page list. */
131     uint64_aligned_t start_pfn;
132     XEN_GUEST_HANDLE_64(uint64) buffer;
133     /* OUT variables. */
134     uint64_aligned_t num_pfns;
135 };
136 
137 
138 /* XEN_DOMCTL_getpageframeinfo */
139 
140 #define XEN_DOMCTL_PFINFO_LTAB_SHIFT 28
141 #define XEN_DOMCTL_PFINFO_NOTAB   (0x0U<<28)
142 #define XEN_DOMCTL_PFINFO_L1TAB   (0x1U<<28)
143 #define XEN_DOMCTL_PFINFO_L2TAB   (0x2U<<28)
144 #define XEN_DOMCTL_PFINFO_L3TAB   (0x3U<<28)
145 #define XEN_DOMCTL_PFINFO_L4TAB   (0x4U<<28)
146 #define XEN_DOMCTL_PFINFO_LTABTYPE_MASK (0x7U<<28)
147 #define XEN_DOMCTL_PFINFO_LPINTAB (0x1U<<31)
148 #define XEN_DOMCTL_PFINFO_XTAB    (0xfU<<28) /* invalid page */
149 #define XEN_DOMCTL_PFINFO_XALLOC  (0xeU<<28) /* allocate-only page */
150 #define XEN_DOMCTL_PFINFO_BROKEN  (0xdU<<28) /* broken page */
151 #define XEN_DOMCTL_PFINFO_LTAB_MASK (0xfU<<28)
152 
153 /* XEN_DOMCTL_getpageframeinfo3 */
154 struct xen_domctl_getpageframeinfo3 {
155     /* IN variables. */
156     uint64_aligned_t num;
157     /* IN/OUT variables. */
158     XEN_GUEST_HANDLE_64(xen_pfn_t) array;
159 };
160 
161 
162 /*
163  * Control shadow pagetables operation
164  */
165 /* XEN_DOMCTL_shadow_op */
166 
167 /* Disable shadow mode. */
168 #define XEN_DOMCTL_SHADOW_OP_OFF         0
169 
170 /* Enable shadow mode (mode contains ORed XEN_DOMCTL_SHADOW_ENABLE_* flags). */
171 #define XEN_DOMCTL_SHADOW_OP_ENABLE      32
172 
173 /* Log-dirty bitmap operations. */
174  /* Return the bitmap and clean internal copy for next round. */
175 #define XEN_DOMCTL_SHADOW_OP_CLEAN       11
176  /* Return the bitmap but do not modify internal copy. */
177 #define XEN_DOMCTL_SHADOW_OP_PEEK        12
178 
179 /* Memory allocation accessors. */
180 #define XEN_DOMCTL_SHADOW_OP_GET_ALLOCATION   30
181 #define XEN_DOMCTL_SHADOW_OP_SET_ALLOCATION   31
182 
183 /* Legacy enable operations. */
184  /* Equiv. to ENABLE with no mode flags. */
185 #define XEN_DOMCTL_SHADOW_OP_ENABLE_TEST       1
186  /* Equiv. to ENABLE with mode flag ENABLE_LOG_DIRTY. */
187 #define XEN_DOMCTL_SHADOW_OP_ENABLE_LOGDIRTY   2
188  /*
189   * No longer supported, was equiv. to ENABLE with mode flags
190   * ENABLE_REFCOUNT and ENABLE_TRANSLATE:
191 #define XEN_DOMCTL_SHADOW_OP_ENABLE_TRANSLATE  3
192   */
193 
194 /* Mode flags for XEN_DOMCTL_SHADOW_OP_ENABLE. */
195  /*
196   * Shadow pagetables are refcounted: guest does not use explicit mmu
197   * operations nor write-protect its pagetables.
198   */
199 #define XEN_DOMCTL_SHADOW_ENABLE_REFCOUNT  (1 << 1)
200  /*
201   * Log pages in a bitmap as they are dirtied.
202   * Used for live relocation to determine which pages must be re-sent.
203   */
204 #define XEN_DOMCTL_SHADOW_ENABLE_LOG_DIRTY (1 << 2)
205  /*
206   * Automatically translate GPFNs into MFNs.
207   */
208 #define XEN_DOMCTL_SHADOW_ENABLE_TRANSLATE (1 << 3)
209  /*
210   * Xen does not steal virtual address space from the guest.
211   * Requires HVM support.
212   */
213 #define XEN_DOMCTL_SHADOW_ENABLE_EXTERNAL  (1 << 4)
214 
215 /* Mode flags for XEN_DOMCTL_SHADOW_OP_{CLEAN,PEEK}. */
216  /*
217   * This is the final iteration: Requesting to include pages mapped
218   * writably by the hypervisor in the dirty bitmap.
219   */
220 #define XEN_DOMCTL_SHADOW_LOGDIRTY_FINAL   (1 << 0)
221 
222 struct xen_domctl_shadow_op_stats {
223     uint32_t fault_count;
224     uint32_t dirty_count;
225 };
226 
227 struct xen_domctl_shadow_op {
228     /* IN variables. */
229     uint32_t       op;       /* XEN_DOMCTL_SHADOW_OP_* */
230 
231     /* OP_ENABLE: XEN_DOMCTL_SHADOW_ENABLE_* */
232     /* OP_PEAK / OP_CLEAN: XEN_DOMCTL_SHADOW_LOGDIRTY_* */
233     uint32_t       mode;
234 
235     /* OP_GET_ALLOCATION / OP_SET_ALLOCATION */
236     uint32_t       mb;       /* Shadow memory allocation in MB */
237 
238     /* OP_PEEK / OP_CLEAN */
239     XEN_GUEST_HANDLE_64(uint8) dirty_bitmap;
240     uint64_aligned_t pages; /* Size of buffer. Updated with actual size. */
241     struct xen_domctl_shadow_op_stats stats;
242 };
243 
244 
245 /* XEN_DOMCTL_max_mem */
246 struct xen_domctl_max_mem {
247     /* IN variables. */
248     uint64_aligned_t max_memkb;
249 };
250 
251 
252 /* XEN_DOMCTL_setvcpucontext */
253 /* XEN_DOMCTL_getvcpucontext */
254 struct xen_domctl_vcpucontext {
255     uint32_t              vcpu;                  /* IN */
256     XEN_GUEST_HANDLE_64(vcpu_guest_context_t) ctxt; /* IN/OUT */
257 };
258 
259 
260 /* XEN_DOMCTL_getvcpuinfo */
261 struct xen_domctl_getvcpuinfo {
262     /* IN variables. */
263     uint32_t vcpu;
264     /* OUT variables. */
265     uint8_t  online;                  /* currently online (not hotplugged)? */
266     uint8_t  blocked;                 /* blocked waiting for an event? */
267     uint8_t  running;                 /* currently scheduled on its CPU? */
268     uint64_aligned_t cpu_time;        /* total cpu time consumed (ns) */
269     uint32_t cpu;                     /* current mapping   */
270 };
271 
272 
273 /* Get/set the NUMA node(s) with which the guest has affinity with. */
274 /* XEN_DOMCTL_setnodeaffinity */
275 /* XEN_DOMCTL_getnodeaffinity */
276 struct xen_domctl_nodeaffinity {
277     struct xenctl_bitmap nodemap;/* IN */
278 };
279 
280 
281 /* Get/set which physical cpus a vcpu can execute on. */
282 /* XEN_DOMCTL_setvcpuaffinity */
283 /* XEN_DOMCTL_getvcpuaffinity */
284 struct xen_domctl_vcpuaffinity {
285     /* IN variables. */
286     uint32_t  vcpu;
287  /* Set/get the hard affinity for vcpu */
288 #define _XEN_VCPUAFFINITY_HARD  0
289 #define XEN_VCPUAFFINITY_HARD   (1U<<_XEN_VCPUAFFINITY_HARD)
290  /* Set/get the soft affinity for vcpu */
291 #define _XEN_VCPUAFFINITY_SOFT  1
292 #define XEN_VCPUAFFINITY_SOFT   (1U<<_XEN_VCPUAFFINITY_SOFT)
293  /* Undo SCHEDOP_pin_override */
294 #define _XEN_VCPUAFFINITY_FORCE 2
295 #define XEN_VCPUAFFINITY_FORCE  (1U<<_XEN_VCPUAFFINITY_FORCE)
296     uint32_t flags;
297     /*
298      * IN/OUT variables.
299      *
300      * Both are IN/OUT for XEN_DOMCTL_setvcpuaffinity, in which case they
301      * contain effective hard or/and soft affinity. That is, upon successful
302      * return, cpumap_soft, contains the intersection of the soft affinity,
303      * hard affinity and the cpupool's online CPUs for the domain (if
304      * XEN_VCPUAFFINITY_SOFT was set in flags). cpumap_hard contains the
305      * intersection between hard affinity and the cpupool's online CPUs (if
306      * XEN_VCPUAFFINITY_HARD was set in flags).
307      *
308      * Both are OUT-only for XEN_DOMCTL_getvcpuaffinity, in which case they
309      * contain the plain hard and/or soft affinity masks that were set during
310      * previous successful calls to XEN_DOMCTL_setvcpuaffinity (or the
311      * default values), without intersecting or altering them in any way.
312      */
313     struct xenctl_bitmap cpumap_hard;
314     struct xenctl_bitmap cpumap_soft;
315 };
316 
317 
318 /* XEN_DOMCTL_max_vcpus */
319 struct xen_domctl_max_vcpus {
320     uint32_t max;           /* maximum number of vcpus */
321 };
322 
323 
324 /* XEN_DOMCTL_scheduler_op */
325 /* Scheduler types. */
326 /* #define XEN_SCHEDULER_SEDF  4 (Removed) */
327 #define XEN_SCHEDULER_CREDIT   5
328 #define XEN_SCHEDULER_CREDIT2  6
329 #define XEN_SCHEDULER_ARINC653 7
330 #define XEN_SCHEDULER_RTDS     8
331 #define XEN_SCHEDULER_NULL     9
332 
333 struct xen_domctl_sched_credit {
334     uint16_t weight;
335     uint16_t cap;
336 };
337 
338 struct xen_domctl_sched_credit2 {
339     uint16_t weight;
340     uint16_t cap;
341 };
342 
343 struct xen_domctl_sched_rtds {
344     uint32_t period;
345     uint32_t budget;
346 /* Can this vCPU execute beyond its reserved amount of time? */
347 #define _XEN_DOMCTL_SCHEDRT_extra   0
348 #define XEN_DOMCTL_SCHEDRT_extra    (1U<<_XEN_DOMCTL_SCHEDRT_extra)
349     uint32_t flags;
350 };
351 
352 typedef struct xen_domctl_schedparam_vcpu {
353     union {
354         struct xen_domctl_sched_credit credit;
355         struct xen_domctl_sched_credit2 credit2;
356         struct xen_domctl_sched_rtds rtds;
357     } u;
358     uint32_t vcpuid;
359 } xen_domctl_schedparam_vcpu_t;
360 DEFINE_XEN_GUEST_HANDLE(xen_domctl_schedparam_vcpu_t);
361 
362 /*
363  * Set or get info?
364  * For schedulers supporting per-vcpu settings (e.g., RTDS):
365  *  XEN_DOMCTL_SCHEDOP_putinfo sets params for all vcpus;
366  *  XEN_DOMCTL_SCHEDOP_getinfo gets default params;
367  *  XEN_DOMCTL_SCHEDOP_put(get)vcpuinfo sets (gets) params of vcpus;
368  *
369  * For schedulers not supporting per-vcpu settings:
370  *  XEN_DOMCTL_SCHEDOP_putinfo sets params for all vcpus;
371  *  XEN_DOMCTL_SCHEDOP_getinfo gets domain-wise params;
372  *  XEN_DOMCTL_SCHEDOP_put(get)vcpuinfo returns error;
373  */
374 #define XEN_DOMCTL_SCHEDOP_putinfo 0
375 #define XEN_DOMCTL_SCHEDOP_getinfo 1
376 #define XEN_DOMCTL_SCHEDOP_putvcpuinfo 2
377 #define XEN_DOMCTL_SCHEDOP_getvcpuinfo 3
378 struct xen_domctl_scheduler_op {
379     uint32_t sched_id;  /* XEN_SCHEDULER_* */
380     uint32_t cmd;       /* XEN_DOMCTL_SCHEDOP_* */
381     /* IN/OUT */
382     union {
383         struct xen_domctl_sched_credit credit;
384         struct xen_domctl_sched_credit2 credit2;
385         struct xen_domctl_sched_rtds rtds;
386         struct {
387             XEN_GUEST_HANDLE_64(xen_domctl_schedparam_vcpu_t) vcpus;
388             /*
389              * IN: Number of elements in vcpus array.
390              * OUT: Number of processed elements of vcpus array.
391              */
392             uint32_t nr_vcpus;
393             uint32_t padding;
394         } v;
395     } u;
396 };
397 
398 
399 /* XEN_DOMCTL_setdomainhandle */
400 struct xen_domctl_setdomainhandle {
401     xen_domain_handle_t handle;
402 };
403 
404 
405 /* XEN_DOMCTL_setdebugging */
406 struct xen_domctl_setdebugging {
407     uint8_t enable;
408 };
409 
410 
411 /* XEN_DOMCTL_irq_permission */
412 struct xen_domctl_irq_permission {
413     uint8_t pirq;
414     uint8_t allow_access;    /* flag to specify enable/disable of IRQ access */
415 };
416 
417 
418 /* XEN_DOMCTL_iomem_permission */
419 struct xen_domctl_iomem_permission {
420     uint64_aligned_t first_mfn;/* first page (physical page number) in range */
421     uint64_aligned_t nr_mfns;  /* number of pages in range (>0) */
422     uint8_t  allow_access;     /* allow (!0) or deny (0) access to range? */
423 };
424 
425 
426 /* XEN_DOMCTL_ioport_permission */
427 struct xen_domctl_ioport_permission {
428     uint32_t first_port;              /* first port int range */
429     uint32_t nr_ports;                /* size of port range */
430     uint8_t  allow_access;            /* allow or deny access to range? */
431 };
432 
433 
434 /* XEN_DOMCTL_hypercall_init */
435 struct xen_domctl_hypercall_init {
436     uint64_aligned_t  gmfn;           /* GMFN to be initialised */
437 };
438 
439 
440 /* XEN_DOMCTL_settimeoffset */
441 struct xen_domctl_settimeoffset {
442     int64_aligned_t time_offset_seconds; /* applied to domain wallclock time */
443 };
444 
445 /* XEN_DOMCTL_gethvmcontext */
446 /* XEN_DOMCTL_sethvmcontext */
447 struct xen_domctl_hvmcontext {
448     uint32_t size; /* IN/OUT: size of buffer / bytes filled */
449     XEN_GUEST_HANDLE_64(uint8) buffer; /* IN/OUT: data, or call
450                                         * gethvmcontext with NULL
451                                         * buffer to get size req'd */
452 };
453 
454 
455 /* XEN_DOMCTL_set_address_size */
456 /* XEN_DOMCTL_get_address_size */
457 struct xen_domctl_address_size {
458     uint32_t size;
459 };
460 
461 
462 /* XEN_DOMCTL_sendtrigger */
463 #define XEN_DOMCTL_SENDTRIGGER_NMI    0
464 #define XEN_DOMCTL_SENDTRIGGER_RESET  1
465 #define XEN_DOMCTL_SENDTRIGGER_INIT   2
466 #define XEN_DOMCTL_SENDTRIGGER_POWER  3
467 #define XEN_DOMCTL_SENDTRIGGER_SLEEP  4
468 struct xen_domctl_sendtrigger {
469     uint32_t  trigger;  /* IN */
470     uint32_t  vcpu;     /* IN */
471 };
472 
473 
474 /* Assign a device to a guest. Sets up IOMMU structures. */
475 /* XEN_DOMCTL_assign_device */
476 /*
477  * XEN_DOMCTL_test_assign_device: Pass DOMID_INVALID to find out whether the
478  * given device is assigned to any DomU at all. Pass a specific domain ID to
479  * find out whether the given device can be assigned to that domain.
480  */
481 /*
482  * XEN_DOMCTL_deassign_device: The behavior of this DOMCTL differs
483  * between the different type of device:
484  *  - PCI device (XEN_DOMCTL_DEV_PCI) will be reassigned to DOM0
485  *  - DT device (XEN_DOMCTL_DEV_DT) will left unassigned. DOM0
486  *  will have to call XEN_DOMCTL_assign_device in order to use the
487  *  device.
488  */
489 #define XEN_DOMCTL_DEV_PCI      0
490 #define XEN_DOMCTL_DEV_DT       1
491 struct xen_domctl_assign_device {
492     /* IN */
493     uint32_t dev;   /* XEN_DOMCTL_DEV_* */
494     uint32_t flags;
495 #define XEN_DOMCTL_DEV_RDM_RELAXED      1 /* assign only */
496     union {
497         struct {
498             uint32_t machine_sbdf;   /* machine PCI ID of assigned device */
499         } pci;
500         struct {
501             uint32_t size; /* Length of the path */
502             XEN_GUEST_HANDLE_64(char) path; /* path to the device tree node */
503         } dt;
504     } u;
505 };
506 
507 /* Retrieve sibling devices infomation of machine_sbdf */
508 /* XEN_DOMCTL_get_device_group */
509 struct xen_domctl_get_device_group {
510     uint32_t  machine_sbdf;     /* IN */
511     uint32_t  max_sdevs;        /* IN */
512     uint32_t  num_sdevs;        /* OUT */
513     XEN_GUEST_HANDLE_64(uint32)  sdev_array;   /* OUT */
514 };
515 
516 /* Pass-through interrupts: bind real irq -> hvm devfn. */
517 /* XEN_DOMCTL_bind_pt_irq */
518 /* XEN_DOMCTL_unbind_pt_irq */
519 enum pt_irq_type {
520     PT_IRQ_TYPE_PCI,
521     PT_IRQ_TYPE_ISA,
522     PT_IRQ_TYPE_MSI,
523     PT_IRQ_TYPE_MSI_TRANSLATE,
524     PT_IRQ_TYPE_SPI,    /* ARM: valid range 32-1019 */
525 };
526 struct xen_domctl_bind_pt_irq {
527     uint32_t machine_irq;
528     uint32_t irq_type; /* enum pt_irq_type */
529 
530     union {
531         struct {
532             uint8_t isa_irq;
533         } isa;
534         struct {
535             uint8_t bus;
536             uint8_t device;
537             uint8_t intx;
538         } pci;
539         struct {
540             uint8_t gvec;
541             uint32_t gflags;
542 #define XEN_DOMCTL_VMSI_X86_DEST_ID_MASK 0x0000ff
543 #define XEN_DOMCTL_VMSI_X86_RH_MASK      0x000100
544 #define XEN_DOMCTL_VMSI_X86_DM_MASK      0x000200
545 #define XEN_DOMCTL_VMSI_X86_DELIV_MASK   0x007000
546 #define XEN_DOMCTL_VMSI_X86_TRIG_MASK    0x008000
547 #define XEN_DOMCTL_VMSI_X86_UNMASKED     0x010000
548 
549             uint64_aligned_t gtable;
550         } msi;
551         struct {
552             uint16_t spi;
553         } spi;
554     } u;
555 };
556 
557 
558 /* Bind machine I/O address range -> HVM address range. */
559 /* XEN_DOMCTL_memory_mapping */
560 /* Returns
561    - zero     success, everything done
562    - -E2BIG   passed in nr_mfns value too large for the implementation
563    - positive partial success for the first <result> page frames (with
564               <result> less than nr_mfns), requiring re-invocation by the
565               caller after updating inputs
566    - negative error; other than -E2BIG
567 */
568 #define DPCI_ADD_MAPPING         1
569 #define DPCI_REMOVE_MAPPING      0
570 struct xen_domctl_memory_mapping {
571     uint64_aligned_t first_gfn; /* first page (hvm guest phys page) in range */
572     uint64_aligned_t first_mfn; /* first page (machine page) in range */
573     uint64_aligned_t nr_mfns;   /* number of pages in range (>0) */
574     uint32_t add_mapping;       /* add or remove mapping */
575     uint32_t padding;           /* padding for 64-bit aligned structure */
576 };
577 
578 
579 /* Bind machine I/O port range -> HVM I/O port range. */
580 /* XEN_DOMCTL_ioport_mapping */
581 struct xen_domctl_ioport_mapping {
582     uint32_t first_gport;     /* first guest IO port*/
583     uint32_t first_mport;     /* first machine IO port */
584     uint32_t nr_ports;        /* size of port range */
585     uint32_t add_mapping;     /* add or remove mapping */
586 };
587 
588 
589 /*
590  * Pin caching type of RAM space for x86 HVM domU.
591  */
592 /* XEN_DOMCTL_pin_mem_cacheattr */
593 /* Caching types: these happen to be the same as x86 MTRR/PAT type codes. */
594 #define XEN_DOMCTL_MEM_CACHEATTR_UC  0
595 #define XEN_DOMCTL_MEM_CACHEATTR_WC  1
596 #define XEN_DOMCTL_MEM_CACHEATTR_WT  4
597 #define XEN_DOMCTL_MEM_CACHEATTR_WP  5
598 #define XEN_DOMCTL_MEM_CACHEATTR_WB  6
599 #define XEN_DOMCTL_MEM_CACHEATTR_UCM 7
600 #define XEN_DOMCTL_DELETE_MEM_CACHEATTR (~(uint32_t)0)
601 struct xen_domctl_pin_mem_cacheattr {
602     uint64_aligned_t start, end;
603     uint32_t type; /* XEN_DOMCTL_MEM_CACHEATTR_* */
604 };
605 
606 
607 /* XEN_DOMCTL_set_ext_vcpucontext */
608 /* XEN_DOMCTL_get_ext_vcpucontext */
609 struct xen_domctl_ext_vcpucontext {
610     /* IN: VCPU that this call applies to. */
611     uint32_t         vcpu;
612     /*
613      * SET: Size of struct (IN)
614      * GET: Size of struct (OUT, up to 128 bytes)
615      */
616     uint32_t         size;
617 #if defined(__i386__) || defined(__x86_64__)
618     /* SYSCALL from 32-bit mode and SYSENTER callback information. */
619     /* NB. SYSCALL from 64-bit mode is contained in vcpu_guest_context_t */
620     uint64_aligned_t syscall32_callback_eip;
621     uint64_aligned_t sysenter_callback_eip;
622     uint16_t         syscall32_callback_cs;
623     uint16_t         sysenter_callback_cs;
624     uint8_t          syscall32_disables_events;
625     uint8_t          sysenter_disables_events;
626 #if defined(__GNUC__)
627     union {
628         uint64_aligned_t mcg_cap;
629         struct hvm_vmce_vcpu vmce;
630     };
631 #else
632     struct hvm_vmce_vcpu vmce;
633 #endif
634 #endif
635 };
636 
637 /*
638  * Set the target domain for a domain
639  */
640 /* XEN_DOMCTL_set_target */
641 struct xen_domctl_set_target {
642     domid_t target;
643 };
644 
645 #if defined(__i386__) || defined(__x86_64__)
646 # define XEN_CPUID_INPUT_UNUSED  0xFFFFFFFF
647 /* XEN_DOMCTL_set_cpuid */
648 struct xen_domctl_cpuid {
649   uint32_t input[2];
650   uint32_t eax;
651   uint32_t ebx;
652   uint32_t ecx;
653   uint32_t edx;
654 };
655 #endif
656 
657 /*
658  * Arranges that if the domain suspends (specifically, if it shuts
659  * down with code SHUTDOWN_suspend), this event channel will be
660  * notified.
661  *
662  * This is _instead of_ the usual notification to the global
663  * VIRQ_DOM_EXC.  (In most systems that pirq is owned by xenstored.)
664  *
665  * Only one subscription per domain is possible.  Last subscriber
666  * wins; others are silently displaced.
667  *
668  * NB that contrary to the rather general name, it only applies to
669  * domain shutdown with code suspend.  Shutdown for other reasons
670  * (including crash), and domain death, are notified to VIRQ_DOM_EXC
671  * regardless.
672  */
673 /* XEN_DOMCTL_subscribe */
674 struct xen_domctl_subscribe {
675     uint32_t port; /* IN */
676 };
677 
678 /*
679  * Define the maximum machine address size which should be allocated
680  * to a guest.
681  */
682 /* XEN_DOMCTL_set_machine_address_size */
683 /* XEN_DOMCTL_get_machine_address_size */
684 
685 /*
686  * Do not inject spurious page faults into this domain.
687  */
688 /* XEN_DOMCTL_suppress_spurious_page_faults */
689 
690 /* XEN_DOMCTL_debug_op */
691 #define XEN_DOMCTL_DEBUG_OP_SINGLE_STEP_OFF         0
692 #define XEN_DOMCTL_DEBUG_OP_SINGLE_STEP_ON          1
693 struct xen_domctl_debug_op {
694     uint32_t op;   /* IN */
695     uint32_t vcpu; /* IN */
696 };
697 
698 /*
699  * Request a particular record from the HVM context
700  */
701 /* XEN_DOMCTL_gethvmcontext_partial */
702 struct xen_domctl_hvmcontext_partial {
703     uint32_t type;                      /* IN: Type of record required */
704     uint32_t instance;                  /* IN: Instance of that type */
705     uint64_aligned_t bufsz;             /* IN: size of buffer */
706     XEN_GUEST_HANDLE_64(uint8) buffer;  /* OUT: buffer to write record into */
707 };
708 
709 /* XEN_DOMCTL_disable_migrate */
710 struct xen_domctl_disable_migrate {
711     uint32_t disable; /* IN: 1: disable migration and restore */
712 };
713 
714 
715 /* XEN_DOMCTL_gettscinfo */
716 /* XEN_DOMCTL_settscinfo */
717 struct xen_domctl_tsc_info {
718     /* IN/OUT */
719     uint32_t tsc_mode;
720     uint32_t gtsc_khz;
721     uint32_t incarnation;
722     uint32_t pad;
723     uint64_aligned_t elapsed_nsec;
724 };
725 
726 /* XEN_DOMCTL_gdbsx_guestmemio      guest mem io */
727 struct xen_domctl_gdbsx_memio {
728     /* IN */
729     uint64_aligned_t pgd3val;/* optional: init_mm.pgd[3] value */
730     uint64_aligned_t gva;    /* guest virtual address */
731     uint64_aligned_t uva;    /* user buffer virtual address */
732     uint32_t         len;    /* number of bytes to read/write */
733     uint8_t          gwr;    /* 0 = read from guest. 1 = write to guest */
734     /* OUT */
735     uint32_t         remain; /* bytes remaining to be copied */
736 };
737 
738 /* XEN_DOMCTL_gdbsx_pausevcpu */
739 /* XEN_DOMCTL_gdbsx_unpausevcpu */
740 struct xen_domctl_gdbsx_pauseunp_vcpu { /* pause/unpause a vcpu */
741     uint32_t         vcpu;         /* which vcpu */
742 };
743 
744 /* XEN_DOMCTL_gdbsx_domstatus */
745 struct xen_domctl_gdbsx_domstatus {
746     /* OUT */
747     uint8_t          paused;     /* is the domain paused */
748     uint32_t         vcpu_id;    /* any vcpu in an event? */
749     uint32_t         vcpu_ev;    /* if yes, what event? */
750 };
751 
752 /*
753  * VM event operations
754  */
755 
756 /* XEN_DOMCTL_vm_event_op */
757 
758 /*
759  * There are currently three rings available for VM events:
760  * sharing, monitor and paging. This hypercall allows one to
761  * control these rings (enable/disable), as well as to signal
762  * to the hypervisor to pull responses (resume) from the given
763  * ring.
764  */
765 #define XEN_VM_EVENT_ENABLE               0
766 #define XEN_VM_EVENT_DISABLE              1
767 #define XEN_VM_EVENT_RESUME               2
768 
769 /*
770  * Domain memory paging
771  * Page memory in and out.
772  * Domctl interface to set up and tear down the
773  * pager<->hypervisor interface. Use XENMEM_paging_op*
774  * to perform per-page operations.
775  *
776  * The XEN_VM_EVENT_PAGING_ENABLE domctl returns several
777  * non-standard error codes to indicate why paging could not be enabled:
778  * ENODEV - host lacks HAP support (EPT/NPT) or HAP is disabled in guest
779  * EMLINK - guest has iommu passthrough enabled
780  * EXDEV  - guest has PoD enabled
781  * EBUSY  - guest has or had paging enabled, ring buffer still active
782  */
783 #define XEN_DOMCTL_VM_EVENT_OP_PAGING            1
784 
785 /*
786  * Monitor helper.
787  *
788  * As with paging, use the domctl for teardown/setup of the
789  * helper<->hypervisor interface.
790  *
791  * The monitor interface can be used to register for various VM events. For
792  * example, there are HVM hypercalls to set the per-page access permissions
793  * of every page in a domain.  When one of these permissions--independent,
794  * read, write, and execute--is violated, the VCPU is paused and a memory event
795  * is sent with what happened. The memory event handler can then resume the
796  * VCPU and redo the access with a XEN_VM_EVENT_RESUME option.
797  *
798  * See public/vm_event.h for the list of available events that can be
799  * subscribed to via the monitor interface.
800  *
801  * The XEN_VM_EVENT_MONITOR_* domctls returns
802  * non-standard error codes to indicate why access could not be enabled:
803  * ENODEV - host lacks HAP support (EPT/NPT) or HAP is disabled in guest
804  * EBUSY  - guest has or had access enabled, ring buffer still active
805  *
806  */
807 #define XEN_DOMCTL_VM_EVENT_OP_MONITOR           2
808 
809 /*
810  * Sharing ENOMEM helper.
811  *
812  * As with paging, use the domctl for teardown/setup of the
813  * helper<->hypervisor interface.
814  *
815  * If setup, this ring is used to communicate failed allocations
816  * in the unshare path. XENMEM_sharing_op_resume is used to wake up
817  * vcpus that could not unshare.
818  *
819  * Note that shring can be turned on (as per the domctl below)
820  * *without* this ring being setup.
821  */
822 #define XEN_DOMCTL_VM_EVENT_OP_SHARING           3
823 
824 /* Use for teardown/setup of helper<->hypervisor interface for paging,
825  * access and sharing.*/
826 struct xen_domctl_vm_event_op {
827     uint32_t       op;           /* XEN_VM_EVENT_* */
828     uint32_t       mode;         /* XEN_DOMCTL_VM_EVENT_OP_* */
829 
830     uint32_t port;              /* OUT: event channel for ring */
831 };
832 
833 /*
834  * Memory sharing operations
835  */
836 /* XEN_DOMCTL_mem_sharing_op.
837  * The CONTROL sub-domctl is used for bringup/teardown. */
838 #define XEN_DOMCTL_MEM_SHARING_CONTROL          0
839 
840 struct xen_domctl_mem_sharing_op {
841     uint8_t op; /* XEN_DOMCTL_MEM_SHARING_* */
842 
843     union {
844         uint8_t enable;                   /* CONTROL */
845     } u;
846 };
847 
848 struct xen_domctl_audit_p2m {
849     /* OUT error counts */
850     uint64_t orphans;
851     uint64_t m2p_bad;
852     uint64_t p2m_bad;
853 };
854 
855 struct xen_domctl_set_virq_handler {
856     uint32_t virq; /* IN */
857 };
858 
859 #if defined(__i386__) || defined(__x86_64__)
860 /* XEN_DOMCTL_setvcpuextstate */
861 /* XEN_DOMCTL_getvcpuextstate */
862 struct xen_domctl_vcpuextstate {
863     /* IN: VCPU that this call applies to. */
864     uint32_t         vcpu;
865     /*
866      * SET: Ignored.
867      * GET: xfeature support mask of struct (IN/OUT)
868      * xfeature mask is served as identifications of the saving format
869      * so that compatible CPUs can have a check on format to decide
870      * whether it can restore.
871      */
872     uint64_aligned_t         xfeature_mask;
873     /*
874      * SET: Size of struct (IN)
875      * GET: Size of struct (IN/OUT)
876      */
877     uint64_aligned_t         size;
878     XEN_GUEST_HANDLE_64(uint64) buffer;
879 };
880 #endif
881 
882 /* XEN_DOMCTL_set_access_required: sets whether a memory event listener
883  * must be present to handle page access events: if false, the page
884  * access will revert to full permissions if no one is listening;
885  *  */
886 struct xen_domctl_set_access_required {
887     uint8_t access_required;
888 };
889 
890 struct xen_domctl_set_broken_page_p2m {
891     uint64_aligned_t pfn;
892 };
893 
894 /*
895  * XEN_DOMCTL_set_max_evtchn: sets the maximum event channel port
896  * number the guest may use.  Use this limit the amount of resources
897  * (global mapping space, xenheap) a guest may use for event channels.
898  */
899 struct xen_domctl_set_max_evtchn {
900     uint32_t max_port;
901 };
902 
903 /*
904  * ARM: Clean and invalidate caches associated with given region of
905  * guest memory.
906  */
907 struct xen_domctl_cacheflush {
908     /* IN: page range to flush. */
909     xen_pfn_t start_pfn, nr_pfns;
910 };
911 
912 #if defined(__i386__) || defined(__x86_64__)
913 struct xen_domctl_vcpu_msr {
914     uint32_t         index;
915     uint32_t         reserved;
916     uint64_aligned_t value;
917 };
918 typedef struct xen_domctl_vcpu_msr xen_domctl_vcpu_msr_t;
919 DEFINE_XEN_GUEST_HANDLE(xen_domctl_vcpu_msr_t);
920 
921 /*
922  * XEN_DOMCTL_set_vcpu_msrs / XEN_DOMCTL_get_vcpu_msrs.
923  *
924  * Input:
925  * - A NULL 'msrs' guest handle is a request for the maximum 'msr_count'.
926  * - Otherwise, 'msr_count' is the number of entries in 'msrs'.
927  *
928  * Output for get:
929  * - If 'msr_count' is less than the number Xen needs to write, -ENOBUFS shall
930  *   be returned and 'msr_count' updated to reflect the intended number.
931  * - On success, 'msr_count' shall indicate the number of MSRs written, which
932  *   may be less than the maximum if some are not currently used by the vcpu.
933  *
934  * Output for set:
935  * - If Xen encounters an error with a specific MSR, -EINVAL shall be returned
936  *   and 'msr_count' shall be set to the offending index, to aid debugging.
937  */
938 struct xen_domctl_vcpu_msrs {
939     uint32_t vcpu;                                   /* IN     */
940     uint32_t msr_count;                              /* IN/OUT */
941     XEN_GUEST_HANDLE_64(xen_domctl_vcpu_msr_t) msrs; /* IN/OUT */
942 };
943 #endif
944 
945 /* XEN_DOMCTL_setvnumainfo: specifies a virtual NUMA topology for the guest */
946 struct xen_domctl_vnuma {
947     /* IN: number of vNUMA nodes to setup. Shall be greater than 0 */
948     uint32_t nr_vnodes;
949     /* IN: number of memory ranges to setup */
950     uint32_t nr_vmemranges;
951     /*
952      * IN: number of vCPUs of the domain (used as size of the vcpu_to_vnode
953      * array declared below). Shall be equal to the domain's max_vcpus.
954      */
955     uint32_t nr_vcpus;
956     uint32_t pad;                                  /* must be zero */
957 
958     /*
959      * IN: array for specifying the distances of the vNUMA nodes
960      * between each others. Shall have nr_vnodes*nr_vnodes elements.
961      */
962     XEN_GUEST_HANDLE_64(uint) vdistance;
963     /*
964      * IN: array for specifying to what vNUMA node each vCPU belongs.
965      * Shall have nr_vcpus elements.
966      */
967     XEN_GUEST_HANDLE_64(uint) vcpu_to_vnode;
968     /*
969      * IN: array for specifying on what physical NUMA node each vNUMA
970      * node is placed. Shall have nr_vnodes elements.
971      */
972     XEN_GUEST_HANDLE_64(uint) vnode_to_pnode;
973     /*
974      * IN: array for specifying the memory ranges. Shall have
975      * nr_vmemranges elements.
976      */
977     XEN_GUEST_HANDLE_64(xen_vmemrange_t) vmemrange;
978 };
979 
980 struct xen_domctl_psr_cmt_op {
981 #define XEN_DOMCTL_PSR_CMT_OP_DETACH         0
982 #define XEN_DOMCTL_PSR_CMT_OP_ATTACH         1
983 #define XEN_DOMCTL_PSR_CMT_OP_QUERY_RMID     2
984     uint32_t cmd;
985     uint32_t data;
986 };
987 
988 /*  XEN_DOMCTL_MONITOR_*
989  *
990  * Enable/disable monitoring various VM events.
991  * This domctl configures what events will be reported to helper apps
992  * via the ring buffer "MONITOR". The ring has to be first enabled
993  * with the domctl XEN_DOMCTL_VM_EVENT_OP_MONITOR.
994  *
995  * GET_CAPABILITIES can be used to determine which of these features is
996  * available on a given platform.
997  *
998  * NOTICE: mem_access events are also delivered via the "MONITOR" ring buffer;
999  * however, enabling/disabling those events is performed with the use of
1000  * memory_op hypercalls!
1001  */
1002 #define XEN_DOMCTL_MONITOR_OP_ENABLE            0
1003 #define XEN_DOMCTL_MONITOR_OP_DISABLE           1
1004 #define XEN_DOMCTL_MONITOR_OP_GET_CAPABILITIES  2
1005 #define XEN_DOMCTL_MONITOR_OP_EMULATE_EACH_REP  3
1006 
1007 #define XEN_DOMCTL_MONITOR_EVENT_WRITE_CTRLREG         0
1008 #define XEN_DOMCTL_MONITOR_EVENT_MOV_TO_MSR            1
1009 #define XEN_DOMCTL_MONITOR_EVENT_SINGLESTEP            2
1010 #define XEN_DOMCTL_MONITOR_EVENT_SOFTWARE_BREAKPOINT   3
1011 #define XEN_DOMCTL_MONITOR_EVENT_GUEST_REQUEST         4
1012 #define XEN_DOMCTL_MONITOR_EVENT_DEBUG_EXCEPTION       5
1013 #define XEN_DOMCTL_MONITOR_EVENT_CPUID                 6
1014 #define XEN_DOMCTL_MONITOR_EVENT_PRIVILEGED_CALL       7
1015 #define XEN_DOMCTL_MONITOR_EVENT_INTERRUPT             8
1016 #define XEN_DOMCTL_MONITOR_EVENT_DESC_ACCESS           9
1017 #define XEN_DOMCTL_MONITOR_EVENT_EMUL_UNIMPLEMENTED    10
1018 
1019 struct xen_domctl_monitor_op {
1020     uint32_t op; /* XEN_DOMCTL_MONITOR_OP_* */
1021 
1022     /*
1023      * When used with ENABLE/DISABLE this has to be set to
1024      * the requested XEN_DOMCTL_MONITOR_EVENT_* value.
1025      * With GET_CAPABILITIES this field returns a bitmap of
1026      * events supported by the platform, in the format
1027      * (1 << XEN_DOMCTL_MONITOR_EVENT_*).
1028      */
1029     uint32_t event;
1030 
1031     /*
1032      * Further options when issuing XEN_DOMCTL_MONITOR_OP_ENABLE.
1033      */
1034     union {
1035         struct {
1036             /* Which control register */
1037             uint8_t index;
1038             /* Pause vCPU until response */
1039             uint8_t sync;
1040             /* Send event only on a change of value */
1041             uint8_t onchangeonly;
1042             /* Allignment padding */
1043             uint8_t pad1;
1044             uint32_t pad2;
1045             /*
1046              * Send event only if the changed bit in the control register
1047              * is not masked.
1048              */
1049             uint64_aligned_t bitmask;
1050         } mov_to_cr;
1051 
1052         struct {
1053             uint32_t msr;
1054         } mov_to_msr;
1055 
1056         struct {
1057             /* Pause vCPU until response */
1058             uint8_t sync;
1059             uint8_t allow_userspace;
1060         } guest_request;
1061 
1062         struct {
1063             /* Pause vCPU until response */
1064             uint8_t sync;
1065         } debug_exception;
1066     } u;
1067 };
1068 
1069 struct xen_domctl_psr_cat_op {
1070 #define XEN_DOMCTL_PSR_CAT_OP_SET_L3_CBM     0
1071 #define XEN_DOMCTL_PSR_CAT_OP_GET_L3_CBM     1
1072 #define XEN_DOMCTL_PSR_CAT_OP_SET_L3_CODE    2
1073 #define XEN_DOMCTL_PSR_CAT_OP_SET_L3_DATA    3
1074 #define XEN_DOMCTL_PSR_CAT_OP_GET_L3_CODE    4
1075 #define XEN_DOMCTL_PSR_CAT_OP_GET_L3_DATA    5
1076 #define XEN_DOMCTL_PSR_CAT_OP_SET_L2_CBM     6
1077 #define XEN_DOMCTL_PSR_CAT_OP_GET_L2_CBM     7
1078     uint32_t cmd;       /* IN: XEN_DOMCTL_PSR_CAT_OP_* */
1079     uint32_t target;    /* IN */
1080     uint64_t data;      /* IN/OUT */
1081 };
1082 
1083 struct xen_domctl_set_gnttab_limits {
1084     uint32_t grant_frames;     /* IN */
1085     uint32_t maptrack_frames;  /* IN */
1086 };
1087 
1088 /* XEN_DOMCTL_vuart_op */
1089 struct xen_domctl_vuart_op {
1090 #define XEN_DOMCTL_VUART_OP_INIT  0
1091         uint32_t cmd;           /* XEN_DOMCTL_VUART_OP_* */
1092 #define XEN_DOMCTL_VUART_TYPE_VPL011 0
1093         uint32_t type;          /* IN - type of vuart.
1094                                  *      Currently only vpl011 supported.
1095                                  */
1096         uint64_aligned_t  gfn;  /* IN - guest gfn to be used as a
1097                                  *      ring buffer.
1098                                  */
1099         domid_t console_domid;  /* IN - domid of domain running the
1100                                  *      backend console.
1101                                  */
1102         uint8_t pad[2];
1103         evtchn_port_t evtchn;   /* OUT - remote port of the event
1104                                  *       channel used for sending
1105                                  *       ring buffer events.
1106                                  */
1107 };
1108 
1109 struct xen_domctl {
1110     uint32_t cmd;
1111 #define XEN_DOMCTL_createdomain                   1
1112 #define XEN_DOMCTL_destroydomain                  2
1113 #define XEN_DOMCTL_pausedomain                    3
1114 #define XEN_DOMCTL_unpausedomain                  4
1115 #define XEN_DOMCTL_getdomaininfo                  5
1116 #define XEN_DOMCTL_getmemlist                     6
1117 /* #define XEN_DOMCTL_getpageframeinfo            7 Obsolete - use getpageframeinfo3 */
1118 /* #define XEN_DOMCTL_getpageframeinfo2           8 Obsolete - use getpageframeinfo3 */
1119 #define XEN_DOMCTL_setvcpuaffinity                9
1120 #define XEN_DOMCTL_shadow_op                     10
1121 #define XEN_DOMCTL_max_mem                       11
1122 #define XEN_DOMCTL_setvcpucontext                12
1123 #define XEN_DOMCTL_getvcpucontext                13
1124 #define XEN_DOMCTL_getvcpuinfo                   14
1125 #define XEN_DOMCTL_max_vcpus                     15
1126 #define XEN_DOMCTL_scheduler_op                  16
1127 #define XEN_DOMCTL_setdomainhandle               17
1128 #define XEN_DOMCTL_setdebugging                  18
1129 #define XEN_DOMCTL_irq_permission                19
1130 #define XEN_DOMCTL_iomem_permission              20
1131 #define XEN_DOMCTL_ioport_permission             21
1132 #define XEN_DOMCTL_hypercall_init                22
1133 #define XEN_DOMCTL_arch_setup                    23 /* Obsolete IA64 only */
1134 #define XEN_DOMCTL_settimeoffset                 24
1135 #define XEN_DOMCTL_getvcpuaffinity               25
1136 #define XEN_DOMCTL_real_mode_area                26 /* Obsolete PPC only */
1137 #define XEN_DOMCTL_resumedomain                  27
1138 #define XEN_DOMCTL_sendtrigger                   28
1139 #define XEN_DOMCTL_subscribe                     29
1140 #define XEN_DOMCTL_gethvmcontext                 33
1141 #define XEN_DOMCTL_sethvmcontext                 34
1142 #define XEN_DOMCTL_set_address_size              35
1143 #define XEN_DOMCTL_get_address_size              36
1144 #define XEN_DOMCTL_assign_device                 37
1145 #define XEN_DOMCTL_bind_pt_irq                   38
1146 #define XEN_DOMCTL_memory_mapping                39
1147 #define XEN_DOMCTL_ioport_mapping                40
1148 #define XEN_DOMCTL_pin_mem_cacheattr             41
1149 #define XEN_DOMCTL_set_ext_vcpucontext           42
1150 #define XEN_DOMCTL_get_ext_vcpucontext           43
1151 #define XEN_DOMCTL_set_opt_feature               44 /* Obsolete IA64 only */
1152 #define XEN_DOMCTL_test_assign_device            45
1153 #define XEN_DOMCTL_set_target                    46
1154 #define XEN_DOMCTL_deassign_device               47
1155 #define XEN_DOMCTL_unbind_pt_irq                 48
1156 #define XEN_DOMCTL_set_cpuid                     49
1157 #define XEN_DOMCTL_get_device_group              50
1158 #define XEN_DOMCTL_set_machine_address_size      51
1159 #define XEN_DOMCTL_get_machine_address_size      52
1160 #define XEN_DOMCTL_suppress_spurious_page_faults 53
1161 #define XEN_DOMCTL_debug_op                      54
1162 #define XEN_DOMCTL_gethvmcontext_partial         55
1163 #define XEN_DOMCTL_vm_event_op                   56
1164 #define XEN_DOMCTL_mem_sharing_op                57
1165 #define XEN_DOMCTL_disable_migrate               58
1166 #define XEN_DOMCTL_gettscinfo                    59
1167 #define XEN_DOMCTL_settscinfo                    60
1168 #define XEN_DOMCTL_getpageframeinfo3             61
1169 #define XEN_DOMCTL_setvcpuextstate               62
1170 #define XEN_DOMCTL_getvcpuextstate               63
1171 #define XEN_DOMCTL_set_access_required           64
1172 #define XEN_DOMCTL_audit_p2m                     65
1173 #define XEN_DOMCTL_set_virq_handler              66
1174 #define XEN_DOMCTL_set_broken_page_p2m           67
1175 #define XEN_DOMCTL_setnodeaffinity               68
1176 #define XEN_DOMCTL_getnodeaffinity               69
1177 #define XEN_DOMCTL_set_max_evtchn                70
1178 #define XEN_DOMCTL_cacheflush                    71
1179 #define XEN_DOMCTL_get_vcpu_msrs                 72
1180 #define XEN_DOMCTL_set_vcpu_msrs                 73
1181 #define XEN_DOMCTL_setvnumainfo                  74
1182 #define XEN_DOMCTL_psr_cmt_op                    75
1183 #define XEN_DOMCTL_monitor_op                    77
1184 #define XEN_DOMCTL_psr_cat_op                    78
1185 #define XEN_DOMCTL_soft_reset                    79
1186 #define XEN_DOMCTL_set_gnttab_limits             80
1187 #define XEN_DOMCTL_vuart_op                      81
1188 #define XEN_DOMCTL_gdbsx_guestmemio            1000
1189 #define XEN_DOMCTL_gdbsx_pausevcpu             1001
1190 #define XEN_DOMCTL_gdbsx_unpausevcpu           1002
1191 #define XEN_DOMCTL_gdbsx_domstatus             1003
1192     uint32_t interface_version; /* XEN_DOMCTL_INTERFACE_VERSION */
1193     domid_t  domain;
1194     union {
1195         struct xen_domctl_createdomain      createdomain;
1196         struct xen_domctl_getdomaininfo     getdomaininfo;
1197         struct xen_domctl_getmemlist        getmemlist;
1198         struct xen_domctl_getpageframeinfo3 getpageframeinfo3;
1199         struct xen_domctl_nodeaffinity      nodeaffinity;
1200         struct xen_domctl_vcpuaffinity      vcpuaffinity;
1201         struct xen_domctl_shadow_op         shadow_op;
1202         struct xen_domctl_max_mem           max_mem;
1203         struct xen_domctl_vcpucontext       vcpucontext;
1204         struct xen_domctl_getvcpuinfo       getvcpuinfo;
1205         struct xen_domctl_max_vcpus         max_vcpus;
1206         struct xen_domctl_scheduler_op      scheduler_op;
1207         struct xen_domctl_setdomainhandle   setdomainhandle;
1208         struct xen_domctl_setdebugging      setdebugging;
1209         struct xen_domctl_irq_permission    irq_permission;
1210         struct xen_domctl_iomem_permission  iomem_permission;
1211         struct xen_domctl_ioport_permission ioport_permission;
1212         struct xen_domctl_hypercall_init    hypercall_init;
1213         struct xen_domctl_settimeoffset     settimeoffset;
1214         struct xen_domctl_disable_migrate   disable_migrate;
1215         struct xen_domctl_tsc_info          tsc_info;
1216         struct xen_domctl_hvmcontext        hvmcontext;
1217         struct xen_domctl_hvmcontext_partial hvmcontext_partial;
1218         struct xen_domctl_address_size      address_size;
1219         struct xen_domctl_sendtrigger       sendtrigger;
1220         struct xen_domctl_get_device_group  get_device_group;
1221         struct xen_domctl_assign_device     assign_device;
1222         struct xen_domctl_bind_pt_irq       bind_pt_irq;
1223         struct xen_domctl_memory_mapping    memory_mapping;
1224         struct xen_domctl_ioport_mapping    ioport_mapping;
1225         struct xen_domctl_pin_mem_cacheattr pin_mem_cacheattr;
1226         struct xen_domctl_ext_vcpucontext   ext_vcpucontext;
1227         struct xen_domctl_set_target        set_target;
1228         struct xen_domctl_subscribe         subscribe;
1229         struct xen_domctl_debug_op          debug_op;
1230         struct xen_domctl_vm_event_op       vm_event_op;
1231         struct xen_domctl_mem_sharing_op    mem_sharing_op;
1232 #if defined(__i386__) || defined(__x86_64__)
1233         struct xen_domctl_cpuid             cpuid;
1234         struct xen_domctl_vcpuextstate      vcpuextstate;
1235         struct xen_domctl_vcpu_msrs         vcpu_msrs;
1236 #endif
1237         struct xen_domctl_set_access_required access_required;
1238         struct xen_domctl_audit_p2m         audit_p2m;
1239         struct xen_domctl_set_virq_handler  set_virq_handler;
1240         struct xen_domctl_set_max_evtchn    set_max_evtchn;
1241         struct xen_domctl_gdbsx_memio       gdbsx_guest_memio;
1242         struct xen_domctl_set_broken_page_p2m set_broken_page_p2m;
1243         struct xen_domctl_cacheflush        cacheflush;
1244         struct xen_domctl_gdbsx_pauseunp_vcpu gdbsx_pauseunp_vcpu;
1245         struct xen_domctl_gdbsx_domstatus   gdbsx_domstatus;
1246         struct xen_domctl_vnuma             vnuma;
1247         struct xen_domctl_psr_cmt_op        psr_cmt_op;
1248         struct xen_domctl_monitor_op        monitor_op;
1249         struct xen_domctl_psr_cat_op        psr_cat_op;
1250         struct xen_domctl_set_gnttab_limits set_gnttab_limits;
1251         struct xen_domctl_vuart_op          vuart_op;
1252         uint8_t                             pad[128];
1253     } u;
1254 };
1255 typedef struct xen_domctl xen_domctl_t;
1256 DEFINE_XEN_GUEST_HANDLE(xen_domctl_t);
1257 
1258 #endif /* __XEN_PUBLIC_DOMCTL_H__ */
1259 
1260 /*
1261  * Local variables:
1262  * mode: C
1263  * c-file-style: "BSD"
1264  * c-basic-offset: 4
1265  * tab-width: 4
1266  * indent-tabs-mode: nil
1267  * End:
1268  */
1269