ia64/xen-unstable

view xen/include/public/domctl.h @ 13608:30af6cfdb05c

Make domctl/sysctl interfaces 32-/64-bit invariant.
This kills off a fair amount of unpleasant CONFIG_COMPAT shimming and
avoids needing to keep the compat paths in sync as these interfaces
continue to develop.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kfraser@localhost.localdomain
date Wed Jan 24 16:33:19 2007 +0000 (2007-01-24)
parents dcb145f858e3
children e0291e3ed603
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 0x00000005
39 struct xenctl_cpumap {
40 XEN_GUEST_HANDLE_64(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
64 #define XEN_DOMCTL_resumedomain 27
66 #define XEN_DOMCTL_getdomaininfo 5
67 struct xen_domctl_getdomaininfo {
68 /* OUT variables. */
69 domid_t domain; /* Also echoed in domctl.domain */
70 /* Domain is scheduled to die. */
71 #define _XEN_DOMINF_dying 0
72 #define XEN_DOMINF_dying (1U<<_XEN_DOMINF_dying)
73 /* Domain is an HVM guest (as opposed to a PV guest). */
74 #define _XEN_DOMINF_hvm_guest 1
75 #define XEN_DOMINF_hvm_guest (1U<<_XEN_DOMINF_hvm_guest)
76 /* The guest OS has shut down. */
77 #define _XEN_DOMINF_shutdown 2
78 #define XEN_DOMINF_shutdown (1U<<_XEN_DOMINF_shutdown)
79 /* Currently paused by control software. */
80 #define _XEN_DOMINF_paused 3
81 #define XEN_DOMINF_paused (1U<<_XEN_DOMINF_paused)
82 /* Currently blocked pending an event. */
83 #define _XEN_DOMINF_blocked 4
84 #define XEN_DOMINF_blocked (1U<<_XEN_DOMINF_blocked)
85 /* Domain is currently running. */
86 #define _XEN_DOMINF_running 5
87 #define XEN_DOMINF_running (1U<<_XEN_DOMINF_running)
88 /* CPU to which this domain is bound. */
89 #define XEN_DOMINF_cpumask 255
90 #define XEN_DOMINF_cpushift 8
91 /* XEN_DOMINF_shutdown guest-supplied code. */
92 #define XEN_DOMINF_shutdownmask 255
93 #define XEN_DOMINF_shutdownshift 16
94 uint32_t flags; /* XEN_DOMINF_* */
95 uint64_aligned_t tot_pages;
96 uint64_aligned_t max_pages;
97 uint64_aligned_t shared_info_frame; /* GMFN of shared_info struct */
98 uint64_aligned_t cpu_time;
99 uint32_t nr_online_vcpus; /* Number of VCPUs currently online. */
100 uint32_t max_vcpu_id; /* Maximum VCPUID in use by this domain. */
101 uint32_t ssidref;
102 xen_domain_handle_t handle;
103 };
104 typedef struct xen_domctl_getdomaininfo xen_domctl_getdomaininfo_t;
105 DEFINE_XEN_GUEST_HANDLE(xen_domctl_getdomaininfo_t);
108 #define XEN_DOMCTL_getmemlist 6
109 struct xen_domctl_getmemlist {
110 /* IN variables. */
111 /* Max entries to write to output buffer. */
112 uint64_aligned_t max_pfns;
113 /* Start index in guest's page list. */
114 uint64_aligned_t start_pfn;
115 XEN_GUEST_HANDLE_64(uint64_t) buffer;
116 /* OUT variables. */
117 uint64_aligned_t num_pfns;
118 };
119 typedef struct xen_domctl_getmemlist xen_domctl_getmemlist_t;
120 DEFINE_XEN_GUEST_HANDLE(xen_domctl_getmemlist_t);
123 #define XEN_DOMCTL_getpageframeinfo 7
125 #define XEN_DOMCTL_PFINFO_LTAB_SHIFT 28
126 #define XEN_DOMCTL_PFINFO_NOTAB (0x0<<28)
127 #define XEN_DOMCTL_PFINFO_L1TAB (0x1<<28)
128 #define XEN_DOMCTL_PFINFO_L2TAB (0x2<<28)
129 #define XEN_DOMCTL_PFINFO_L3TAB (0x3<<28)
130 #define XEN_DOMCTL_PFINFO_L4TAB (0x4<<28)
131 #define XEN_DOMCTL_PFINFO_LTABTYPE_MASK (0x7<<28)
132 #define XEN_DOMCTL_PFINFO_LPINTAB (0x1<<31)
133 #define XEN_DOMCTL_PFINFO_XTAB (0xf<<28) /* invalid page */
134 #define XEN_DOMCTL_PFINFO_LTAB_MASK (0xf<<28)
136 struct xen_domctl_getpageframeinfo {
137 /* IN variables. */
138 uint64_aligned_t gmfn; /* GMFN to query */
139 /* OUT variables. */
140 /* Is the page PINNED to a type? */
141 uint32_t type; /* see above type defs */
142 };
143 typedef struct xen_domctl_getpageframeinfo xen_domctl_getpageframeinfo_t;
144 DEFINE_XEN_GUEST_HANDLE(xen_domctl_getpageframeinfo_t);
147 #define XEN_DOMCTL_getpageframeinfo2 8
148 struct xen_domctl_getpageframeinfo2 {
149 /* IN variables. */
150 uint64_aligned_t num;
151 /* IN/OUT variables. */
152 XEN_GUEST_HANDLE_64(uint32_t) array;
153 };
154 typedef struct xen_domctl_getpageframeinfo2 xen_domctl_getpageframeinfo2_t;
155 DEFINE_XEN_GUEST_HANDLE(xen_domctl_getpageframeinfo2_t);
158 /*
159 * Control shadow pagetables operation
160 */
161 #define XEN_DOMCTL_shadow_op 10
163 /* Disable shadow mode. */
164 #define XEN_DOMCTL_SHADOW_OP_OFF 0
166 /* Enable shadow mode (mode contains ORed XEN_DOMCTL_SHADOW_ENABLE_* flags). */
167 #define XEN_DOMCTL_SHADOW_OP_ENABLE 32
169 /* Log-dirty bitmap operations. */
170 /* Return the bitmap and clean internal copy for next round. */
171 #define XEN_DOMCTL_SHADOW_OP_CLEAN 11
172 /* Return the bitmap but do not modify internal copy. */
173 #define XEN_DOMCTL_SHADOW_OP_PEEK 12
175 /* Memory allocation accessors. */
176 #define XEN_DOMCTL_SHADOW_OP_GET_ALLOCATION 30
177 #define XEN_DOMCTL_SHADOW_OP_SET_ALLOCATION 31
179 /* Legacy enable operations. */
180 /* Equiv. to ENABLE with no mode flags. */
181 #define XEN_DOMCTL_SHADOW_OP_ENABLE_TEST 1
182 /* Equiv. to ENABLE with mode flag ENABLE_LOG_DIRTY. */
183 #define XEN_DOMCTL_SHADOW_OP_ENABLE_LOGDIRTY 2
184 /* Equiv. to ENABLE with mode flags ENABLE_REFCOUNT and ENABLE_TRANSLATE. */
185 #define XEN_DOMCTL_SHADOW_OP_ENABLE_TRANSLATE 3
187 /* Mode flags for XEN_DOMCTL_SHADOW_OP_ENABLE. */
188 /*
189 * Shadow pagetables are refcounted: guest does not use explicit mmu
190 * operations nor write-protect its pagetables.
191 */
192 #define XEN_DOMCTL_SHADOW_ENABLE_REFCOUNT (1 << 1)
193 /*
194 * Log pages in a bitmap as they are dirtied.
195 * Used for live relocation to determine which pages must be re-sent.
196 */
197 #define XEN_DOMCTL_SHADOW_ENABLE_LOG_DIRTY (1 << 2)
198 /*
199 * Automatically translate GPFNs into MFNs.
200 */
201 #define XEN_DOMCTL_SHADOW_ENABLE_TRANSLATE (1 << 3)
202 /*
203 * Xen does not steal virtual address space from the guest.
204 * Requires HVM support.
205 */
206 #define XEN_DOMCTL_SHADOW_ENABLE_EXTERNAL (1 << 4)
208 struct xen_domctl_shadow_op_stats {
209 uint32_t fault_count;
210 uint32_t dirty_count;
211 };
212 typedef struct xen_domctl_shadow_op_stats xen_domctl_shadow_op_stats_t;
213 DEFINE_XEN_GUEST_HANDLE(xen_domctl_shadow_op_stats_t);
215 struct xen_domctl_shadow_op {
216 /* IN variables. */
217 uint32_t op; /* XEN_DOMCTL_SHADOW_OP_* */
219 /* OP_ENABLE */
220 uint32_t mode; /* XEN_DOMCTL_SHADOW_ENABLE_* */
222 /* OP_GET_ALLOCATION / OP_SET_ALLOCATION */
223 uint32_t mb; /* Shadow memory allocation in MB */
225 /* OP_PEEK / OP_CLEAN */
226 XEN_GUEST_HANDLE_64(uint8_t) dirty_bitmap;
227 uint64_aligned_t pages; /* Size of buffer. Updated with actual size. */
228 struct xen_domctl_shadow_op_stats stats;
229 };
230 typedef struct xen_domctl_shadow_op xen_domctl_shadow_op_t;
231 DEFINE_XEN_GUEST_HANDLE(xen_domctl_shadow_op_t);
234 #define XEN_DOMCTL_max_mem 11
235 struct xen_domctl_max_mem {
236 /* IN variables. */
237 uint64_aligned_t max_memkb;
238 };
239 typedef struct xen_domctl_max_mem xen_domctl_max_mem_t;
240 DEFINE_XEN_GUEST_HANDLE(xen_domctl_max_mem_t);
243 #define XEN_DOMCTL_setvcpucontext 12
244 #define XEN_DOMCTL_getvcpucontext 13
245 struct xen_domctl_vcpucontext {
246 uint32_t vcpu; /* IN */
247 XEN_GUEST_HANDLE_64(vcpu_guest_context_t) ctxt; /* IN/OUT */
248 };
249 typedef struct xen_domctl_vcpucontext xen_domctl_vcpucontext_t;
250 DEFINE_XEN_GUEST_HANDLE(xen_domctl_vcpucontext_t);
253 #define XEN_DOMCTL_getvcpuinfo 14
254 struct xen_domctl_getvcpuinfo {
255 /* IN variables. */
256 uint32_t vcpu;
257 /* OUT variables. */
258 uint8_t online; /* currently online (not hotplugged)? */
259 uint8_t blocked; /* blocked waiting for an event? */
260 uint8_t running; /* currently scheduled on its CPU? */
261 uint64_aligned_t cpu_time; /* total cpu time consumed (ns) */
262 uint32_t cpu; /* current mapping */
263 };
264 typedef struct xen_domctl_getvcpuinfo xen_domctl_getvcpuinfo_t;
265 DEFINE_XEN_GUEST_HANDLE(xen_domctl_getvcpuinfo_t);
268 /* Get/set which physical cpus a vcpu can execute on. */
269 #define XEN_DOMCTL_setvcpuaffinity 9
270 #define XEN_DOMCTL_getvcpuaffinity 25
271 struct xen_domctl_vcpuaffinity {
272 uint32_t vcpu; /* IN */
273 struct xenctl_cpumap cpumap; /* IN/OUT */
274 };
275 typedef struct xen_domctl_vcpuaffinity xen_domctl_vcpuaffinity_t;
276 DEFINE_XEN_GUEST_HANDLE(xen_domctl_vcpuaffinity_t);
279 #define XEN_DOMCTL_max_vcpus 15
280 struct xen_domctl_max_vcpus {
281 uint32_t max; /* maximum number of vcpus */
282 };
283 typedef struct xen_domctl_max_vcpus xen_domctl_max_vcpus_t;
284 DEFINE_XEN_GUEST_HANDLE(xen_domctl_max_vcpus_t);
287 #define XEN_DOMCTL_scheduler_op 16
288 /* Scheduler types. */
289 #define XEN_SCHEDULER_SEDF 4
290 #define XEN_SCHEDULER_CREDIT 5
291 /* Set or get info? */
292 #define XEN_DOMCTL_SCHEDOP_putinfo 0
293 #define XEN_DOMCTL_SCHEDOP_getinfo 1
294 struct xen_domctl_scheduler_op {
295 uint32_t sched_id; /* XEN_SCHEDULER_* */
296 uint32_t cmd; /* XEN_DOMCTL_SCHEDOP_* */
297 union {
298 struct xen_domctl_sched_sedf {
299 uint64_aligned_t period;
300 uint64_aligned_t slice;
301 uint64_aligned_t latency;
302 uint32_t extratime;
303 uint32_t weight;
304 } sedf;
305 struct xen_domctl_sched_credit {
306 uint16_t weight;
307 uint16_t cap;
308 } credit;
309 } u;
310 };
311 typedef struct xen_domctl_scheduler_op xen_domctl_scheduler_op_t;
312 DEFINE_XEN_GUEST_HANDLE(xen_domctl_scheduler_op_t);
315 #define XEN_DOMCTL_setdomainhandle 17
316 struct xen_domctl_setdomainhandle {
317 xen_domain_handle_t handle;
318 };
319 typedef struct xen_domctl_setdomainhandle xen_domctl_setdomainhandle_t;
320 DEFINE_XEN_GUEST_HANDLE(xen_domctl_setdomainhandle_t);
323 #define XEN_DOMCTL_setdebugging 18
324 struct xen_domctl_setdebugging {
325 uint8_t enable;
326 };
327 typedef struct xen_domctl_setdebugging xen_domctl_setdebugging_t;
328 DEFINE_XEN_GUEST_HANDLE(xen_domctl_setdebugging_t);
331 #define XEN_DOMCTL_irq_permission 19
332 struct xen_domctl_irq_permission {
333 uint8_t pirq;
334 uint8_t allow_access; /* flag to specify enable/disable of IRQ access */
335 };
336 typedef struct xen_domctl_irq_permission xen_domctl_irq_permission_t;
337 DEFINE_XEN_GUEST_HANDLE(xen_domctl_irq_permission_t);
340 #define XEN_DOMCTL_iomem_permission 20
341 struct xen_domctl_iomem_permission {
342 uint64_aligned_t first_mfn;/* first page (physical page number) in range */
343 uint64_aligned_t nr_mfns; /* number of pages in range (>0) */
344 uint8_t allow_access; /* allow (!0) or deny (0) access to range? */
345 };
346 typedef struct xen_domctl_iomem_permission xen_domctl_iomem_permission_t;
347 DEFINE_XEN_GUEST_HANDLE(xen_domctl_iomem_permission_t);
350 #define XEN_DOMCTL_ioport_permission 21
351 struct xen_domctl_ioport_permission {
352 uint32_t first_port; /* first port int range */
353 uint32_t nr_ports; /* size of port range */
354 uint8_t allow_access; /* allow or deny access to range? */
355 };
356 typedef struct xen_domctl_ioport_permission xen_domctl_ioport_permission_t;
357 DEFINE_XEN_GUEST_HANDLE(xen_domctl_ioport_permission_t);
359 #define XEN_DOMCTL_hypercall_init 22
360 struct xen_domctl_hypercall_init {
361 uint64_aligned_t gmfn; /* GMFN to be initialised */
362 };
363 typedef struct xen_domctl_hypercall_init xen_domctl_hypercall_init_t;
364 DEFINE_XEN_GUEST_HANDLE(xen_domctl_hypercall_init_t);
366 #define XEN_DOMCTL_arch_setup 23
367 #define _XEN_DOMAINSETUP_hvm_guest 0
368 #define XEN_DOMAINSETUP_hvm_guest (1UL<<_XEN_DOMAINSETUP_hvm_guest)
369 #define _XEN_DOMAINSETUP_query 1 /* Get parameters (for save) */
370 #define XEN_DOMAINSETUP_query (1UL<<_XEN_DOMAINSETUP_query)
371 typedef struct xen_domctl_arch_setup {
372 uint64_aligned_t flags; /* XEN_DOMAINSETUP_* */
373 #ifdef __ia64__
374 uint64_aligned_t bp; /* mpaddr of boot param area */
375 uint64_aligned_t maxmem; /* Highest memory address for MDT. */
376 uint64_aligned_t xsi_va; /* Xen shared_info area virtual address. */
377 uint32_t hypercall_imm; /* Break imm for Xen hypercalls. */
378 #endif
379 } xen_domctl_arch_setup_t;
380 DEFINE_XEN_GUEST_HANDLE(xen_domctl_arch_setup_t);
382 #define XEN_DOMCTL_settimeoffset 24
383 struct xen_domctl_settimeoffset {
384 int32_t time_offset_seconds; /* applied to domain wallclock time */
385 };
386 typedef struct xen_domctl_settimeoffset xen_domctl_settimeoffset_t;
387 DEFINE_XEN_GUEST_HANDLE(xen_domctl_settimeoffset_t);
389 #define HVM_CTXT_SIZE 6144
390 typedef struct hvm_domain_context {
391 uint32_t cur;
392 uint32_t size;
393 uint8_t data[HVM_CTXT_SIZE];
394 } hvm_domain_context_t;
395 DEFINE_XEN_GUEST_HANDLE(hvm_domain_context_t);
397 #define XEN_DOMCTL_gethvmcontext 33
398 #define XEN_DOMCTL_sethvmcontext 34
399 typedef struct xen_domctl_hvmcontext {
400 XEN_GUEST_HANDLE_64(hvm_domain_context_t) ctxt; /* IN/OUT */
401 } xen_domctl_hvmcontext_t;
402 DEFINE_XEN_GUEST_HANDLE(xen_domctl_hvmcontext_t);
404 #define XEN_DOMCTL_real_mode_area 26
405 struct xen_domctl_real_mode_area {
406 uint32_t log; /* log2 of Real Mode Area size */
407 };
408 typedef struct xen_domctl_real_mode_area xen_domctl_real_mode_area_t;
409 DEFINE_XEN_GUEST_HANDLE(xen_domctl_real_mode_area_t);
411 struct xen_domctl {
412 uint32_t cmd;
413 uint32_t interface_version; /* XEN_DOMCTL_INTERFACE_VERSION */
414 domid_t domain;
415 union {
416 struct xen_domctl_createdomain createdomain;
417 struct xen_domctl_getdomaininfo getdomaininfo;
418 struct xen_domctl_getmemlist getmemlist;
419 struct xen_domctl_getpageframeinfo getpageframeinfo;
420 struct xen_domctl_getpageframeinfo2 getpageframeinfo2;
421 struct xen_domctl_vcpuaffinity vcpuaffinity;
422 struct xen_domctl_shadow_op shadow_op;
423 struct xen_domctl_max_mem max_mem;
424 struct xen_domctl_vcpucontext vcpucontext;
425 struct xen_domctl_getvcpuinfo getvcpuinfo;
426 struct xen_domctl_max_vcpus max_vcpus;
427 struct xen_domctl_scheduler_op scheduler_op;
428 struct xen_domctl_setdomainhandle setdomainhandle;
429 struct xen_domctl_setdebugging setdebugging;
430 struct xen_domctl_irq_permission irq_permission;
431 struct xen_domctl_iomem_permission iomem_permission;
432 struct xen_domctl_ioport_permission ioport_permission;
433 struct xen_domctl_hypercall_init hypercall_init;
434 struct xen_domctl_arch_setup arch_setup;
435 struct xen_domctl_settimeoffset settimeoffset;
436 struct xen_domctl_real_mode_area real_mode_area;
437 struct xen_domctl_hvmcontext hvmcontext;
438 uint8_t pad[128];
439 } u;
440 };
441 typedef struct xen_domctl xen_domctl_t;
442 DEFINE_XEN_GUEST_HANDLE(xen_domctl_t);
444 #endif /* __XEN_PUBLIC_DOMCTL_H__ */
446 /*
447 * Local variables:
448 * mode: C
449 * c-set-style: "BSD"
450 * c-basic-offset: 4
451 * tab-width: 4
452 * indent-tabs-mode: nil
453 * End:
454 */