direct-io.hg

view xen/include/public/domctl.h @ 11297:13e09ec65862

Revert powerpc build break after dom0_ops split.
Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
author kaf24@firebug.cl.cam.ac.uk
date Wed Aug 30 18:08:19 2006 +0100 (2006-08-30)
parents 86d26e6ec89b
children d741e86a8766
line source
1 /******************************************************************************
2 * domctl.h
3 *
4 * Domain management operations. For use by node control stack.
5 *
6 * Copyright (c) 2002-2003, B Dragovic
7 * Copyright (c) 2002-2006, K Fraser
8 */
10 #ifndef __XEN_PUBLIC_DOMCTL_H__
11 #define __XEN_PUBLIC_DOMCTL_H__
13 #if !defined(__XEN__) && !defined(__XEN_TOOLS__)
14 #error "domctl operations are intended for use by node control tools only"
15 #endif
17 #include "xen.h"
19 #define XEN_DOMCTL_INTERFACE_VERSION 0x00000001
21 #define uint64_t uint64_aligned_t
23 struct xenctl_cpumap {
24 XEN_GUEST_HANDLE_64(uint8_t) bitmap;
25 uint32_t nr_cpus;
26 };
28 /*
29 * NB. xen_domctl.domain is an IN/OUT parameter for this operation.
30 * If it is specified as zero, an id is auto-allocated and returned.
31 */
32 #define XEN_DOMCTL_createdomain 1
33 struct xen_domctl_createdomain {
34 /* IN parameters */
35 uint32_t ssidref;
36 xen_domain_handle_t handle;
37 };
38 typedef struct xen_domctl_createdomain xen_domctl_createdomain_t;
39 DEFINE_XEN_GUEST_HANDLE(xen_domctl_createdomain_t);
41 #define XEN_DOMCTL_destroydomain 2
42 #define XEN_DOMCTL_pausedomain 3
43 #define XEN_DOMCTL_unpausedomain 4
45 #define XEN_DOMCTL_getdomaininfo 5
46 struct xen_domctl_getdomaininfo {
47 /* OUT variables. */
48 domid_t domain; /* Also echoed in domctl.domain */
49 #define DOMFLAGS_DYING (1<<0) /* Domain is scheduled to die. */
50 #define DOMFLAGS_SHUTDOWN (1<<2) /* The guest OS has shut down. */
51 #define DOMFLAGS_PAUSED (1<<3) /* Currently paused by control software. */
52 #define DOMFLAGS_BLOCKED (1<<4) /* Currently blocked pending an event. */
53 #define DOMFLAGS_RUNNING (1<<5) /* Domain is currently running. */
54 #define DOMFLAGS_CPUMASK 255 /* CPU to which this domain is bound. */
55 #define DOMFLAGS_CPUSHIFT 8
56 #define DOMFLAGS_SHUTDOWNMASK 255 /* DOMFLAGS_SHUTDOWN guest-supplied code. */
57 #define DOMFLAGS_SHUTDOWNSHIFT 16
58 uint32_t flags;
59 uint64_t tot_pages;
60 uint64_t max_pages;
61 uint64_t shared_info_frame; /* MFN of shared_info struct */
62 uint64_t cpu_time;
63 uint32_t nr_online_vcpus; /* Number of VCPUs currently online. */
64 uint32_t max_vcpu_id; /* Maximum VCPUID in use by this domain. */
65 uint32_t ssidref;
66 xen_domain_handle_t handle;
67 };
68 typedef struct xen_domctl_getdomaininfo xen_domctl_getdomaininfo_t;
69 DEFINE_XEN_GUEST_HANDLE(xen_domctl_getdomaininfo_t);
72 #define XEN_DOMCTL_getmemlist 6
73 struct xen_domctl_getmemlist {
74 /* IN variables. */
75 uint64_t max_pfns;
76 XEN_GUEST_HANDLE_64(xen_pfn_t) buffer;
77 /* OUT variables. */
78 uint64_t num_pfns;
79 };
80 typedef struct xen_domctl_getmemlist xen_domctl_getmemlist_t;
81 DEFINE_XEN_GUEST_HANDLE(xen_domctl_getmemlist_t);
84 #define XEN_DOMCTL_getpageframeinfo 7
86 #define XEN_DOMCTL_PFINFO_LTAB_SHIFT 28
87 #define XEN_DOMCTL_PFINFO_NOTAB (0x0<<28)
88 #define XEN_DOMCTL_PFINFO_L1TAB (0x1<<28)
89 #define XEN_DOMCTL_PFINFO_L2TAB (0x2<<28)
90 #define XEN_DOMCTL_PFINFO_L3TAB (0x3<<28)
91 #define XEN_DOMCTL_PFINFO_L4TAB (0x4<<28)
92 #define XEN_DOMCTL_PFINFO_LTABTYPE_MASK (0x7<<28)
93 #define XEN_DOMCTL_PFINFO_LPINTAB (0x1<<31)
94 #define XEN_DOMCTL_PFINFO_XTAB (0xf<<28) /* invalid page */
95 #define XEN_DOMCTL_PFINFO_LTAB_MASK (0xf<<28)
97 struct xen_domctl_getpageframeinfo {
98 /* IN variables. */
99 uint64_t gmfn; /* GMFN to query */
100 /* OUT variables. */
101 /* Is the page PINNED to a type? */
102 uint32_t type; /* see above type defs */
103 };
104 typedef struct xen_domctl_getpageframeinfo xen_domctl_getpageframeinfo_t;
105 DEFINE_XEN_GUEST_HANDLE(xen_domctl_getpageframeinfo_t);
108 #define XEN_DOMCTL_getpageframeinfo2 8
109 struct xen_domctl_getpageframeinfo2 {
110 /* IN variables. */
111 uint64_t num;
112 /* IN/OUT variables. */
113 XEN_GUEST_HANDLE_64(ulong) array;
114 };
115 typedef struct xen_domctl_getpageframeinfo2 xen_domctl_getpageframeinfo2_t;
116 DEFINE_XEN_GUEST_HANDLE(xen_domctl_getpageframeinfo2_t);
119 /*
120 * Control shadow pagetables operation
121 */
122 #define XEN_DOMCTL_shadow_op 10
124 /* Disable shadow mode. */
125 #define XEN_DOMCTL_SHADOW_OP_OFF 0
127 /* Enable shadow mode (mode contains ORed XEN_DOMCTL_SHADOW_ENABLE_* flags). */
128 #define XEN_DOMCTL_SHADOW_OP_ENABLE 32
130 /* Log-dirty bitmap operations. */
131 /* Return the bitmap and clean internal copy for next round. */
132 #define XEN_DOMCTL_SHADOW_OP_CLEAN 11
133 /* Return the bitmap but do not modify internal copy. */
134 #define XEN_DOMCTL_SHADOW_OP_PEEK 12
136 /* Memory allocation accessors. */
137 #define XEN_DOMCTL_SHADOW_OP_GET_ALLOCATION 30
138 #define XEN_DOMCTL_SHADOW_OP_SET_ALLOCATION 31
140 /* Legacy enable operations. */
141 /* Equiv. to ENABLE with no mode flags. */
142 #define XEN_DOMCTL_SHADOW_OP_ENABLE_TEST 1
143 /* Equiv. to ENABLE with mode flag ENABLE_LOG_DIRTY. */
144 #define XEN_DOMCTL_SHADOW_OP_ENABLE_LOGDIRTY 2
145 /* Equiv. to ENABLE with mode flags ENABLE_REFCOUNT and ENABLE_TRANSLATE. */
146 #define XEN_DOMCTL_SHADOW_OP_ENABLE_TRANSLATE 3
148 /* Mode flags for XEN_DOMCTL_SHADOW_OP_ENABLE. */
149 /*
150 * Shadow pagetables are refcounted: guest does not use explicit mmu
151 * operations nor write-protect its pagetables.
152 */
153 #define XEN_DOMCTL_SHADOW_ENABLE_REFCOUNT (1 << 1)
154 /*
155 * Log pages in a bitmap as they are dirtied.
156 * Used for live relocation to determine which pages must be re-sent.
157 */
158 #define XEN_DOMCTL_SHADOW_ENABLE_LOG_DIRTY (1 << 2)
159 /*
160 * Automatically translate GPFNs into MFNs.
161 */
162 #define XEN_DOMCTL_SHADOW_ENABLE_TRANSLATE (1 << 3)
163 /*
164 * Xen does not steal virtual address space from the guest.
165 * Requires HVM support.
166 */
167 #define XEN_DOMCTL_SHADOW_ENABLE_EXTERNAL (1 << 4)
169 struct xen_domctl_shadow_op_stats {
170 uint32_t fault_count;
171 uint32_t dirty_count;
172 };
173 typedef struct xen_domctl_shadow_op_stats xen_domctl_shadow_op_stats_t;
174 DEFINE_XEN_GUEST_HANDLE(xen_domctl_shadow_op_stats_t);
176 struct xen_domctl_shadow_op {
177 /* IN variables. */
178 uint32_t op; /* XEN_DOMCTL_SHADOW_OP_* */
180 /* OP_ENABLE */
181 uint32_t mode; /* XEN_DOMCTL_SHADOW_ENABLE_* */
183 /* OP_GET_ALLOCATION / OP_SET_ALLOCATION */
184 uint32_t mb; /* Shadow memory allocation in MB */
186 /* OP_PEEK / OP_CLEAN */
187 XEN_GUEST_HANDLE_64(ulong) dirty_bitmap;
188 uint64_t pages; /* Size of buffer. Updated with actual size. */
189 struct xen_domctl_shadow_op_stats stats;
190 };
191 typedef struct xen_domctl_shadow_op xen_domctl_shadow_op_t;
192 DEFINE_XEN_GUEST_HANDLE(xen_domctl_shadow_op_t);
195 #define XEN_DOMCTL_max_mem 11
196 struct xen_domctl_max_mem {
197 /* IN variables. */
198 uint64_t max_memkb;
199 };
200 typedef struct xen_domctl_max_mem xen_domctl_max_mem_t;
201 DEFINE_XEN_GUEST_HANDLE(xen_domctl_max_mem_t);
204 #define XEN_DOMCTL_setvcpucontext 12
205 #define XEN_DOMCTL_getvcpucontext 13
206 struct xen_domctl_vcpucontext {
207 uint32_t vcpu; /* IN */
208 XEN_GUEST_HANDLE_64(vcpu_guest_context_t) ctxt; /* IN/OUT */
209 };
210 typedef struct xen_domctl_vcpucontext xen_domctl_vcpucontext_t;
211 DEFINE_XEN_GUEST_HANDLE(xen_domctl_vcpucontext_t);
214 #define XEN_DOMCTL_getvcpuinfo 14
215 struct xen_domctl_getvcpuinfo {
216 /* IN variables. */
217 uint32_t vcpu;
218 /* OUT variables. */
219 uint8_t online; /* currently online (not hotplugged)? */
220 uint8_t blocked; /* blocked waiting for an event? */
221 uint8_t running; /* currently scheduled on its CPU? */
222 uint64_t cpu_time; /* total cpu time consumed (ns) */
223 uint32_t cpu; /* current mapping */
224 };
225 typedef struct xen_domctl_getvcpuinfo xen_domctl_getvcpuinfo_t;
226 DEFINE_XEN_GUEST_HANDLE(xen_domctl_getvcpuinfo_t);
229 /* Get/set which physical cpus a vcpu can execute on. */
230 #define XEN_DOMCTL_setvcpuaffinity 9
231 #define XEN_DOMCTL_getvcpuaffinity 25
232 struct xen_domctl_vcpuaffinity {
233 uint32_t vcpu; /* IN */
234 struct xenctl_cpumap cpumap; /* IN/OUT */
235 };
236 typedef struct xen_domctl_vcpuaffinity xen_domctl_vcpuaffinity_t;
237 DEFINE_XEN_GUEST_HANDLE(xen_domctl_vcpuaffinity_t);
240 #define XEN_DOMCTL_max_vcpus 15
241 struct xen_domctl_max_vcpus {
242 uint32_t max; /* maximum number of vcpus */
243 };
244 typedef struct xen_domctl_max_vcpus xen_domctl_max_vcpus_t;
245 DEFINE_XEN_GUEST_HANDLE(xen_domctl_max_vcpus_t);
248 #define XEN_DOMCTL_scheduler_op 16
249 /* Scheduler types. */
250 #define XEN_SCHEDULER_SEDF 4
251 #define XEN_SCHEDULER_CREDIT 5
252 /* Set or get info? */
253 #define XEN_DOMCTL_SCHEDOP_putinfo 0
254 #define XEN_DOMCTL_SCHEDOP_getinfo 1
255 struct xen_domctl_scheduler_op {
256 uint32_t sched_id; /* XEN_SCHEDULER_* */
257 uint32_t cmd; /* XEN_DOMCTL_SCHEDOP_* */
258 union {
259 struct xen_domctl_sched_sedf {
260 uint64_t period;
261 uint64_t slice;
262 uint64_t latency;
263 uint32_t extratime;
264 uint32_t weight;
265 } sedf;
266 struct xen_domctl_sched_credit {
267 uint16_t weight;
268 uint16_t cap;
269 } credit;
270 } u;
271 };
272 typedef struct xen_domctl_scheduler_op xen_domctl_scheduler_op_t;
273 DEFINE_XEN_GUEST_HANDLE(xen_domctl_scheduler_op_t);
276 #define XEN_DOMCTL_setdomainhandle 17
277 struct xen_domctl_setdomainhandle {
278 xen_domain_handle_t handle;
279 };
280 typedef struct xen_domctl_setdomainhandle xen_domctl_setdomainhandle_t;
281 DEFINE_XEN_GUEST_HANDLE(xen_domctl_setdomainhandle_t);
284 #define XEN_DOMCTL_setdebugging 18
285 struct xen_domctl_setdebugging {
286 uint8_t enable;
287 };
288 typedef struct xen_domctl_setdebugging xen_domctl_setdebugging_t;
289 DEFINE_XEN_GUEST_HANDLE(xen_domctl_setdebugging_t);
292 #define XEN_DOMCTL_irq_permission 19
293 struct xen_domctl_irq_permission {
294 uint8_t pirq;
295 uint8_t allow_access; /* flag to specify enable/disable of IRQ access */
296 };
297 typedef struct xen_domctl_irq_permission xen_domctl_irq_permission_t;
298 DEFINE_XEN_GUEST_HANDLE(xen_domctl_irq_permission_t);
301 #define XEN_DOMCTL_iomem_permission 20
302 struct xen_domctl_iomem_permission {
303 uint64_t first_mfn; /* first page (physical page number) in range */
304 uint64_t nr_mfns; /* number of pages in range (>0) */
305 uint8_t allow_access; /* allow (!0) or deny (0) access to range? */
306 };
307 typedef struct xen_domctl_iomem_permission xen_domctl_iomem_permission_t;
308 DEFINE_XEN_GUEST_HANDLE(xen_domctl_iomem_permission_t);
311 #define XEN_DOMCTL_ioport_permission 21
312 struct xen_domctl_ioport_permission {
313 uint32_t first_port; /* first port int range */
314 uint32_t nr_ports; /* size of port range */
315 uint8_t allow_access; /* allow or deny access to range? */
316 };
317 typedef struct xen_domctl_ioport_permission xen_domctl_ioport_permission_t;
318 DEFINE_XEN_GUEST_HANDLE(xen_domctl_ioport_permission_t);
320 #define XEN_DOMCTL_hypercall_init 22
321 struct xen_domctl_hypercall_init {
322 uint64_t gmfn; /* GMFN to be initialised */
323 };
324 typedef struct xen_domctl_hypercall_init xen_domctl_hypercall_init_t;
325 DEFINE_XEN_GUEST_HANDLE(xen_domctl_hypercall_init_t);
327 #define XEN_DOMCTL_arch_setup 23
328 #define _XEN_DOMAINSETUP_hvm_guest 0
329 #define XEN_DOMAINSETUP_hvm_guest (1UL<<_XEN_DOMAINSETUP_hvm_guest)
330 #define _XEN_DOMAINSETUP_query 1 /* Get parameters (for save) */
331 #define XEN_DOMAINSETUP_query (1UL<<_XEN_DOMAINSETUP_query)
332 typedef struct xen_domctl_arch_setup {
333 uint64_t flags; /* XEN_DOMAINSETUP_* */
334 #ifdef __ia64__
335 uint64_t bp; /* mpaddr of boot param area */
336 uint64_t maxmem; /* Highest memory address for MDT. */
337 uint64_t xsi_va; /* Xen shared_info area virtual address. */
338 uint32_t hypercall_imm; /* Break imm for Xen hypercalls. */
339 #endif
340 } xen_domctl_arch_setup_t;
341 DEFINE_XEN_GUEST_HANDLE(xen_domctl_arch_setup_t);
343 #define XEN_DOMCTL_settimeoffset 24
344 struct xen_domctl_settimeoffset {
345 int32_t time_offset_seconds; /* applied to domain wallclock time */
346 };
347 typedef struct xen_domctl_settimeoffset xen_domctl_settimeoffset_t;
348 DEFINE_XEN_GUEST_HANDLE(xen_domctl_settimeoffset_t);
350 struct xen_domctl {
351 uint32_t cmd;
352 uint32_t interface_version; /* XEN_DOMCTL_INTERFACE_VERSION */
353 domid_t domain;
354 union {
355 struct xen_domctl_createdomain createdomain;
356 struct xen_domctl_getdomaininfo getdomaininfo;
357 struct xen_domctl_getmemlist getmemlist;
358 struct xen_domctl_getpageframeinfo getpageframeinfo;
359 struct xen_domctl_getpageframeinfo2 getpageframeinfo2;
360 struct xen_domctl_vcpuaffinity vcpuaffinity;
361 struct xen_domctl_shadow_op shadow_op;
362 struct xen_domctl_max_mem max_mem;
363 struct xen_domctl_vcpucontext vcpucontext;
364 struct xen_domctl_getvcpuinfo getvcpuinfo;
365 struct xen_domctl_max_vcpus max_vcpus;
366 struct xen_domctl_scheduler_op scheduler_op;
367 struct xen_domctl_setdomainhandle setdomainhandle;
368 struct xen_domctl_setdebugging setdebugging;
369 struct xen_domctl_irq_permission irq_permission;
370 struct xen_domctl_iomem_permission iomem_permission;
371 struct xen_domctl_ioport_permission ioport_permission;
372 struct xen_domctl_hypercall_init hypercall_init;
373 struct xen_domctl_arch_setup arch_setup;
374 struct xen_domctl_settimeoffset settimeoffset;
375 uint8_t pad[128];
376 } u;
377 };
378 typedef struct xen_domctl xen_domctl_t;
379 DEFINE_XEN_GUEST_HANDLE(xen_domctl_t);
381 #undef uint64_t
383 #endif /* __XEN_PUBLIC_DOMCTL_H__ */
385 /*
386 * Local variables:
387 * mode: C
388 * c-set-style: "BSD"
389 * c-basic-offset: 4
390 * tab-width: 4
391 * indent-tabs-mode: nil
392 * End:
393 */