ia64/xen-unstable

view xen/include/public/domctl.h @ 12938:b58670602d35

[POWERPC][XEN] Builtin cmdline dependency rule
Rebuild cmdline.o when the user changes the CMDLINE=X argument passed to
the make invocation. I couldn't find an example of another project that
handles this case properly, so I came up with this.
Signed-off-by: Amos Waterland <apw@us.ibm.com>
Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
author Hollis Blanchard <hollisb@us.ibm.com>
date Thu Oct 05 15:48:26 2006 -0500 (2006-10-05)
parents 8d0e06c38c0c
children 45765c7a5066
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"
37 #define XEN_DOMCTL_INTERFACE_VERSION 0x00000004
39 struct xenctl_cpumap {
40 XEN_GUEST_HANDLE(uint8_t) bitmap;
41 uint32_t nr_cpus;
42 };
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 uint32_t flags;
57 };
58 typedef struct xen_domctl_createdomain xen_domctl_createdomain_t;
59 DEFINE_XEN_GUEST_HANDLE(xen_domctl_createdomain_t);
61 #define XEN_DOMCTL_destroydomain 2
62 #define XEN_DOMCTL_pausedomain 3
63 #define XEN_DOMCTL_unpausedomain 4
65 #define XEN_DOMCTL_getdomaininfo 5
66 struct xen_domctl_getdomaininfo {
67 /* OUT variables. */
68 domid_t domain; /* Also echoed in domctl.domain */
69 /* Domain is scheduled to die. */
70 #define _XEN_DOMINF_dying 0
71 #define XEN_DOMINF_dying (1U<<_XEN_DOMINF_dying)
72 /* Domain is an HVM guest (as opposed to a PV guest). */
73 #define _XEN_DOMINF_hvm_guest 1
74 #define XEN_DOMINF_hvm_guest (1U<<_XEN_DOMINF_hvm_guest)
75 /* The guest OS has shut down. */
76 #define _XEN_DOMINF_shutdown 2
77 #define XEN_DOMINF_shutdown (1U<<_XEN_DOMINF_shutdown)
78 /* Currently paused by control software. */
79 #define _XEN_DOMINF_paused 3
80 #define XEN_DOMINF_paused (1U<<_XEN_DOMINF_paused)
81 /* Currently blocked pending an event. */
82 #define _XEN_DOMINF_blocked 4
83 #define XEN_DOMINF_blocked (1U<<_XEN_DOMINF_blocked)
84 /* Domain is currently running. */
85 #define _XEN_DOMINF_running 5
86 #define XEN_DOMINF_running (1U<<_XEN_DOMINF_running)
87 /* CPU to which this domain is bound. */
88 #define XEN_DOMINF_cpumask 255
89 #define XEN_DOMINF_cpushift 8
90 /* XEN_DOMINF_shutdown guest-supplied code. */
91 #define XEN_DOMINF_shutdownmask 255
92 #define XEN_DOMINF_shutdownshift 16
93 uint32_t flags; /* XEN_DOMINF_* */
94 uint64_t tot_pages;
95 uint64_t max_pages;
96 uint64_t shared_info_frame; /* MFN of shared_info struct */
97 uint64_t cpu_time;
98 uint32_t nr_online_vcpus; /* Number of VCPUs currently online. */
99 uint32_t max_vcpu_id; /* Maximum VCPUID in use by this domain. */
100 uint32_t ssidref;
101 xen_domain_handle_t handle;
102 };
103 typedef struct xen_domctl_getdomaininfo xen_domctl_getdomaininfo_t;
104 DEFINE_XEN_GUEST_HANDLE(xen_domctl_getdomaininfo_t);
107 #define XEN_DOMCTL_getmemlist 6
108 struct xen_domctl_getmemlist {
109 /* IN variables. */
110 /* Max entries to write to output buffer. */
111 uint64_t max_pfns;
112 /* Start index in guest's page list. */
113 uint64_t start_pfn;
114 XEN_GUEST_HANDLE(xen_pfn_t) buffer;
115 /* OUT variables. */
116 uint64_t num_pfns;
117 };
118 typedef struct xen_domctl_getmemlist xen_domctl_getmemlist_t;
119 DEFINE_XEN_GUEST_HANDLE(xen_domctl_getmemlist_t);
122 #define XEN_DOMCTL_getpageframeinfo 7
124 #define XEN_DOMCTL_PFINFO_LTAB_SHIFT 28
125 #define XEN_DOMCTL_PFINFO_NOTAB (0x0<<28)
126 #define XEN_DOMCTL_PFINFO_L1TAB (0x1<<28)
127 #define XEN_DOMCTL_PFINFO_L2TAB (0x2<<28)
128 #define XEN_DOMCTL_PFINFO_L3TAB (0x3<<28)
129 #define XEN_DOMCTL_PFINFO_L4TAB (0x4<<28)
130 #define XEN_DOMCTL_PFINFO_LTABTYPE_MASK (0x7<<28)
131 #define XEN_DOMCTL_PFINFO_LPINTAB (0x1<<31)
132 #define XEN_DOMCTL_PFINFO_XTAB (0xf<<28) /* invalid page */
133 #define XEN_DOMCTL_PFINFO_LTAB_MASK (0xf<<28)
135 struct xen_domctl_getpageframeinfo {
136 /* IN variables. */
137 uint64_t gmfn; /* GMFN to query */
138 /* OUT variables. */
139 /* Is the page PINNED to a type? */
140 uint32_t type; /* see above type defs */
141 };
142 typedef struct xen_domctl_getpageframeinfo xen_domctl_getpageframeinfo_t;
143 DEFINE_XEN_GUEST_HANDLE(xen_domctl_getpageframeinfo_t);
146 #define XEN_DOMCTL_getpageframeinfo2 8
147 struct xen_domctl_getpageframeinfo2 {
148 /* IN variables. */
149 uint64_t num;
150 /* IN/OUT variables. */
151 XEN_GUEST_HANDLE(ulong) array;
152 };
153 typedef struct xen_domctl_getpageframeinfo2 xen_domctl_getpageframeinfo2_t;
154 DEFINE_XEN_GUEST_HANDLE(xen_domctl_getpageframeinfo2_t);
157 /*
158 * Control shadow pagetables operation
159 */
160 #define XEN_DOMCTL_shadow_op 10
162 /* Disable shadow mode. */
163 #define XEN_DOMCTL_SHADOW_OP_OFF 0
165 /* Enable shadow mode (mode contains ORed XEN_DOMCTL_SHADOW_ENABLE_* flags). */
166 #define XEN_DOMCTL_SHADOW_OP_ENABLE 32
168 /* Log-dirty bitmap operations. */
169 /* Return the bitmap and clean internal copy for next round. */
170 #define XEN_DOMCTL_SHADOW_OP_CLEAN 11
171 /* Return the bitmap but do not modify internal copy. */
172 #define XEN_DOMCTL_SHADOW_OP_PEEK 12
174 /* Memory allocation accessors. */
175 #define XEN_DOMCTL_SHADOW_OP_GET_ALLOCATION 30
176 #define XEN_DOMCTL_SHADOW_OP_SET_ALLOCATION 31
178 /* Legacy enable operations. */
179 /* Equiv. to ENABLE with no mode flags. */
180 #define XEN_DOMCTL_SHADOW_OP_ENABLE_TEST 1
181 /* Equiv. to ENABLE with mode flag ENABLE_LOG_DIRTY. */
182 #define XEN_DOMCTL_SHADOW_OP_ENABLE_LOGDIRTY 2
183 /* Equiv. to ENABLE with mode flags ENABLE_REFCOUNT and ENABLE_TRANSLATE. */
184 #define XEN_DOMCTL_SHADOW_OP_ENABLE_TRANSLATE 3
186 /* Mode flags for XEN_DOMCTL_SHADOW_OP_ENABLE. */
187 /*
188 * Shadow pagetables are refcounted: guest does not use explicit mmu
189 * operations nor write-protect its pagetables.
190 */
191 #define XEN_DOMCTL_SHADOW_ENABLE_REFCOUNT (1 << 1)
192 /*
193 * Log pages in a bitmap as they are dirtied.
194 * Used for live relocation to determine which pages must be re-sent.
195 */
196 #define XEN_DOMCTL_SHADOW_ENABLE_LOG_DIRTY (1 << 2)
197 /*
198 * Automatically translate GPFNs into MFNs.
199 */
200 #define XEN_DOMCTL_SHADOW_ENABLE_TRANSLATE (1 << 3)
201 /*
202 * Xen does not steal virtual address space from the guest.
203 * Requires HVM support.
204 */
205 #define XEN_DOMCTL_SHADOW_ENABLE_EXTERNAL (1 << 4)
207 struct xen_domctl_shadow_op_stats {
208 uint32_t fault_count;
209 uint32_t dirty_count;
210 };
211 typedef struct xen_domctl_shadow_op_stats xen_domctl_shadow_op_stats_t;
212 DEFINE_XEN_GUEST_HANDLE(xen_domctl_shadow_op_stats_t);
214 struct xen_domctl_shadow_op {
215 /* IN variables. */
216 uint32_t op; /* XEN_DOMCTL_SHADOW_OP_* */
218 /* OP_ENABLE */
219 uint32_t mode; /* XEN_DOMCTL_SHADOW_ENABLE_* */
221 /* OP_GET_ALLOCATION / OP_SET_ALLOCATION */
222 uint32_t mb; /* Shadow memory allocation in MB */
224 /* OP_PEEK / OP_CLEAN */
225 XEN_GUEST_HANDLE(ulong) dirty_bitmap;
226 uint64_t pages; /* Size of buffer. Updated with actual size. */
227 struct xen_domctl_shadow_op_stats stats;
228 };
229 typedef struct xen_domctl_shadow_op xen_domctl_shadow_op_t;
230 DEFINE_XEN_GUEST_HANDLE(xen_domctl_shadow_op_t);
233 #define XEN_DOMCTL_max_mem 11
234 struct xen_domctl_max_mem {
235 /* IN variables. */
236 uint64_t max_memkb;
237 };
238 typedef struct xen_domctl_max_mem xen_domctl_max_mem_t;
239 DEFINE_XEN_GUEST_HANDLE(xen_domctl_max_mem_t);
242 #define XEN_DOMCTL_setvcpucontext 12
243 #define XEN_DOMCTL_getvcpucontext 13
244 struct xen_domctl_vcpucontext {
245 uint32_t vcpu; /* IN */
246 XEN_GUEST_HANDLE(vcpu_guest_context_t) ctxt; /* IN/OUT */
247 };
248 typedef struct xen_domctl_vcpucontext xen_domctl_vcpucontext_t;
249 DEFINE_XEN_GUEST_HANDLE(xen_domctl_vcpucontext_t);
252 #define XEN_DOMCTL_getvcpuinfo 14
253 struct xen_domctl_getvcpuinfo {
254 /* IN variables. */
255 uint32_t vcpu;
256 /* OUT variables. */
257 uint8_t online; /* currently online (not hotplugged)? */
258 uint8_t blocked; /* blocked waiting for an event? */
259 uint8_t running; /* currently scheduled on its CPU? */
260 uint64_t cpu_time; /* total cpu time consumed (ns) */
261 uint32_t cpu; /* current mapping */
262 };
263 typedef struct xen_domctl_getvcpuinfo xen_domctl_getvcpuinfo_t;
264 DEFINE_XEN_GUEST_HANDLE(xen_domctl_getvcpuinfo_t);
267 /* Get/set which physical cpus a vcpu can execute on. */
268 #define XEN_DOMCTL_setvcpuaffinity 9
269 #define XEN_DOMCTL_getvcpuaffinity 25
270 struct xen_domctl_vcpuaffinity {
271 uint32_t vcpu; /* IN */
272 struct xenctl_cpumap cpumap; /* IN/OUT */
273 };
274 typedef struct xen_domctl_vcpuaffinity xen_domctl_vcpuaffinity_t;
275 DEFINE_XEN_GUEST_HANDLE(xen_domctl_vcpuaffinity_t);
278 #define XEN_DOMCTL_max_vcpus 15
279 struct xen_domctl_max_vcpus {
280 uint32_t max; /* maximum number of vcpus */
281 };
282 typedef struct xen_domctl_max_vcpus xen_domctl_max_vcpus_t;
283 DEFINE_XEN_GUEST_HANDLE(xen_domctl_max_vcpus_t);
286 #define XEN_DOMCTL_scheduler_op 16
287 /* Scheduler types. */
288 #define XEN_SCHEDULER_SEDF 4
289 #define XEN_SCHEDULER_CREDIT 5
290 /* Set or get info? */
291 #define XEN_DOMCTL_SCHEDOP_putinfo 0
292 #define XEN_DOMCTL_SCHEDOP_getinfo 1
293 struct xen_domctl_scheduler_op {
294 uint32_t sched_id; /* XEN_SCHEDULER_* */
295 uint32_t cmd; /* XEN_DOMCTL_SCHEDOP_* */
296 union {
297 struct xen_domctl_sched_sedf {
298 uint64_t period;
299 uint64_t slice;
300 uint64_t latency;
301 uint32_t extratime;
302 uint32_t weight;
303 } sedf;
304 struct xen_domctl_sched_credit {
305 uint16_t weight;
306 uint16_t cap;
307 } credit;
308 } u;
309 };
310 typedef struct xen_domctl_scheduler_op xen_domctl_scheduler_op_t;
311 DEFINE_XEN_GUEST_HANDLE(xen_domctl_scheduler_op_t);
314 #define XEN_DOMCTL_setdomainhandle 17
315 struct xen_domctl_setdomainhandle {
316 xen_domain_handle_t handle;
317 };
318 typedef struct xen_domctl_setdomainhandle xen_domctl_setdomainhandle_t;
319 DEFINE_XEN_GUEST_HANDLE(xen_domctl_setdomainhandle_t);
322 #define XEN_DOMCTL_setdebugging 18
323 struct xen_domctl_setdebugging {
324 uint8_t enable;
325 };
326 typedef struct xen_domctl_setdebugging xen_domctl_setdebugging_t;
327 DEFINE_XEN_GUEST_HANDLE(xen_domctl_setdebugging_t);
330 #define XEN_DOMCTL_irq_permission 19
331 struct xen_domctl_irq_permission {
332 uint8_t pirq;
333 uint8_t allow_access; /* flag to specify enable/disable of IRQ access */
334 };
335 typedef struct xen_domctl_irq_permission xen_domctl_irq_permission_t;
336 DEFINE_XEN_GUEST_HANDLE(xen_domctl_irq_permission_t);
339 #define XEN_DOMCTL_iomem_permission 20
340 struct xen_domctl_iomem_permission {
341 uint64_t first_mfn; /* first page (physical page number) in range */
342 uint64_t nr_mfns; /* number of pages in range (>0) */
343 uint8_t allow_access; /* allow (!0) or deny (0) access to range? */
344 };
345 typedef struct xen_domctl_iomem_permission xen_domctl_iomem_permission_t;
346 DEFINE_XEN_GUEST_HANDLE(xen_domctl_iomem_permission_t);
349 #define XEN_DOMCTL_ioport_permission 21
350 struct xen_domctl_ioport_permission {
351 uint32_t first_port; /* first port int range */
352 uint32_t nr_ports; /* size of port range */
353 uint8_t allow_access; /* allow or deny access to range? */
354 };
355 typedef struct xen_domctl_ioport_permission xen_domctl_ioport_permission_t;
356 DEFINE_XEN_GUEST_HANDLE(xen_domctl_ioport_permission_t);
358 #define XEN_DOMCTL_hypercall_init 22
359 struct xen_domctl_hypercall_init {
360 uint64_t gmfn; /* GMFN to be initialised */
361 };
362 typedef struct xen_domctl_hypercall_init xen_domctl_hypercall_init_t;
363 DEFINE_XEN_GUEST_HANDLE(xen_domctl_hypercall_init_t);
365 #define XEN_DOMCTL_arch_setup 23
366 #define _XEN_DOMAINSETUP_hvm_guest 0
367 #define XEN_DOMAINSETUP_hvm_guest (1UL<<_XEN_DOMAINSETUP_hvm_guest)
368 #define _XEN_DOMAINSETUP_query 1 /* Get parameters (for save) */
369 #define XEN_DOMAINSETUP_query (1UL<<_XEN_DOMAINSETUP_query)
370 typedef struct xen_domctl_arch_setup {
371 uint64_t flags; /* XEN_DOMAINSETUP_* */
372 #ifdef __ia64__
373 uint64_t bp; /* mpaddr of boot param area */
374 uint64_t maxmem; /* Highest memory address for MDT. */
375 uint64_t xsi_va; /* Xen shared_info area virtual address. */
376 uint32_t hypercall_imm; /* Break imm for Xen hypercalls. */
377 #endif
378 } xen_domctl_arch_setup_t;
379 DEFINE_XEN_GUEST_HANDLE(xen_domctl_arch_setup_t);
381 #define XEN_DOMCTL_settimeoffset 24
382 struct xen_domctl_settimeoffset {
383 int32_t time_offset_seconds; /* applied to domain wallclock time */
384 };
385 typedef struct xen_domctl_settimeoffset xen_domctl_settimeoffset_t;
386 DEFINE_XEN_GUEST_HANDLE(xen_domctl_settimeoffset_t);
388 struct xen_domctl {
389 uint32_t cmd;
390 uint32_t interface_version; /* XEN_DOMCTL_INTERFACE_VERSION */
391 domid_t domain;
392 union {
393 struct xen_domctl_createdomain createdomain;
394 struct xen_domctl_getdomaininfo getdomaininfo;
395 struct xen_domctl_getmemlist getmemlist;
396 struct xen_domctl_getpageframeinfo getpageframeinfo;
397 struct xen_domctl_getpageframeinfo2 getpageframeinfo2;
398 struct xen_domctl_vcpuaffinity vcpuaffinity;
399 struct xen_domctl_shadow_op shadow_op;
400 struct xen_domctl_max_mem max_mem;
401 struct xen_domctl_vcpucontext vcpucontext;
402 struct xen_domctl_getvcpuinfo getvcpuinfo;
403 struct xen_domctl_max_vcpus max_vcpus;
404 struct xen_domctl_scheduler_op scheduler_op;
405 struct xen_domctl_setdomainhandle setdomainhandle;
406 struct xen_domctl_setdebugging setdebugging;
407 struct xen_domctl_irq_permission irq_permission;
408 struct xen_domctl_iomem_permission iomem_permission;
409 struct xen_domctl_ioport_permission ioport_permission;
410 struct xen_domctl_hypercall_init hypercall_init;
411 struct xen_domctl_arch_setup arch_setup;
412 struct xen_domctl_settimeoffset settimeoffset;
413 uint8_t pad[128];
414 } u;
415 };
416 typedef struct xen_domctl xen_domctl_t;
417 DEFINE_XEN_GUEST_HANDLE(xen_domctl_t);
419 #endif /* __XEN_PUBLIC_DOMCTL_H__ */
421 /*
422 * Local variables:
423 * mode: C
424 * c-set-style: "BSD"
425 * c-basic-offset: 4
426 * tab-width: 4
427 * indent-tabs-mode: nil
428 * End:
429 */