xref: /titanic_41/usr/src/uts/common/xen/public/domctl.h (revision 5bbb4db2c3f208d12bf0fd11769728f9e5ba66a2)
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 
37 #define XEN_DOMCTL_INTERFACE_VERSION 0x00000005
38 
39 struct xenctl_cpumap {
40     XEN_GUEST_HANDLE_64(uint8) bitmap;
41     uint32_t nr_cpus;
42 };
43 
44 /*
45  * NB. xen_domctl.domain is an IN/OUT parameter for this operation.
46  * If it is specified as zero, an id is auto-allocated and returned.
47  */
48 #define XEN_DOMCTL_createdomain       1
49 struct xen_domctl_createdomain {
50     /* IN parameters */
51     uint32_t ssidref;
52     xen_domain_handle_t handle;
53  /* Is this an HVM guest (as opposed to a PV guest)? */
54 #define _XEN_DOMCTL_CDF_hvm_guest 0
55 #define XEN_DOMCTL_CDF_hvm_guest  (1U<<_XEN_DOMCTL_CDF_hvm_guest)
56  /* Use hardware-assisted paging if available? */
57 #define _XEN_DOMCTL_CDF_hap       1
58 #define XEN_DOMCTL_CDF_hap        (1U<<_XEN_DOMCTL_CDF_hap)
59     uint32_t flags;
60 };
61 typedef struct xen_domctl_createdomain xen_domctl_createdomain_t;
62 DEFINE_XEN_GUEST_HANDLE(xen_domctl_createdomain_t);
63 
64 #define XEN_DOMCTL_destroydomain      2
65 #define XEN_DOMCTL_pausedomain        3
66 #define XEN_DOMCTL_unpausedomain      4
67 #define XEN_DOMCTL_resumedomain      27
68 
69 #define XEN_DOMCTL_getdomaininfo      5
70 struct xen_domctl_getdomaininfo {
71     /* OUT variables. */
72     domid_t  domain;              /* Also echoed in domctl.domain */
73  /* Domain is scheduled to die. */
74 #define _XEN_DOMINF_dying     0
75 #define XEN_DOMINF_dying      (1U<<_XEN_DOMINF_dying)
76  /* Domain is an HVM guest (as opposed to a PV guest). */
77 #define _XEN_DOMINF_hvm_guest 1
78 #define XEN_DOMINF_hvm_guest  (1U<<_XEN_DOMINF_hvm_guest)
79  /* The guest OS has shut down. */
80 #define _XEN_DOMINF_shutdown  2
81 #define XEN_DOMINF_shutdown   (1U<<_XEN_DOMINF_shutdown)
82  /* Currently paused by control software. */
83 #define _XEN_DOMINF_paused    3
84 #define XEN_DOMINF_paused     (1U<<_XEN_DOMINF_paused)
85  /* Currently blocked pending an event.     */
86 #define _XEN_DOMINF_blocked   4
87 #define XEN_DOMINF_blocked    (1U<<_XEN_DOMINF_blocked)
88  /* Domain is currently running.            */
89 #define _XEN_DOMINF_running   5
90 #define XEN_DOMINF_running    (1U<<_XEN_DOMINF_running)
91  /* Being debugged.  */
92 #define _XEN_DOMINF_debugged  6
93 #define XEN_DOMINF_debugged   (1U<<_XEN_DOMINF_debugged)
94  /* CPU to which this domain is bound.      */
95 #define XEN_DOMINF_cpumask      255
96 #define XEN_DOMINF_cpushift       8
97  /* XEN_DOMINF_shutdown guest-supplied code.  */
98 #define XEN_DOMINF_shutdownmask 255
99 #define XEN_DOMINF_shutdownshift 16
100     uint32_t flags;              /* XEN_DOMINF_* */
101     uint64_aligned_t tot_pages;
102     uint64_aligned_t max_pages;
103     uint64_aligned_t shared_info_frame; /* GMFN of shared_info struct */
104     uint64_aligned_t cpu_time;
105     uint32_t nr_online_vcpus;    /* Number of VCPUs currently online. */
106     uint32_t max_vcpu_id;        /* Maximum VCPUID in use by this domain. */
107     uint32_t ssidref;
108     xen_domain_handle_t handle;
109 };
110 typedef struct xen_domctl_getdomaininfo xen_domctl_getdomaininfo_t;
111 DEFINE_XEN_GUEST_HANDLE(xen_domctl_getdomaininfo_t);
112 
113 
114 #define XEN_DOMCTL_getmemlist         6
115 struct xen_domctl_getmemlist {
116     /* IN variables. */
117     /* Max entries to write to output buffer. */
118     uint64_aligned_t max_pfns;
119     /* Start index in guest's page list. */
120     uint64_aligned_t start_pfn;
121     XEN_GUEST_HANDLE_64(uint64) buffer;
122     /* OUT variables. */
123     uint64_aligned_t num_pfns;
124 };
125 typedef struct xen_domctl_getmemlist xen_domctl_getmemlist_t;
126 DEFINE_XEN_GUEST_HANDLE(xen_domctl_getmemlist_t);
127 
128 
129 #define XEN_DOMCTL_getpageframeinfo   7
130 
131 #define XEN_DOMCTL_PFINFO_LTAB_SHIFT 28
132 #define XEN_DOMCTL_PFINFO_NOTAB   (0x0U<<28)
133 #define XEN_DOMCTL_PFINFO_L1TAB   (0x1U<<28)
134 #define XEN_DOMCTL_PFINFO_L2TAB   (0x2U<<28)
135 #define XEN_DOMCTL_PFINFO_L3TAB   (0x3U<<28)
136 #define XEN_DOMCTL_PFINFO_L4TAB   (0x4U<<28)
137 #define XEN_DOMCTL_PFINFO_LTABTYPE_MASK (0x7U<<28)
138 #define XEN_DOMCTL_PFINFO_LPINTAB (0x1U<<31)
139 #define XEN_DOMCTL_PFINFO_XTAB    (0xfU<<28) /* invalid page */
140 #define XEN_DOMCTL_PFINFO_LTAB_MASK (0xfU<<28)
141 
142 struct xen_domctl_getpageframeinfo {
143     /* IN variables. */
144     uint64_aligned_t gmfn; /* GMFN to query */
145     /* OUT variables. */
146     /* Is the page PINNED to a type? */
147     uint32_t type;         /* see above type defs */
148 };
149 typedef struct xen_domctl_getpageframeinfo xen_domctl_getpageframeinfo_t;
150 DEFINE_XEN_GUEST_HANDLE(xen_domctl_getpageframeinfo_t);
151 
152 
153 #define XEN_DOMCTL_getpageframeinfo2  8
154 struct xen_domctl_getpageframeinfo2 {
155     /* IN variables. */
156     uint64_aligned_t num;
157     /* IN/OUT variables. */
158     XEN_GUEST_HANDLE_64(uint32) array;
159 };
160 typedef struct xen_domctl_getpageframeinfo2 xen_domctl_getpageframeinfo2_t;
161 DEFINE_XEN_GUEST_HANDLE(xen_domctl_getpageframeinfo2_t);
162 
163 
164 /*
165  * Control shadow pagetables operation
166  */
167 #define XEN_DOMCTL_shadow_op         10
168 
169 /* Disable shadow mode. */
170 #define XEN_DOMCTL_SHADOW_OP_OFF         0
171 
172 /* Enable shadow mode (mode contains ORed XEN_DOMCTL_SHADOW_ENABLE_* flags). */
173 #define XEN_DOMCTL_SHADOW_OP_ENABLE      32
174 
175 /* Log-dirty bitmap operations. */
176  /* Return the bitmap and clean internal copy for next round. */
177 #define XEN_DOMCTL_SHADOW_OP_CLEAN       11
178  /* Return the bitmap but do not modify internal copy. */
179 #define XEN_DOMCTL_SHADOW_OP_PEEK        12
180 
181 /* Memory allocation accessors. */
182 #define XEN_DOMCTL_SHADOW_OP_GET_ALLOCATION   30
183 #define XEN_DOMCTL_SHADOW_OP_SET_ALLOCATION   31
184 
185 /* Legacy enable operations. */
186  /* Equiv. to ENABLE with no mode flags. */
187 #define XEN_DOMCTL_SHADOW_OP_ENABLE_TEST       1
188  /* Equiv. to ENABLE with mode flag ENABLE_LOG_DIRTY. */
189 #define XEN_DOMCTL_SHADOW_OP_ENABLE_LOGDIRTY   2
190  /* Equiv. to ENABLE with mode flags ENABLE_REFCOUNT and ENABLE_TRANSLATE. */
191 #define XEN_DOMCTL_SHADOW_OP_ENABLE_TRANSLATE  3
192 
193 /* Mode flags for XEN_DOMCTL_SHADOW_OP_ENABLE. */
194  /*
195   * Shadow pagetables are refcounted: guest does not use explicit mmu
196   * operations nor write-protect its pagetables.
197   */
198 #define XEN_DOMCTL_SHADOW_ENABLE_REFCOUNT  (1 << 1)
199  /*
200   * Log pages in a bitmap as they are dirtied.
201   * Used for live relocation to determine which pages must be re-sent.
202   */
203 #define XEN_DOMCTL_SHADOW_ENABLE_LOG_DIRTY (1 << 2)
204  /*
205   * Automatically translate GPFNs into MFNs.
206   */
207 #define XEN_DOMCTL_SHADOW_ENABLE_TRANSLATE (1 << 3)
208  /*
209   * Xen does not steal virtual address space from the guest.
210   * Requires HVM support.
211   */
212 #define XEN_DOMCTL_SHADOW_ENABLE_EXTERNAL  (1 << 4)
213 
214 struct xen_domctl_shadow_op_stats {
215     uint32_t fault_count;
216     uint32_t dirty_count;
217 };
218 typedef struct xen_domctl_shadow_op_stats xen_domctl_shadow_op_stats_t;
219 DEFINE_XEN_GUEST_HANDLE(xen_domctl_shadow_op_stats_t);
220 
221 struct xen_domctl_shadow_op {
222     /* IN variables. */
223     uint32_t       op;       /* XEN_DOMCTL_SHADOW_OP_* */
224 
225     /* OP_ENABLE */
226     uint32_t       mode;     /* XEN_DOMCTL_SHADOW_ENABLE_* */
227 
228     /* OP_GET_ALLOCATION / OP_SET_ALLOCATION */
229     uint32_t       mb;       /* Shadow memory allocation in MB */
230 
231     /* OP_PEEK / OP_CLEAN */
232     XEN_GUEST_HANDLE_64(uint8) dirty_bitmap;
233     uint64_aligned_t pages; /* Size of buffer. Updated with actual size. */
234     struct xen_domctl_shadow_op_stats stats;
235 };
236 typedef struct xen_domctl_shadow_op xen_domctl_shadow_op_t;
237 DEFINE_XEN_GUEST_HANDLE(xen_domctl_shadow_op_t);
238 
239 
240 #define XEN_DOMCTL_max_mem           11
241 struct xen_domctl_max_mem {
242     /* IN variables. */
243     uint64_aligned_t max_memkb;
244 };
245 typedef struct xen_domctl_max_mem xen_domctl_max_mem_t;
246 DEFINE_XEN_GUEST_HANDLE(xen_domctl_max_mem_t);
247 
248 
249 #define XEN_DOMCTL_setvcpucontext    12
250 #define XEN_DOMCTL_getvcpucontext    13
251 struct xen_domctl_vcpucontext {
252     uint32_t              vcpu;                  /* IN */
253     XEN_GUEST_HANDLE_64(vcpu_guest_context_t) ctxt; /* IN/OUT */
254 };
255 typedef struct xen_domctl_vcpucontext xen_domctl_vcpucontext_t;
256 DEFINE_XEN_GUEST_HANDLE(xen_domctl_vcpucontext_t);
257 
258 
259 #define XEN_DOMCTL_getvcpuinfo       14
260 struct xen_domctl_getvcpuinfo {
261     /* IN variables. */
262     uint32_t vcpu;
263     /* OUT variables. */
264     uint8_t  online;                  /* currently online (not hotplugged)? */
265     uint8_t  blocked;                 /* blocked waiting for an event? */
266     uint8_t  running;                 /* currently scheduled on its CPU? */
267     uint64_aligned_t cpu_time;        /* total cpu time consumed (ns) */
268     uint32_t cpu;                     /* current mapping   */
269 };
270 typedef struct xen_domctl_getvcpuinfo xen_domctl_getvcpuinfo_t;
271 DEFINE_XEN_GUEST_HANDLE(xen_domctl_getvcpuinfo_t);
272 
273 
274 /* Get/set which physical cpus a vcpu can execute on. */
275 #define XEN_DOMCTL_setvcpuaffinity    9
276 #define XEN_DOMCTL_getvcpuaffinity   25
277 struct xen_domctl_vcpuaffinity {
278     uint32_t  vcpu;              /* IN */
279     struct xenctl_cpumap cpumap; /* IN/OUT */
280 };
281 typedef struct xen_domctl_vcpuaffinity xen_domctl_vcpuaffinity_t;
282 DEFINE_XEN_GUEST_HANDLE(xen_domctl_vcpuaffinity_t);
283 
284 
285 #define XEN_DOMCTL_max_vcpus         15
286 struct xen_domctl_max_vcpus {
287     uint32_t max;           /* maximum number of vcpus */
288 };
289 typedef struct xen_domctl_max_vcpus xen_domctl_max_vcpus_t;
290 DEFINE_XEN_GUEST_HANDLE(xen_domctl_max_vcpus_t);
291 
292 
293 #define XEN_DOMCTL_scheduler_op      16
294 /* Scheduler types. */
295 #define XEN_SCHEDULER_SEDF     4
296 #define XEN_SCHEDULER_CREDIT   5
297 /* Set or get info? */
298 #define XEN_DOMCTL_SCHEDOP_putinfo 0
299 #define XEN_DOMCTL_SCHEDOP_getinfo 1
300 struct xen_domctl_scheduler_op {
301     uint32_t sched_id;  /* XEN_SCHEDULER_* */
302     uint32_t cmd;       /* XEN_DOMCTL_SCHEDOP_* */
303     union {
304         struct xen_domctl_sched_sedf {
305             uint64_aligned_t period;
306             uint64_aligned_t slice;
307             uint64_aligned_t latency;
308             uint32_t extratime;
309             uint32_t weight;
310         } sedf;
311         struct xen_domctl_sched_credit {
312             uint16_t weight;
313             uint16_t cap;
314         } credit;
315     } u;
316 };
317 typedef struct xen_domctl_scheduler_op xen_domctl_scheduler_op_t;
318 DEFINE_XEN_GUEST_HANDLE(xen_domctl_scheduler_op_t);
319 
320 
321 #define XEN_DOMCTL_setdomainhandle   17
322 struct xen_domctl_setdomainhandle {
323     xen_domain_handle_t handle;
324 };
325 typedef struct xen_domctl_setdomainhandle xen_domctl_setdomainhandle_t;
326 DEFINE_XEN_GUEST_HANDLE(xen_domctl_setdomainhandle_t);
327 
328 
329 #define XEN_DOMCTL_setdebugging      18
330 struct xen_domctl_setdebugging {
331     uint8_t enable;
332 };
333 typedef struct xen_domctl_setdebugging xen_domctl_setdebugging_t;
334 DEFINE_XEN_GUEST_HANDLE(xen_domctl_setdebugging_t);
335 
336 
337 #define XEN_DOMCTL_irq_permission    19
338 struct xen_domctl_irq_permission {
339     uint8_t pirq;
340     uint8_t allow_access;    /* flag to specify enable/disable of IRQ access */
341 };
342 typedef struct xen_domctl_irq_permission xen_domctl_irq_permission_t;
343 DEFINE_XEN_GUEST_HANDLE(xen_domctl_irq_permission_t);
344 
345 
346 #define XEN_DOMCTL_iomem_permission  20
347 struct xen_domctl_iomem_permission {
348     uint64_aligned_t first_mfn;/* first page (physical page number) in range */
349     uint64_aligned_t nr_mfns;  /* number of pages in range (>0) */
350     uint8_t  allow_access;     /* allow (!0) or deny (0) access to range? */
351 };
352 typedef struct xen_domctl_iomem_permission xen_domctl_iomem_permission_t;
353 DEFINE_XEN_GUEST_HANDLE(xen_domctl_iomem_permission_t);
354 
355 
356 #define XEN_DOMCTL_ioport_permission 21
357 struct xen_domctl_ioport_permission {
358     uint32_t first_port;              /* first port int range */
359     uint32_t nr_ports;                /* size of port range */
360     uint8_t  allow_access;            /* allow or deny access to range? */
361 };
362 typedef struct xen_domctl_ioport_permission xen_domctl_ioport_permission_t;
363 DEFINE_XEN_GUEST_HANDLE(xen_domctl_ioport_permission_t);
364 
365 
366 #define XEN_DOMCTL_hypercall_init    22
367 struct xen_domctl_hypercall_init {
368     uint64_aligned_t  gmfn;           /* GMFN to be initialised */
369 };
370 typedef struct xen_domctl_hypercall_init xen_domctl_hypercall_init_t;
371 DEFINE_XEN_GUEST_HANDLE(xen_domctl_hypercall_init_t);
372 
373 
374 #define XEN_DOMCTL_arch_setup        23
375 #define _XEN_DOMAINSETUP_hvm_guest 0
376 #define XEN_DOMAINSETUP_hvm_guest  (1UL<<_XEN_DOMAINSETUP_hvm_guest)
377 #define _XEN_DOMAINSETUP_query 1 /* Get parameters (for save)  */
378 #define XEN_DOMAINSETUP_query  (1UL<<_XEN_DOMAINSETUP_query)
379 #define _XEN_DOMAINSETUP_sioemu_guest 2
380 #define XEN_DOMAINSETUP_sioemu_guest  (1UL<<_XEN_DOMAINSETUP_sioemu_guest)
381 typedef struct xen_domctl_arch_setup {
382     uint64_aligned_t flags;  /* XEN_DOMAINSETUP_* */
383 #ifdef __ia64__
384     uint64_aligned_t bp;     /* mpaddr of boot param area */
385     uint64_aligned_t maxmem; /* Highest memory address for MDT.  */
386     uint64_aligned_t xsi_va; /* Xen shared_info area virtual address.  */
387     uint32_t hypercall_imm;  /* Break imm for Xen hypercalls.  */
388     int8_t vhpt_size_log2;   /* Log2 of VHPT size. */
389 #endif
390 } xen_domctl_arch_setup_t;
391 DEFINE_XEN_GUEST_HANDLE(xen_domctl_arch_setup_t);
392 
393 
394 #define XEN_DOMCTL_settimeoffset     24
395 struct xen_domctl_settimeoffset {
396     int32_t  time_offset_seconds; /* applied to domain wallclock time */
397 };
398 typedef struct xen_domctl_settimeoffset xen_domctl_settimeoffset_t;
399 DEFINE_XEN_GUEST_HANDLE(xen_domctl_settimeoffset_t);
400 
401 
402 #define XEN_DOMCTL_gethvmcontext     33
403 #define XEN_DOMCTL_sethvmcontext     34
404 typedef struct xen_domctl_hvmcontext {
405     uint32_t size; /* IN/OUT: size of buffer / bytes filled */
406     XEN_GUEST_HANDLE_64(uint8) buffer; /* IN/OUT: data, or call
407                                         * gethvmcontext with NULL
408                                         * buffer to get size req'd */
409 } xen_domctl_hvmcontext_t;
410 DEFINE_XEN_GUEST_HANDLE(xen_domctl_hvmcontext_t);
411 
412 
413 #define XEN_DOMCTL_set_address_size  35
414 #define XEN_DOMCTL_get_address_size  36
415 typedef struct xen_domctl_address_size {
416     uint32_t size;
417 } xen_domctl_address_size_t;
418 DEFINE_XEN_GUEST_HANDLE(xen_domctl_address_size_t);
419 
420 
421 #define XEN_DOMCTL_real_mode_area    26
422 struct xen_domctl_real_mode_area {
423     uint32_t log; /* log2 of Real Mode Area size */
424 };
425 typedef struct xen_domctl_real_mode_area xen_domctl_real_mode_area_t;
426 DEFINE_XEN_GUEST_HANDLE(xen_domctl_real_mode_area_t);
427 
428 
429 #define XEN_DOMCTL_sendtrigger       28
430 #define XEN_DOMCTL_SENDTRIGGER_NMI    0
431 #define XEN_DOMCTL_SENDTRIGGER_RESET  1
432 #define XEN_DOMCTL_SENDTRIGGER_INIT   2
433 struct xen_domctl_sendtrigger {
434     uint32_t  trigger;  /* IN */
435     uint32_t  vcpu;     /* IN */
436 };
437 typedef struct xen_domctl_sendtrigger xen_domctl_sendtrigger_t;
438 DEFINE_XEN_GUEST_HANDLE(xen_domctl_sendtrigger_t);
439 
440 
441 /* Assign PCI device to HVM guest. Sets up IOMMU structures. */
442 #define XEN_DOMCTL_assign_device      37
443 #define XEN_DOMCTL_test_assign_device 45
444 #define XEN_DOMCTL_deassign_device 47
445 struct xen_domctl_assign_device {
446     uint32_t  machine_bdf;   /* machine PCI ID of assigned device */
447 };
448 typedef struct xen_domctl_assign_device xen_domctl_assign_device_t;
449 DEFINE_XEN_GUEST_HANDLE(xen_domctl_assign_device_t);
450 
451 /* Retrieve sibling devices infomation of machine_bdf */
452 #define XEN_DOMCTL_get_device_group 50
453 struct xen_domctl_get_device_group {
454     uint32_t  machine_bdf;      /* IN */
455     uint32_t  max_sdevs;        /* IN */
456     uint32_t  num_sdevs;        /* OUT */
457     XEN_GUEST_HANDLE_64(uint32)  sdev_array;   /* OUT */
458 };
459 typedef struct xen_domctl_get_device_group xen_domctl_get_device_group_t;
460 DEFINE_XEN_GUEST_HANDLE(xen_domctl_get_device_group_t);
461 
462 /* Pass-through interrupts: bind real irq -> hvm devfn. */
463 #define XEN_DOMCTL_bind_pt_irq       38
464 #define XEN_DOMCTL_unbind_pt_irq     48
465 typedef enum pt_irq_type_e {
466     PT_IRQ_TYPE_PCI,
467     PT_IRQ_TYPE_ISA,
468     PT_IRQ_TYPE_MSI,
469 } pt_irq_type_t;
470 struct xen_domctl_bind_pt_irq {
471     uint32_t machine_irq;
472     pt_irq_type_t irq_type;
473     uint32_t hvm_domid;
474 
475     union {
476         struct {
477             uint8_t isa_irq;
478         } isa;
479         struct {
480             uint8_t bus;
481             uint8_t device;
482             uint8_t intx;
483         } pci;
484         struct {
485             uint8_t gvec;
486             uint32_t gflags;
487         } msi;
488     } u;
489 };
490 typedef struct xen_domctl_bind_pt_irq xen_domctl_bind_pt_irq_t;
491 DEFINE_XEN_GUEST_HANDLE(xen_domctl_bind_pt_irq_t);
492 
493 
494 /* Bind machine I/O address range -> HVM address range. */
495 #define XEN_DOMCTL_memory_mapping    39
496 #define DPCI_ADD_MAPPING         1
497 #define DPCI_REMOVE_MAPPING      0
498 struct xen_domctl_memory_mapping {
499     uint64_aligned_t first_gfn; /* first page (hvm guest phys page) in range */
500     uint64_aligned_t first_mfn; /* first page (machine page) in range */
501     uint64_aligned_t nr_mfns;   /* number of pages in range (>0) */
502     uint32_t add_mapping;       /* add or remove mapping */
503     uint32_t padding;           /* padding for 64-bit aligned structure */
504 };
505 typedef struct xen_domctl_memory_mapping xen_domctl_memory_mapping_t;
506 DEFINE_XEN_GUEST_HANDLE(xen_domctl_memory_mapping_t);
507 
508 
509 /* Bind machine I/O port range -> HVM I/O port range. */
510 #define XEN_DOMCTL_ioport_mapping    40
511 struct xen_domctl_ioport_mapping {
512     uint32_t first_gport;     /* first guest IO port*/
513     uint32_t first_mport;     /* first machine IO port */
514     uint32_t nr_ports;        /* size of port range */
515     uint32_t add_mapping;     /* add or remove mapping */
516 };
517 typedef struct xen_domctl_ioport_mapping xen_domctl_ioport_mapping_t;
518 DEFINE_XEN_GUEST_HANDLE(xen_domctl_ioport_mapping_t);
519 
520 
521 /*
522  * Pin caching type of RAM space for x86 HVM domU.
523  */
524 #define XEN_DOMCTL_pin_mem_cacheattr 41
525 /* Caching types: these happen to be the same as x86 MTRR/PAT type codes. */
526 #define XEN_DOMCTL_MEM_CACHEATTR_UC  0
527 #define XEN_DOMCTL_MEM_CACHEATTR_WC  1
528 #define XEN_DOMCTL_MEM_CACHEATTR_WT  4
529 #define XEN_DOMCTL_MEM_CACHEATTR_WP  5
530 #define XEN_DOMCTL_MEM_CACHEATTR_WB  6
531 #define XEN_DOMCTL_MEM_CACHEATTR_UCM 7
532 struct xen_domctl_pin_mem_cacheattr {
533     uint64_aligned_t start, end;
534     unsigned int type; /* XEN_DOMCTL_MEM_CACHEATTR_* */
535 };
536 typedef struct xen_domctl_pin_mem_cacheattr xen_domctl_pin_mem_cacheattr_t;
537 DEFINE_XEN_GUEST_HANDLE(xen_domctl_pin_mem_cacheattr_t);
538 
539 
540 #define XEN_DOMCTL_set_ext_vcpucontext 42
541 #define XEN_DOMCTL_get_ext_vcpucontext 43
542 struct xen_domctl_ext_vcpucontext {
543     /* IN: VCPU that this call applies to. */
544     uint32_t         vcpu;
545     /*
546      * SET: Size of struct (IN)
547      * GET: Size of struct (OUT)
548      */
549     uint32_t         size;
550 #if defined(__i386__) || defined(__x86_64__)
551     /* SYSCALL from 32-bit mode and SYSENTER callback information. */
552     /* NB. SYSCALL from 64-bit mode is contained in vcpu_guest_context_t */
553     uint64_aligned_t syscall32_callback_eip;
554     uint64_aligned_t sysenter_callback_eip;
555     uint16_t         syscall32_callback_cs;
556     uint16_t         sysenter_callback_cs;
557     uint8_t          syscall32_disables_events;
558     uint8_t          sysenter_disables_events;
559 #endif
560 };
561 typedef struct xen_domctl_ext_vcpucontext xen_domctl_ext_vcpucontext_t;
562 DEFINE_XEN_GUEST_HANDLE(xen_domctl_ext_vcpucontext_t);
563 
564 /*
565  * Set optimizaton features for a domain
566  */
567 #define XEN_DOMCTL_set_opt_feature    44
568 struct xen_domctl_set_opt_feature {
569 #if defined(__ia64__)
570     struct xen_ia64_opt_feature optf;
571 #else
572     /* Make struct non-empty: do not depend on this field name! */
573     uint64_t dummy;
574 #endif
575 };
576 typedef struct xen_domctl_set_opt_feature xen_domctl_set_opt_feature_t;
577 DEFINE_XEN_GUEST_HANDLE(xen_domctl_set_opt_feature_t);
578 
579 /*
580  * Set the target domain for a domain
581  */
582 #define XEN_DOMCTL_set_target    46
583 struct xen_domctl_set_target {
584     domid_t target;
585 };
586 typedef struct xen_domctl_set_target xen_domctl_set_target_t;
587 DEFINE_XEN_GUEST_HANDLE(xen_domctl_set_target_t);
588 
589 #if defined(__i386__) || defined(__x86_64__)
590 # define XEN_CPUID_INPUT_UNUSED  0xFFFFFFFF
591 # define XEN_DOMCTL_set_cpuid 49
592 struct xen_domctl_cpuid {
593   unsigned int  input[2];
594   unsigned int  eax;
595   unsigned int  ebx;
596   unsigned int  ecx;
597   unsigned int  edx;
598 };
599 typedef struct xen_domctl_cpuid xen_domctl_cpuid_t;
600 DEFINE_XEN_GUEST_HANDLE(xen_domctl_cpuid_t);
601 #endif
602 
603 #define XEN_DOMCTL_subscribe          29
604 struct xen_domctl_subscribe {
605     uint32_t port; /* IN */
606 };
607 typedef struct xen_domctl_subscribe xen_domctl_subscribe_t;
608 DEFINE_XEN_GUEST_HANDLE(xen_domctl_subscribe_t);
609 
610 /*
611  * Define the maximum machine address size which should be allocated
612  * to a guest.
613  */
614 #define XEN_DOMCTL_set_machine_address_size  51
615 #define XEN_DOMCTL_get_machine_address_size  52
616 
617 /*
618  * Do not inject spurious page faults into this domain.
619  */
620 #define XEN_DOMCTL_suppress_spurious_page_faults 53
621 
622 struct xen_domctl {
623     uint32_t cmd;
624     uint32_t interface_version; /* XEN_DOMCTL_INTERFACE_VERSION */
625     domid_t  domain;
626     union {
627         struct xen_domctl_createdomain      createdomain;
628         struct xen_domctl_getdomaininfo     getdomaininfo;
629         struct xen_domctl_getmemlist        getmemlist;
630         struct xen_domctl_getpageframeinfo  getpageframeinfo;
631         struct xen_domctl_getpageframeinfo2 getpageframeinfo2;
632         struct xen_domctl_vcpuaffinity      vcpuaffinity;
633         struct xen_domctl_shadow_op         shadow_op;
634         struct xen_domctl_max_mem           max_mem;
635         struct xen_domctl_vcpucontext       vcpucontext;
636         struct xen_domctl_getvcpuinfo       getvcpuinfo;
637         struct xen_domctl_max_vcpus         max_vcpus;
638         struct xen_domctl_scheduler_op      scheduler_op;
639         struct xen_domctl_setdomainhandle   setdomainhandle;
640         struct xen_domctl_setdebugging      setdebugging;
641         struct xen_domctl_irq_permission    irq_permission;
642         struct xen_domctl_iomem_permission  iomem_permission;
643         struct xen_domctl_ioport_permission ioport_permission;
644         struct xen_domctl_hypercall_init    hypercall_init;
645         struct xen_domctl_arch_setup        arch_setup;
646         struct xen_domctl_settimeoffset     settimeoffset;
647         struct xen_domctl_real_mode_area    real_mode_area;
648         struct xen_domctl_hvmcontext        hvmcontext;
649         struct xen_domctl_address_size      address_size;
650         struct xen_domctl_sendtrigger       sendtrigger;
651         struct xen_domctl_get_device_group  get_device_group;
652         struct xen_domctl_assign_device     assign_device;
653         struct xen_domctl_bind_pt_irq       bind_pt_irq;
654         struct xen_domctl_memory_mapping    memory_mapping;
655         struct xen_domctl_ioport_mapping    ioport_mapping;
656         struct xen_domctl_pin_mem_cacheattr pin_mem_cacheattr;
657         struct xen_domctl_ext_vcpucontext   ext_vcpucontext;
658         struct xen_domctl_set_opt_feature   set_opt_feature;
659         struct xen_domctl_set_target        set_target;
660         struct xen_domctl_subscribe         subscribe;
661 #if defined(__i386__) || defined(__x86_64__)
662         struct xen_domctl_cpuid             cpuid;
663 #endif
664         uint8_t                             pad[128];
665     } u;
666 };
667 typedef struct xen_domctl xen_domctl_t;
668 DEFINE_XEN_GUEST_HANDLE(xen_domctl_t);
669 
670 #endif /* __XEN_PUBLIC_DOMCTL_H__ */
671 
672 /*
673  * Local variables:
674  * mode: C
675  * c-set-style: "BSD"
676  * c-basic-offset: 4
677  * tab-width: 4
678  * indent-tabs-mode: nil
679  * End:
680  */
681