debuggers.hg

view xen/include/public/domctl.h @ 20838:0447c5532e9f

x86: add and use XEN_DOMCTL_getpageframeinfo3

To support wider than 28-bit MFNs, add XEN_DOMCTL_getpageframeinfo3
(with the type replacing the passed in MFN rather than getting or-ed
into it) to properly back xc_get_pfn_type_batch().

With xc_get_pfn_type_batch() only used internally to libxc, move its
prototype from xenctrl.h to xc_private.h.

This also fixes a couple of bugs in pre-existing code:
- the failure path for init_mem_info() leaked minfo->pfn_type,
- one error path of the XEN_DOMCTL_getpageframeinfo2 handler used
put_domain() where rcu_unlock_domain() was meant, and
- the XEN_DOMCTL_getpageframeinfo2 handler could call
xsm_getpageframeinfo() with an invalid struct page_info pointer.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
author Keir Fraser <keir.fraser@citrix.com>
date Wed Jan 13 08:14:01 2010 +0000 (2010-01-13)
parents 683bf4ce2e93
children 0edb75cd8126
line source
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 */
28 #ifndef __XEN_PUBLIC_DOMCTL_H__
29 #define __XEN_PUBLIC_DOMCTL_H__
31 #if !defined(__XEN__) && !defined(__XEN_TOOLS__)
32 #error "domctl operations are intended for use by node control tools only"
33 #endif
35 #include "xen.h"
36 #include "grant_table.h"
38 #define XEN_DOMCTL_INTERFACE_VERSION 0x00000006
40 struct xenctl_cpumap {
41 XEN_GUEST_HANDLE_64(uint8) bitmap;
42 uint32_t nr_cpus;
43 };
45 /*
46 * NB. xen_domctl.domain is an IN/OUT parameter for this operation.
47 * If it is specified as zero, an id is auto-allocated and returned.
48 */
49 /* XEN_DOMCTL_createdomain */
50 struct xen_domctl_createdomain {
51 /* IN parameters */
52 uint32_t ssidref;
53 xen_domain_handle_t handle;
54 /* Is this an HVM guest (as opposed to a PV guest)? */
55 #define _XEN_DOMCTL_CDF_hvm_guest 0
56 #define XEN_DOMCTL_CDF_hvm_guest (1U<<_XEN_DOMCTL_CDF_hvm_guest)
57 /* Use hardware-assisted paging if available? */
58 #define _XEN_DOMCTL_CDF_hap 1
59 #define XEN_DOMCTL_CDF_hap (1U<<_XEN_DOMCTL_CDF_hap)
60 /* Should domain memory integrity be verifed by tboot during Sx? */
61 #define _XEN_DOMCTL_CDF_s3_integrity 2
62 #define XEN_DOMCTL_CDF_s3_integrity (1U<<_XEN_DOMCTL_CDF_s3_integrity)
63 uint32_t flags;
64 /* Disable out-of-sync shadow page tables? */
65 #define _XEN_DOMCTL_CDF_oos_off 3
66 #define XEN_DOMCTL_CDF_oos_off (1U<<_XEN_DOMCTL_CDF_oos_off)
67 };
68 typedef struct xen_domctl_createdomain xen_domctl_createdomain_t;
69 DEFINE_XEN_GUEST_HANDLE(xen_domctl_createdomain_t);
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 /* XEN_DOMINF_shutdown guest-supplied code. */
97 #define XEN_DOMINF_shutdownmask 255
98 #define XEN_DOMINF_shutdownshift 16
99 uint32_t flags; /* XEN_DOMINF_* */
100 uint64_aligned_t tot_pages;
101 uint64_aligned_t max_pages;
102 uint64_aligned_t shr_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);
114 /* XEN_DOMCTL_getmemlist */
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);
129 /* XEN_DOMCTL_getpageframeinfo */
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_PAGEDTAB (0x8U<<28)
141 #define XEN_DOMCTL_PFINFO_LTAB_MASK (0xfU<<28)
143 struct xen_domctl_getpageframeinfo {
144 /* IN variables. */
145 uint64_aligned_t gmfn; /* GMFN to query */
146 /* OUT variables. */
147 /* Is the page PINNED to a type? */
148 uint32_t type; /* see above type defs */
149 };
150 typedef struct xen_domctl_getpageframeinfo xen_domctl_getpageframeinfo_t;
151 DEFINE_XEN_GUEST_HANDLE(xen_domctl_getpageframeinfo_t);
154 /* XEN_DOMCTL_getpageframeinfo2 */
155 struct xen_domctl_getpageframeinfo2 {
156 /* IN variables. */
157 uint64_aligned_t num;
158 /* IN/OUT variables. */
159 XEN_GUEST_HANDLE_64(uint32) array;
160 };
161 typedef struct xen_domctl_getpageframeinfo2 xen_domctl_getpageframeinfo2_t;
162 DEFINE_XEN_GUEST_HANDLE(xen_domctl_getpageframeinfo2_t);
164 /* XEN_DOMCTL_getpageframeinfo3 */
165 struct xen_domctl_getpageframeinfo3 {
166 /* IN variables. */
167 uint64_aligned_t num;
168 /* IN/OUT variables. */
169 XEN_GUEST_HANDLE_64(xen_pfn_t) array;
170 };
173 /*
174 * Control shadow pagetables operation
175 */
176 /* XEN_DOMCTL_shadow_op */
178 /* Disable shadow mode. */
179 #define XEN_DOMCTL_SHADOW_OP_OFF 0
181 /* Enable shadow mode (mode contains ORed XEN_DOMCTL_SHADOW_ENABLE_* flags). */
182 #define XEN_DOMCTL_SHADOW_OP_ENABLE 32
184 /* Log-dirty bitmap operations. */
185 /* Return the bitmap and clean internal copy for next round. */
186 #define XEN_DOMCTL_SHADOW_OP_CLEAN 11
187 /* Return the bitmap but do not modify internal copy. */
188 #define XEN_DOMCTL_SHADOW_OP_PEEK 12
190 /* Memory allocation accessors. */
191 #define XEN_DOMCTL_SHADOW_OP_GET_ALLOCATION 30
192 #define XEN_DOMCTL_SHADOW_OP_SET_ALLOCATION 31
194 /* Legacy enable operations. */
195 /* Equiv. to ENABLE with no mode flags. */
196 #define XEN_DOMCTL_SHADOW_OP_ENABLE_TEST 1
197 /* Equiv. to ENABLE with mode flag ENABLE_LOG_DIRTY. */
198 #define XEN_DOMCTL_SHADOW_OP_ENABLE_LOGDIRTY 2
199 /* Equiv. to ENABLE with mode flags ENABLE_REFCOUNT and ENABLE_TRANSLATE. */
200 #define XEN_DOMCTL_SHADOW_OP_ENABLE_TRANSLATE 3
202 /* Mode flags for XEN_DOMCTL_SHADOW_OP_ENABLE. */
203 /*
204 * Shadow pagetables are refcounted: guest does not use explicit mmu
205 * operations nor write-protect its pagetables.
206 */
207 #define XEN_DOMCTL_SHADOW_ENABLE_REFCOUNT (1 << 1)
208 /*
209 * Log pages in a bitmap as they are dirtied.
210 * Used for live relocation to determine which pages must be re-sent.
211 */
212 #define XEN_DOMCTL_SHADOW_ENABLE_LOG_DIRTY (1 << 2)
213 /*
214 * Automatically translate GPFNs into MFNs.
215 */
216 #define XEN_DOMCTL_SHADOW_ENABLE_TRANSLATE (1 << 3)
217 /*
218 * Xen does not steal virtual address space from the guest.
219 * Requires HVM support.
220 */
221 #define XEN_DOMCTL_SHADOW_ENABLE_EXTERNAL (1 << 4)
223 struct xen_domctl_shadow_op_stats {
224 uint32_t fault_count;
225 uint32_t dirty_count;
226 };
227 typedef struct xen_domctl_shadow_op_stats xen_domctl_shadow_op_stats_t;
228 DEFINE_XEN_GUEST_HANDLE(xen_domctl_shadow_op_stats_t);
230 struct xen_domctl_shadow_op {
231 /* IN variables. */
232 uint32_t op; /* XEN_DOMCTL_SHADOW_OP_* */
234 /* OP_ENABLE */
235 uint32_t mode; /* XEN_DOMCTL_SHADOW_ENABLE_* */
237 /* OP_GET_ALLOCATION / OP_SET_ALLOCATION */
238 uint32_t mb; /* Shadow memory allocation in MB */
240 /* OP_PEEK / OP_CLEAN */
241 XEN_GUEST_HANDLE_64(uint8) dirty_bitmap;
242 uint64_aligned_t pages; /* Size of buffer. Updated with actual size. */
243 struct xen_domctl_shadow_op_stats stats;
244 };
245 typedef struct xen_domctl_shadow_op xen_domctl_shadow_op_t;
246 DEFINE_XEN_GUEST_HANDLE(xen_domctl_shadow_op_t);
249 /* XEN_DOMCTL_max_mem */
250 struct xen_domctl_max_mem {
251 /* IN variables. */
252 uint64_aligned_t max_memkb;
253 };
254 typedef struct xen_domctl_max_mem xen_domctl_max_mem_t;
255 DEFINE_XEN_GUEST_HANDLE(xen_domctl_max_mem_t);
258 /* XEN_DOMCTL_setvcpucontext */
259 /* XEN_DOMCTL_getvcpucontext */
260 struct xen_domctl_vcpucontext {
261 uint32_t vcpu; /* IN */
262 XEN_GUEST_HANDLE_64(vcpu_guest_context_t) ctxt; /* IN/OUT */
263 };
264 typedef struct xen_domctl_vcpucontext xen_domctl_vcpucontext_t;
265 DEFINE_XEN_GUEST_HANDLE(xen_domctl_vcpucontext_t);
268 /* XEN_DOMCTL_getvcpuinfo */
269 struct xen_domctl_getvcpuinfo {
270 /* IN variables. */
271 uint32_t vcpu;
272 /* OUT variables. */
273 uint8_t online; /* currently online (not hotplugged)? */
274 uint8_t blocked; /* blocked waiting for an event? */
275 uint8_t running; /* currently scheduled on its CPU? */
276 uint64_aligned_t cpu_time; /* total cpu time consumed (ns) */
277 uint32_t cpu; /* current mapping */
278 };
279 typedef struct xen_domctl_getvcpuinfo xen_domctl_getvcpuinfo_t;
280 DEFINE_XEN_GUEST_HANDLE(xen_domctl_getvcpuinfo_t);
283 /* Get/set which physical cpus a vcpu can execute on. */
284 /* XEN_DOMCTL_setvcpuaffinity */
285 /* XEN_DOMCTL_getvcpuaffinity */
286 struct xen_domctl_vcpuaffinity {
287 uint32_t vcpu; /* IN */
288 struct xenctl_cpumap cpumap; /* IN/OUT */
289 };
290 typedef struct xen_domctl_vcpuaffinity xen_domctl_vcpuaffinity_t;
291 DEFINE_XEN_GUEST_HANDLE(xen_domctl_vcpuaffinity_t);
294 /* XEN_DOMCTL_max_vcpus */
295 struct xen_domctl_max_vcpus {
296 uint32_t max; /* maximum number of vcpus */
297 };
298 typedef struct xen_domctl_max_vcpus xen_domctl_max_vcpus_t;
299 DEFINE_XEN_GUEST_HANDLE(xen_domctl_max_vcpus_t);
302 /* XEN_DOMCTL_scheduler_op */
303 /* Scheduler types. */
304 #define XEN_SCHEDULER_SEDF 4
305 #define XEN_SCHEDULER_CREDIT 5
306 /* Set or get info? */
307 #define XEN_DOMCTL_SCHEDOP_putinfo 0
308 #define XEN_DOMCTL_SCHEDOP_getinfo 1
309 struct xen_domctl_scheduler_op {
310 uint32_t sched_id; /* XEN_SCHEDULER_* */
311 uint32_t cmd; /* XEN_DOMCTL_SCHEDOP_* */
312 union {
313 struct xen_domctl_sched_sedf {
314 uint64_aligned_t period;
315 uint64_aligned_t slice;
316 uint64_aligned_t latency;
317 uint32_t extratime;
318 uint32_t weight;
319 } sedf;
320 struct xen_domctl_sched_credit {
321 uint16_t weight;
322 uint16_t cap;
323 } credit;
324 } u;
325 };
326 typedef struct xen_domctl_scheduler_op xen_domctl_scheduler_op_t;
327 DEFINE_XEN_GUEST_HANDLE(xen_domctl_scheduler_op_t);
330 /* XEN_DOMCTL_setdomainhandle */
331 struct xen_domctl_setdomainhandle {
332 xen_domain_handle_t handle;
333 };
334 typedef struct xen_domctl_setdomainhandle xen_domctl_setdomainhandle_t;
335 DEFINE_XEN_GUEST_HANDLE(xen_domctl_setdomainhandle_t);
338 /* XEN_DOMCTL_setdebugging */
339 struct xen_domctl_setdebugging {
340 uint8_t enable;
341 };
342 typedef struct xen_domctl_setdebugging xen_domctl_setdebugging_t;
343 DEFINE_XEN_GUEST_HANDLE(xen_domctl_setdebugging_t);
346 /* XEN_DOMCTL_irq_permission */
347 struct xen_domctl_irq_permission {
348 uint8_t pirq;
349 uint8_t allow_access; /* flag to specify enable/disable of IRQ access */
350 };
351 typedef struct xen_domctl_irq_permission xen_domctl_irq_permission_t;
352 DEFINE_XEN_GUEST_HANDLE(xen_domctl_irq_permission_t);
355 /* XEN_DOMCTL_iomem_permission */
356 struct xen_domctl_iomem_permission {
357 uint64_aligned_t first_mfn;/* first page (physical page number) in range */
358 uint64_aligned_t nr_mfns; /* number of pages in range (>0) */
359 uint8_t allow_access; /* allow (!0) or deny (0) access to range? */
360 };
361 typedef struct xen_domctl_iomem_permission xen_domctl_iomem_permission_t;
362 DEFINE_XEN_GUEST_HANDLE(xen_domctl_iomem_permission_t);
365 /* XEN_DOMCTL_ioport_permission */
366 struct xen_domctl_ioport_permission {
367 uint32_t first_port; /* first port int range */
368 uint32_t nr_ports; /* size of port range */
369 uint8_t allow_access; /* allow or deny access to range? */
370 };
371 typedef struct xen_domctl_ioport_permission xen_domctl_ioport_permission_t;
372 DEFINE_XEN_GUEST_HANDLE(xen_domctl_ioport_permission_t);
375 /* XEN_DOMCTL_hypercall_init */
376 struct xen_domctl_hypercall_init {
377 uint64_aligned_t gmfn; /* GMFN to be initialised */
378 };
379 typedef struct xen_domctl_hypercall_init xen_domctl_hypercall_init_t;
380 DEFINE_XEN_GUEST_HANDLE(xen_domctl_hypercall_init_t);
383 /* XEN_DOMCTL_arch_setup */
384 #define _XEN_DOMAINSETUP_hvm_guest 0
385 #define XEN_DOMAINSETUP_hvm_guest (1UL<<_XEN_DOMAINSETUP_hvm_guest)
386 #define _XEN_DOMAINSETUP_query 1 /* Get parameters (for save) */
387 #define XEN_DOMAINSETUP_query (1UL<<_XEN_DOMAINSETUP_query)
388 #define _XEN_DOMAINSETUP_sioemu_guest 2
389 #define XEN_DOMAINSETUP_sioemu_guest (1UL<<_XEN_DOMAINSETUP_sioemu_guest)
390 typedef struct xen_domctl_arch_setup {
391 uint64_aligned_t flags; /* XEN_DOMAINSETUP_* */
392 #ifdef __ia64__
393 uint64_aligned_t bp; /* mpaddr of boot param area */
394 uint64_aligned_t maxmem; /* Highest memory address for MDT. */
395 uint64_aligned_t xsi_va; /* Xen shared_info area virtual address. */
396 uint32_t hypercall_imm; /* Break imm for Xen hypercalls. */
397 int8_t vhpt_size_log2; /* Log2 of VHPT size. */
398 #endif
399 } xen_domctl_arch_setup_t;
400 DEFINE_XEN_GUEST_HANDLE(xen_domctl_arch_setup_t);
403 /* XEN_DOMCTL_settimeoffset */
404 struct xen_domctl_settimeoffset {
405 int32_t time_offset_seconds; /* applied to domain wallclock time */
406 };
407 typedef struct xen_domctl_settimeoffset xen_domctl_settimeoffset_t;
408 DEFINE_XEN_GUEST_HANDLE(xen_domctl_settimeoffset_t);
410 /* XEN_DOMCTL_gethvmcontext */
411 /* XEN_DOMCTL_sethvmcontext */
412 typedef struct xen_domctl_hvmcontext {
413 uint32_t size; /* IN/OUT: size of buffer / bytes filled */
414 XEN_GUEST_HANDLE_64(uint8) buffer; /* IN/OUT: data, or call
415 * gethvmcontext with NULL
416 * buffer to get size req'd */
417 } xen_domctl_hvmcontext_t;
418 DEFINE_XEN_GUEST_HANDLE(xen_domctl_hvmcontext_t);
421 /* XEN_DOMCTL_set_address_size */
422 /* XEN_DOMCTL_get_address_size */
423 typedef struct xen_domctl_address_size {
424 uint32_t size;
425 } xen_domctl_address_size_t;
426 DEFINE_XEN_GUEST_HANDLE(xen_domctl_address_size_t);
429 /* XEN_DOMCTL_real_mode_area */
430 struct xen_domctl_real_mode_area {
431 uint32_t log; /* log2 of Real Mode Area size */
432 };
433 typedef struct xen_domctl_real_mode_area xen_domctl_real_mode_area_t;
434 DEFINE_XEN_GUEST_HANDLE(xen_domctl_real_mode_area_t);
437 /* XEN_DOMCTL_sendtrigger */
438 #define XEN_DOMCTL_SENDTRIGGER_NMI 0
439 #define XEN_DOMCTL_SENDTRIGGER_RESET 1
440 #define XEN_DOMCTL_SENDTRIGGER_INIT 2
441 #define XEN_DOMCTL_SENDTRIGGER_POWER 3
442 struct xen_domctl_sendtrigger {
443 uint32_t trigger; /* IN */
444 uint32_t vcpu; /* IN */
445 };
446 typedef struct xen_domctl_sendtrigger xen_domctl_sendtrigger_t;
447 DEFINE_XEN_GUEST_HANDLE(xen_domctl_sendtrigger_t);
450 /* Assign PCI device to HVM guest. Sets up IOMMU structures. */
451 /* XEN_DOMCTL_assign_device */
452 /* XEN_DOMCTL_test_assign_device */
453 /* XEN_DOMCTL_deassign_device */
454 struct xen_domctl_assign_device {
455 uint32_t machine_bdf; /* machine PCI ID of assigned device */
456 };
457 typedef struct xen_domctl_assign_device xen_domctl_assign_device_t;
458 DEFINE_XEN_GUEST_HANDLE(xen_domctl_assign_device_t);
460 /* Retrieve sibling devices infomation of machine_bdf */
461 /* XEN_DOMCTL_get_device_group */
462 struct xen_domctl_get_device_group {
463 uint32_t machine_bdf; /* IN */
464 uint32_t max_sdevs; /* IN */
465 uint32_t num_sdevs; /* OUT */
466 XEN_GUEST_HANDLE_64(uint32) sdev_array; /* OUT */
467 };
468 typedef struct xen_domctl_get_device_group xen_domctl_get_device_group_t;
469 DEFINE_XEN_GUEST_HANDLE(xen_domctl_get_device_group_t);
471 /* Pass-through interrupts: bind real irq -> hvm devfn. */
472 /* XEN_DOMCTL_bind_pt_irq */
473 /* XEN_DOMCTL_unbind_pt_irq */
474 typedef enum pt_irq_type_e {
475 PT_IRQ_TYPE_PCI,
476 PT_IRQ_TYPE_ISA,
477 PT_IRQ_TYPE_MSI,
478 PT_IRQ_TYPE_MSI_TRANSLATE,
479 } pt_irq_type_t;
480 struct xen_domctl_bind_pt_irq {
481 uint32_t machine_irq;
482 pt_irq_type_t irq_type;
483 uint32_t hvm_domid;
485 union {
486 struct {
487 uint8_t isa_irq;
488 } isa;
489 struct {
490 uint8_t bus;
491 uint8_t device;
492 uint8_t intx;
493 } pci;
494 struct {
495 uint8_t gvec;
496 uint32_t gflags;
497 uint64_aligned_t gtable;
498 } msi;
499 } u;
500 };
501 typedef struct xen_domctl_bind_pt_irq xen_domctl_bind_pt_irq_t;
502 DEFINE_XEN_GUEST_HANDLE(xen_domctl_bind_pt_irq_t);
505 /* Bind machine I/O address range -> HVM address range. */
506 /* XEN_DOMCTL_memory_mapping */
507 #define DPCI_ADD_MAPPING 1
508 #define DPCI_REMOVE_MAPPING 0
509 struct xen_domctl_memory_mapping {
510 uint64_aligned_t first_gfn; /* first page (hvm guest phys page) in range */
511 uint64_aligned_t first_mfn; /* first page (machine page) in range */
512 uint64_aligned_t nr_mfns; /* number of pages in range (>0) */
513 uint32_t add_mapping; /* add or remove mapping */
514 uint32_t padding; /* padding for 64-bit aligned structure */
515 };
516 typedef struct xen_domctl_memory_mapping xen_domctl_memory_mapping_t;
517 DEFINE_XEN_GUEST_HANDLE(xen_domctl_memory_mapping_t);
520 /* Bind machine I/O port range -> HVM I/O port range. */
521 /* XEN_DOMCTL_ioport_mapping */
522 struct xen_domctl_ioport_mapping {
523 uint32_t first_gport; /* first guest IO port*/
524 uint32_t first_mport; /* first machine IO port */
525 uint32_t nr_ports; /* size of port range */
526 uint32_t add_mapping; /* add or remove mapping */
527 };
528 typedef struct xen_domctl_ioport_mapping xen_domctl_ioport_mapping_t;
529 DEFINE_XEN_GUEST_HANDLE(xen_domctl_ioport_mapping_t);
532 /*
533 * Pin caching type of RAM space for x86 HVM domU.
534 */
535 /* XEN_DOMCTL_pin_mem_cacheattr */
536 /* Caching types: these happen to be the same as x86 MTRR/PAT type codes. */
537 #define XEN_DOMCTL_MEM_CACHEATTR_UC 0
538 #define XEN_DOMCTL_MEM_CACHEATTR_WC 1
539 #define XEN_DOMCTL_MEM_CACHEATTR_WT 4
540 #define XEN_DOMCTL_MEM_CACHEATTR_WP 5
541 #define XEN_DOMCTL_MEM_CACHEATTR_WB 6
542 #define XEN_DOMCTL_MEM_CACHEATTR_UCM 7
543 struct xen_domctl_pin_mem_cacheattr {
544 uint64_aligned_t start, end;
545 uint32_t type; /* XEN_DOMCTL_MEM_CACHEATTR_* */
546 };
547 typedef struct xen_domctl_pin_mem_cacheattr xen_domctl_pin_mem_cacheattr_t;
548 DEFINE_XEN_GUEST_HANDLE(xen_domctl_pin_mem_cacheattr_t);
551 /* XEN_DOMCTL_set_ext_vcpucontext */
552 /* XEN_DOMCTL_get_ext_vcpucontext */
553 struct xen_domctl_ext_vcpucontext {
554 /* IN: VCPU that this call applies to. */
555 uint32_t vcpu;
556 /*
557 * SET: Size of struct (IN)
558 * GET: Size of struct (OUT)
559 */
560 uint32_t size;
561 #if defined(__i386__) || defined(__x86_64__)
562 /* SYSCALL from 32-bit mode and SYSENTER callback information. */
563 /* NB. SYSCALL from 64-bit mode is contained in vcpu_guest_context_t */
564 uint64_aligned_t syscall32_callback_eip;
565 uint64_aligned_t sysenter_callback_eip;
566 uint16_t syscall32_callback_cs;
567 uint16_t sysenter_callback_cs;
568 uint8_t syscall32_disables_events;
569 uint8_t sysenter_disables_events;
570 #endif
571 };
572 typedef struct xen_domctl_ext_vcpucontext xen_domctl_ext_vcpucontext_t;
573 DEFINE_XEN_GUEST_HANDLE(xen_domctl_ext_vcpucontext_t);
575 /*
576 * Set optimizaton features for a domain
577 */
578 /* XEN_DOMCTL_set_opt_feature */
579 struct xen_domctl_set_opt_feature {
580 #if defined(__ia64__)
581 struct xen_ia64_opt_feature optf;
582 #else
583 /* Make struct non-empty: do not depend on this field name! */
584 uint64_t dummy;
585 #endif
586 };
587 typedef struct xen_domctl_set_opt_feature xen_domctl_set_opt_feature_t;
588 DEFINE_XEN_GUEST_HANDLE(xen_domctl_set_opt_feature_t);
590 /*
591 * Set the target domain for a domain
592 */
593 /* XEN_DOMCTL_set_target */
594 struct xen_domctl_set_target {
595 domid_t target;
596 };
597 typedef struct xen_domctl_set_target xen_domctl_set_target_t;
598 DEFINE_XEN_GUEST_HANDLE(xen_domctl_set_target_t);
600 #if defined(__i386__) || defined(__x86_64__)
601 # define XEN_CPUID_INPUT_UNUSED 0xFFFFFFFF
602 /* XEN_DOMCTL_set_cpuid */
603 struct xen_domctl_cpuid {
604 uint32_t input[2];
605 uint32_t eax;
606 uint32_t ebx;
607 uint32_t ecx;
608 uint32_t edx;
609 };
610 typedef struct xen_domctl_cpuid xen_domctl_cpuid_t;
611 DEFINE_XEN_GUEST_HANDLE(xen_domctl_cpuid_t);
612 #endif
614 /* XEN_DOMCTL_subscribe */
615 struct xen_domctl_subscribe {
616 uint32_t port; /* IN */
617 };
618 typedef struct xen_domctl_subscribe xen_domctl_subscribe_t;
619 DEFINE_XEN_GUEST_HANDLE(xen_domctl_subscribe_t);
621 /*
622 * Define the maximum machine address size which should be allocated
623 * to a guest.
624 */
625 /* XEN_DOMCTL_set_machine_address_size */
626 /* XEN_DOMCTL_get_machine_address_size */
628 /*
629 * Do not inject spurious page faults into this domain.
630 */
631 /* XEN_DOMCTL_suppress_spurious_page_faults */
633 /* XEN_DOMCTL_debug_op */
634 #define XEN_DOMCTL_DEBUG_OP_SINGLE_STEP_OFF 0
635 #define XEN_DOMCTL_DEBUG_OP_SINGLE_STEP_ON 1
636 struct xen_domctl_debug_op {
637 uint32_t op; /* IN */
638 uint32_t vcpu; /* IN */
639 };
640 typedef struct xen_domctl_debug_op xen_domctl_debug_op_t;
641 DEFINE_XEN_GUEST_HANDLE(xen_domctl_debug_op_t);
643 /*
644 * Request a particular record from the HVM context
645 */
646 /* XEN_DOMCTL_gethvmcontext_partial */
647 typedef struct xen_domctl_hvmcontext_partial {
648 uint32_t type; /* IN: Type of record required */
649 uint32_t instance; /* IN: Instance of that type */
650 XEN_GUEST_HANDLE_64(uint8) buffer; /* OUT: buffer to write record into */
651 } xen_domctl_hvmcontext_partial_t;
652 DEFINE_XEN_GUEST_HANDLE(xen_domctl_hvmcontext_partial_t);
654 /* XEN_DOMCTL_disable_migrate */
655 typedef struct xen_domctl_disable_migrate {
656 uint32_t disable; /* IN: 1: disable migration and restore */
657 } xen_domctl_disable_migrate_t;
660 /* XEN_DOMCTL_gettscinfo */
661 /* XEN_DOMCTL_settscinfo */
662 struct xen_guest_tsc_info {
663 uint32_t tsc_mode;
664 uint32_t gtsc_khz;
665 uint32_t incarnation;
666 uint32_t pad;
667 uint64_aligned_t elapsed_nsec;
668 };
669 typedef struct xen_guest_tsc_info xen_guest_tsc_info_t;
670 DEFINE_XEN_GUEST_HANDLE(xen_guest_tsc_info_t);
671 typedef struct xen_domctl_tsc_info {
672 XEN_GUEST_HANDLE_64(xen_guest_tsc_info_t) out_info; /* OUT */
673 xen_guest_tsc_info_t info; /* IN */
674 } xen_domctl_tsc_info_t;
676 /* XEN_DOMCTL_gdbsx_guestmemio guest mem io */
677 struct xen_domctl_gdbsx_memio {
678 /* IN */
679 uint64_aligned_t pgd3val;/* optional: init_mm.pgd[3] value */
680 uint64_aligned_t gva; /* guest virtual address */
681 uint64_aligned_t uva; /* user buffer virtual address */
682 uint32_t len; /* number of bytes to read/write */
683 uint8_t gwr; /* 0 = read from guest. 1 = write to guest */
684 /* OUT */
685 uint32_t remain; /* bytes remaining to be copied */
686 };
688 /* XEN_DOMCTL_gdbsx_pausevcpu */
689 /* XEN_DOMCTL_gdbsx_unpausevcpu */
690 struct xen_domctl_gdbsx_pauseunp_vcpu { /* pause/unpause a vcpu */
691 uint32_t vcpu; /* which vcpu */
692 };
694 /* XEN_DOMCTL_gdbsx_domstatus */
695 struct xen_domctl_gdbsx_domstatus {
696 /* OUT */
697 uint8_t paused; /* is the domain paused */
698 uint32_t vcpu_id; /* any vcpu in an event? */
699 uint32_t vcpu_ev; /* if yes, what event? */
700 };
702 /*
703 * Memory event operations
704 */
706 /* XEN_DOMCTL_mem_event_op */
708 /* Add and remove memory handlers */
709 #define XEN_DOMCTL_MEM_EVENT_OP_ENABLE 0
710 #define XEN_DOMCTL_MEM_EVENT_OP_DISABLE 1
712 /*
713 * Page memory in and out.
714 */
715 #define XEN_DOMCTL_MEM_EVENT_OP_PAGING (1 << 0)
717 /* Domain memory paging */
718 #define XEN_DOMCTL_MEM_EVENT_OP_PAGING_NOMINATE 0
719 #define XEN_DOMCTL_MEM_EVENT_OP_PAGING_EVICT 1
720 #define XEN_DOMCTL_MEM_EVENT_OP_PAGING_PREP 2
721 #define XEN_DOMCTL_MEM_EVENT_OP_PAGING_RESUME 3
723 struct xen_domctl_mem_event_op {
724 uint32_t op; /* XEN_DOMCTL_MEM_EVENT_OP_* */
725 uint32_t mode; /* XEN_DOMCTL_MEM_EVENT_ENABLE_* */
727 /* OP_ENABLE */
728 uint64_aligned_t shared_addr; /* IN: Virtual address of shared page */
729 uint64_aligned_t ring_addr; /* IN: Virtual address of ring page */
731 /* Other OPs */
732 uint64_aligned_t gfn; /* IN: gfn of page being operated on */
733 };
734 typedef struct xen_domctl_mem_event_op xen_domctl_mem_event_op_t;
735 DEFINE_XEN_GUEST_HANDLE(xen_domctl_mem_event_op_t);
737 /*
738 * Memory sharing operations
739 */
740 /* XEN_DOMCTL_mem_sharing_op */
742 #define XEN_DOMCTL_MEM_SHARING_OP_CONTROL 0
743 #define XEN_DOMCTL_MEM_SHARING_OP_NOMINATE_GFN 1
744 #define XEN_DOMCTL_MEM_SHARING_OP_NOMINATE_GREF 2
745 #define XEN_DOMCTL_MEM_SHARING_OP_SHARE 3
746 #define XEN_DOMCTL_MEM_SHARING_OP_RESUME 4
747 #define XEN_DOMCTL_MEM_SHARING_OP_DEBUG_GFN 5
748 #define XEN_DOMCTL_MEM_SHARING_OP_DEBUG_MFN 6
749 #define XEN_DOMCTL_MEM_SHARING_OP_DEBUG_GREF 7
751 #define XEN_DOMCTL_MEM_SHARING_S_HANDLE_INVALID (-10)
752 #define XEN_DOMCTL_MEM_SHARING_C_HANDLE_INVALID (-9)
754 struct xen_domctl_mem_sharing_op {
755 uint8_t op; /* XEN_DOMCTL_MEM_EVENT_OP_* */
757 union {
758 uint8_t enable; /* OP_CONTROL */
760 struct mem_sharing_op_nominate { /* OP_NOMINATE_xxx */
761 union {
762 uint64_aligned_t gfn; /* IN: gfn to nominate */
763 uint32_t grant_ref; /* IN: grant ref to nominate */
764 } u;
765 uint64_aligned_t handle; /* OUT: the handle */
766 } nominate;
767 struct mem_sharing_op_share { /* OP_SHARE */
768 uint64_aligned_t source_handle; /* IN: handle to the source page */
769 uint64_aligned_t client_handle; /* IN: handle to the client page */
770 } share;
771 struct mem_sharing_op_debug { /* OP_DEBUG_xxx */
772 union {
773 uint64_aligned_t gfn; /* IN: gfn to debug */
774 uint64_aligned_t mfn; /* IN: mfn to debug */
775 grant_ref_t gref; /* IN: gref to debug */
776 } u;
777 } debug;
778 } u;
779 };
780 typedef struct xen_domctl_mem_sharing_op xen_domctl_mem_sharing_op_t;
781 DEFINE_XEN_GUEST_HANDLE(xen_domctl_mem_sharing_op_t);
784 struct xen_domctl {
785 uint32_t cmd;
786 #define XEN_DOMCTL_createdomain 1
787 #define XEN_DOMCTL_destroydomain 2
788 #define XEN_DOMCTL_pausedomain 3
789 #define XEN_DOMCTL_unpausedomain 4
790 #define XEN_DOMCTL_getdomaininfo 5
791 #define XEN_DOMCTL_getmemlist 6
792 #define XEN_DOMCTL_getpageframeinfo 7
793 #define XEN_DOMCTL_getpageframeinfo2 8
794 #define XEN_DOMCTL_setvcpuaffinity 9
795 #define XEN_DOMCTL_shadow_op 10
796 #define XEN_DOMCTL_max_mem 11
797 #define XEN_DOMCTL_setvcpucontext 12
798 #define XEN_DOMCTL_getvcpucontext 13
799 #define XEN_DOMCTL_getvcpuinfo 14
800 #define XEN_DOMCTL_max_vcpus 15
801 #define XEN_DOMCTL_scheduler_op 16
802 #define XEN_DOMCTL_setdomainhandle 17
803 #define XEN_DOMCTL_setdebugging 18
804 #define XEN_DOMCTL_irq_permission 19
805 #define XEN_DOMCTL_iomem_permission 20
806 #define XEN_DOMCTL_ioport_permission 21
807 #define XEN_DOMCTL_hypercall_init 22
808 #define XEN_DOMCTL_arch_setup 23
809 #define XEN_DOMCTL_settimeoffset 24
810 #define XEN_DOMCTL_getvcpuaffinity 25
811 #define XEN_DOMCTL_real_mode_area 26
812 #define XEN_DOMCTL_resumedomain 27
813 #define XEN_DOMCTL_sendtrigger 28
814 #define XEN_DOMCTL_subscribe 29
815 #define XEN_DOMCTL_gethvmcontext 33
816 #define XEN_DOMCTL_sethvmcontext 34
817 #define XEN_DOMCTL_set_address_size 35
818 #define XEN_DOMCTL_get_address_size 36
819 #define XEN_DOMCTL_assign_device 37
820 #define XEN_DOMCTL_bind_pt_irq 38
821 #define XEN_DOMCTL_memory_mapping 39
822 #define XEN_DOMCTL_ioport_mapping 40
823 #define XEN_DOMCTL_pin_mem_cacheattr 41
824 #define XEN_DOMCTL_set_ext_vcpucontext 42
825 #define XEN_DOMCTL_get_ext_vcpucontext 43
826 #define XEN_DOMCTL_set_opt_feature 44
827 #define XEN_DOMCTL_test_assign_device 45
828 #define XEN_DOMCTL_set_target 46
829 #define XEN_DOMCTL_deassign_device 47
830 #define XEN_DOMCTL_unbind_pt_irq 48
831 #define XEN_DOMCTL_set_cpuid 49
832 #define XEN_DOMCTL_get_device_group 50
833 #define XEN_DOMCTL_set_machine_address_size 51
834 #define XEN_DOMCTL_get_machine_address_size 52
835 #define XEN_DOMCTL_suppress_spurious_page_faults 53
836 #define XEN_DOMCTL_debug_op 54
837 #define XEN_DOMCTL_gethvmcontext_partial 55
838 #define XEN_DOMCTL_mem_event_op 56
839 #define XEN_DOMCTL_mem_sharing_op 57
840 #define XEN_DOMCTL_disable_migrate 58
841 #define XEN_DOMCTL_gettscinfo 59
842 #define XEN_DOMCTL_settscinfo 60
843 #define XEN_DOMCTL_getpageframeinfo3 61
844 #define XEN_DOMCTL_gdbsx_guestmemio 1000
845 #define XEN_DOMCTL_gdbsx_pausevcpu 1001
846 #define XEN_DOMCTL_gdbsx_unpausevcpu 1002
847 #define XEN_DOMCTL_gdbsx_domstatus 1003
848 uint32_t interface_version; /* XEN_DOMCTL_INTERFACE_VERSION */
849 domid_t domain;
850 union {
851 struct xen_domctl_createdomain createdomain;
852 struct xen_domctl_getdomaininfo getdomaininfo;
853 struct xen_domctl_getmemlist getmemlist;
854 struct xen_domctl_getpageframeinfo getpageframeinfo;
855 struct xen_domctl_getpageframeinfo2 getpageframeinfo2;
856 struct xen_domctl_getpageframeinfo3 getpageframeinfo3;
857 struct xen_domctl_vcpuaffinity vcpuaffinity;
858 struct xen_domctl_shadow_op shadow_op;
859 struct xen_domctl_max_mem max_mem;
860 struct xen_domctl_vcpucontext vcpucontext;
861 struct xen_domctl_getvcpuinfo getvcpuinfo;
862 struct xen_domctl_max_vcpus max_vcpus;
863 struct xen_domctl_scheduler_op scheduler_op;
864 struct xen_domctl_setdomainhandle setdomainhandle;
865 struct xen_domctl_setdebugging setdebugging;
866 struct xen_domctl_irq_permission irq_permission;
867 struct xen_domctl_iomem_permission iomem_permission;
868 struct xen_domctl_ioport_permission ioport_permission;
869 struct xen_domctl_hypercall_init hypercall_init;
870 struct xen_domctl_arch_setup arch_setup;
871 struct xen_domctl_settimeoffset settimeoffset;
872 struct xen_domctl_disable_migrate disable_migrate;
873 struct xen_domctl_tsc_info tsc_info;
874 struct xen_domctl_real_mode_area real_mode_area;
875 struct xen_domctl_hvmcontext hvmcontext;
876 struct xen_domctl_hvmcontext_partial hvmcontext_partial;
877 struct xen_domctl_address_size address_size;
878 struct xen_domctl_sendtrigger sendtrigger;
879 struct xen_domctl_get_device_group get_device_group;
880 struct xen_domctl_assign_device assign_device;
881 struct xen_domctl_bind_pt_irq bind_pt_irq;
882 struct xen_domctl_memory_mapping memory_mapping;
883 struct xen_domctl_ioport_mapping ioport_mapping;
884 struct xen_domctl_pin_mem_cacheattr pin_mem_cacheattr;
885 struct xen_domctl_ext_vcpucontext ext_vcpucontext;
886 struct xen_domctl_set_opt_feature set_opt_feature;
887 struct xen_domctl_set_target set_target;
888 struct xen_domctl_subscribe subscribe;
889 struct xen_domctl_debug_op debug_op;
890 struct xen_domctl_mem_event_op mem_event_op;
891 struct xen_domctl_mem_sharing_op mem_sharing_op;
892 #if defined(__i386__) || defined(__x86_64__)
893 struct xen_domctl_cpuid cpuid;
894 #endif
895 struct xen_domctl_gdbsx_memio gdbsx_guest_memio;
896 struct xen_domctl_gdbsx_pauseunp_vcpu gdbsx_pauseunp_vcpu;
897 struct xen_domctl_gdbsx_domstatus gdbsx_domstatus;
898 uint8_t pad[128];
899 } u;
900 };
901 typedef struct xen_domctl xen_domctl_t;
902 DEFINE_XEN_GUEST_HANDLE(xen_domctl_t);
904 #endif /* __XEN_PUBLIC_DOMCTL_H__ */
906 /*
907 * Local variables:
908 * mode: C
909 * c-set-style: "BSD"
910 * c-basic-offset: 4
911 * tab-width: 4
912 * indent-tabs-mode: nil
913 * End:
914 */