direct-io.hg

view xen/include/public/domctl.h @ 15478:05331a29f3cb

Export debugger attached state to xc API.
Signed-off-by: Tristan Gingold <tgingold@free.fr>
author kfraser@localhost.localdomain
date Fri Jul 06 14:42:55 2007 +0100 (2007-07-06)
parents 550a795a3dbd
children d7e3224b661a
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 /* Being debugged. */
89 #define _XEN_DOMINF_debugged 6
90 #define XEN_DOMINF_debugged (1U<<_XEN_DOMINF_debugged)
91 /* CPU to which this domain is bound. */
92 #define XEN_DOMINF_cpumask 255
93 #define XEN_DOMINF_cpushift 8
94 /* XEN_DOMINF_shutdown guest-supplied code. */
95 #define XEN_DOMINF_shutdownmask 255
96 #define XEN_DOMINF_shutdownshift 16
97 uint32_t flags; /* XEN_DOMINF_* */
98 uint64_aligned_t tot_pages;
99 uint64_aligned_t max_pages;
100 uint64_aligned_t shared_info_frame; /* GMFN of shared_info struct */
101 uint64_aligned_t cpu_time;
102 uint32_t nr_online_vcpus; /* Number of VCPUs currently online. */
103 uint32_t max_vcpu_id; /* Maximum VCPUID in use by this domain. */
104 uint32_t ssidref;
105 xen_domain_handle_t handle;
106 };
107 typedef struct xen_domctl_getdomaininfo xen_domctl_getdomaininfo_t;
108 DEFINE_XEN_GUEST_HANDLE(xen_domctl_getdomaininfo_t);
111 #define XEN_DOMCTL_getmemlist 6
112 struct xen_domctl_getmemlist {
113 /* IN variables. */
114 /* Max entries to write to output buffer. */
115 uint64_aligned_t max_pfns;
116 /* Start index in guest's page list. */
117 uint64_aligned_t start_pfn;
118 XEN_GUEST_HANDLE_64(uint64_t) buffer;
119 /* OUT variables. */
120 uint64_aligned_t num_pfns;
121 };
122 typedef struct xen_domctl_getmemlist xen_domctl_getmemlist_t;
123 DEFINE_XEN_GUEST_HANDLE(xen_domctl_getmemlist_t);
126 #define XEN_DOMCTL_getpageframeinfo 7
128 #define XEN_DOMCTL_PFINFO_LTAB_SHIFT 28
129 #define XEN_DOMCTL_PFINFO_NOTAB (0x0U<<28)
130 #define XEN_DOMCTL_PFINFO_L1TAB (0x1U<<28)
131 #define XEN_DOMCTL_PFINFO_L2TAB (0x2U<<28)
132 #define XEN_DOMCTL_PFINFO_L3TAB (0x3U<<28)
133 #define XEN_DOMCTL_PFINFO_L4TAB (0x4U<<28)
134 #define XEN_DOMCTL_PFINFO_LTABTYPE_MASK (0x7U<<28)
135 #define XEN_DOMCTL_PFINFO_LPINTAB (0x1U<<31)
136 #define XEN_DOMCTL_PFINFO_XTAB (0xfU<<28) /* invalid page */
137 #define XEN_DOMCTL_PFINFO_LTAB_MASK (0xfU<<28)
139 struct xen_domctl_getpageframeinfo {
140 /* IN variables. */
141 uint64_aligned_t gmfn; /* GMFN to query */
142 /* OUT variables. */
143 /* Is the page PINNED to a type? */
144 uint32_t type; /* see above type defs */
145 };
146 typedef struct xen_domctl_getpageframeinfo xen_domctl_getpageframeinfo_t;
147 DEFINE_XEN_GUEST_HANDLE(xen_domctl_getpageframeinfo_t);
150 #define XEN_DOMCTL_getpageframeinfo2 8
151 struct xen_domctl_getpageframeinfo2 {
152 /* IN variables. */
153 uint64_aligned_t num;
154 /* IN/OUT variables. */
155 XEN_GUEST_HANDLE_64(uint32_t) array;
156 };
157 typedef struct xen_domctl_getpageframeinfo2 xen_domctl_getpageframeinfo2_t;
158 DEFINE_XEN_GUEST_HANDLE(xen_domctl_getpageframeinfo2_t);
161 /*
162 * Control shadow pagetables operation
163 */
164 #define XEN_DOMCTL_shadow_op 10
166 /* Disable shadow mode. */
167 #define XEN_DOMCTL_SHADOW_OP_OFF 0
169 /* Enable shadow mode (mode contains ORed XEN_DOMCTL_SHADOW_ENABLE_* flags). */
170 #define XEN_DOMCTL_SHADOW_OP_ENABLE 32
172 /* Log-dirty bitmap operations. */
173 /* Return the bitmap and clean internal copy for next round. */
174 #define XEN_DOMCTL_SHADOW_OP_CLEAN 11
175 /* Return the bitmap but do not modify internal copy. */
176 #define XEN_DOMCTL_SHADOW_OP_PEEK 12
178 /* Memory allocation accessors. */
179 #define XEN_DOMCTL_SHADOW_OP_GET_ALLOCATION 30
180 #define XEN_DOMCTL_SHADOW_OP_SET_ALLOCATION 31
182 /* Legacy enable operations. */
183 /* Equiv. to ENABLE with no mode flags. */
184 #define XEN_DOMCTL_SHADOW_OP_ENABLE_TEST 1
185 /* Equiv. to ENABLE with mode flag ENABLE_LOG_DIRTY. */
186 #define XEN_DOMCTL_SHADOW_OP_ENABLE_LOGDIRTY 2
187 /* Equiv. to ENABLE with mode flags ENABLE_REFCOUNT and ENABLE_TRANSLATE. */
188 #define XEN_DOMCTL_SHADOW_OP_ENABLE_TRANSLATE 3
190 /* Mode flags for XEN_DOMCTL_SHADOW_OP_ENABLE. */
191 /*
192 * Shadow pagetables are refcounted: guest does not use explicit mmu
193 * operations nor write-protect its pagetables.
194 */
195 #define XEN_DOMCTL_SHADOW_ENABLE_REFCOUNT (1 << 1)
196 /*
197 * Log pages in a bitmap as they are dirtied.
198 * Used for live relocation to determine which pages must be re-sent.
199 */
200 #define XEN_DOMCTL_SHADOW_ENABLE_LOG_DIRTY (1 << 2)
201 /*
202 * Automatically translate GPFNs into MFNs.
203 */
204 #define XEN_DOMCTL_SHADOW_ENABLE_TRANSLATE (1 << 3)
205 /*
206 * Xen does not steal virtual address space from the guest.
207 * Requires HVM support.
208 */
209 #define XEN_DOMCTL_SHADOW_ENABLE_EXTERNAL (1 << 4)
211 struct xen_domctl_shadow_op_stats {
212 uint32_t fault_count;
213 uint32_t dirty_count;
214 };
215 typedef struct xen_domctl_shadow_op_stats xen_domctl_shadow_op_stats_t;
216 DEFINE_XEN_GUEST_HANDLE(xen_domctl_shadow_op_stats_t);
218 struct xen_domctl_shadow_op {
219 /* IN variables. */
220 uint32_t op; /* XEN_DOMCTL_SHADOW_OP_* */
222 /* OP_ENABLE */
223 uint32_t mode; /* XEN_DOMCTL_SHADOW_ENABLE_* */
225 /* OP_GET_ALLOCATION / OP_SET_ALLOCATION */
226 uint32_t mb; /* Shadow memory allocation in MB */
228 /* OP_PEEK / OP_CLEAN */
229 XEN_GUEST_HANDLE_64(uint8_t) dirty_bitmap;
230 uint64_aligned_t pages; /* Size of buffer. Updated with actual size. */
231 struct xen_domctl_shadow_op_stats stats;
232 };
233 typedef struct xen_domctl_shadow_op xen_domctl_shadow_op_t;
234 DEFINE_XEN_GUEST_HANDLE(xen_domctl_shadow_op_t);
237 #define XEN_DOMCTL_max_mem 11
238 struct xen_domctl_max_mem {
239 /* IN variables. */
240 uint64_aligned_t max_memkb;
241 };
242 typedef struct xen_domctl_max_mem xen_domctl_max_mem_t;
243 DEFINE_XEN_GUEST_HANDLE(xen_domctl_max_mem_t);
246 #define XEN_DOMCTL_setvcpucontext 12
247 #define XEN_DOMCTL_getvcpucontext 13
248 struct xen_domctl_vcpucontext {
249 uint32_t vcpu; /* IN */
250 XEN_GUEST_HANDLE_64(vcpu_guest_context_t) ctxt; /* IN/OUT */
251 };
252 typedef struct xen_domctl_vcpucontext xen_domctl_vcpucontext_t;
253 DEFINE_XEN_GUEST_HANDLE(xen_domctl_vcpucontext_t);
256 #define XEN_DOMCTL_getvcpuinfo 14
257 struct xen_domctl_getvcpuinfo {
258 /* IN variables. */
259 uint32_t vcpu;
260 /* OUT variables. */
261 uint8_t online; /* currently online (not hotplugged)? */
262 uint8_t blocked; /* blocked waiting for an event? */
263 uint8_t running; /* currently scheduled on its CPU? */
264 uint64_aligned_t cpu_time; /* total cpu time consumed (ns) */
265 uint32_t cpu; /* current mapping */
266 };
267 typedef struct xen_domctl_getvcpuinfo xen_domctl_getvcpuinfo_t;
268 DEFINE_XEN_GUEST_HANDLE(xen_domctl_getvcpuinfo_t);
271 /* Get/set which physical cpus a vcpu can execute on. */
272 #define XEN_DOMCTL_setvcpuaffinity 9
273 #define XEN_DOMCTL_getvcpuaffinity 25
274 struct xen_domctl_vcpuaffinity {
275 uint32_t vcpu; /* IN */
276 struct xenctl_cpumap cpumap; /* IN/OUT */
277 };
278 typedef struct xen_domctl_vcpuaffinity xen_domctl_vcpuaffinity_t;
279 DEFINE_XEN_GUEST_HANDLE(xen_domctl_vcpuaffinity_t);
282 #define XEN_DOMCTL_max_vcpus 15
283 struct xen_domctl_max_vcpus {
284 uint32_t max; /* maximum number of vcpus */
285 };
286 typedef struct xen_domctl_max_vcpus xen_domctl_max_vcpus_t;
287 DEFINE_XEN_GUEST_HANDLE(xen_domctl_max_vcpus_t);
290 #define XEN_DOMCTL_scheduler_op 16
291 /* Scheduler types. */
292 #define XEN_SCHEDULER_SEDF 4
293 #define XEN_SCHEDULER_CREDIT 5
294 /* Set or get info? */
295 #define XEN_DOMCTL_SCHEDOP_putinfo 0
296 #define XEN_DOMCTL_SCHEDOP_getinfo 1
297 struct xen_domctl_scheduler_op {
298 uint32_t sched_id; /* XEN_SCHEDULER_* */
299 uint32_t cmd; /* XEN_DOMCTL_SCHEDOP_* */
300 union {
301 struct xen_domctl_sched_sedf {
302 uint64_aligned_t period;
303 uint64_aligned_t slice;
304 uint64_aligned_t latency;
305 uint32_t extratime;
306 uint32_t weight;
307 } sedf;
308 struct xen_domctl_sched_credit {
309 uint16_t weight;
310 uint16_t cap;
311 } credit;
312 } u;
313 };
314 typedef struct xen_domctl_scheduler_op xen_domctl_scheduler_op_t;
315 DEFINE_XEN_GUEST_HANDLE(xen_domctl_scheduler_op_t);
318 #define XEN_DOMCTL_setdomainhandle 17
319 struct xen_domctl_setdomainhandle {
320 xen_domain_handle_t handle;
321 };
322 typedef struct xen_domctl_setdomainhandle xen_domctl_setdomainhandle_t;
323 DEFINE_XEN_GUEST_HANDLE(xen_domctl_setdomainhandle_t);
326 #define XEN_DOMCTL_setdebugging 18
327 struct xen_domctl_setdebugging {
328 uint8_t enable;
329 };
330 typedef struct xen_domctl_setdebugging xen_domctl_setdebugging_t;
331 DEFINE_XEN_GUEST_HANDLE(xen_domctl_setdebugging_t);
334 #define XEN_DOMCTL_irq_permission 19
335 struct xen_domctl_irq_permission {
336 uint8_t pirq;
337 uint8_t allow_access; /* flag to specify enable/disable of IRQ access */
338 };
339 typedef struct xen_domctl_irq_permission xen_domctl_irq_permission_t;
340 DEFINE_XEN_GUEST_HANDLE(xen_domctl_irq_permission_t);
343 #define XEN_DOMCTL_iomem_permission 20
344 struct xen_domctl_iomem_permission {
345 uint64_aligned_t first_mfn;/* first page (physical page number) in range */
346 uint64_aligned_t nr_mfns; /* number of pages in range (>0) */
347 uint8_t allow_access; /* allow (!0) or deny (0) access to range? */
348 };
349 typedef struct xen_domctl_iomem_permission xen_domctl_iomem_permission_t;
350 DEFINE_XEN_GUEST_HANDLE(xen_domctl_iomem_permission_t);
353 #define XEN_DOMCTL_ioport_permission 21
354 struct xen_domctl_ioport_permission {
355 uint32_t first_port; /* first port int range */
356 uint32_t nr_ports; /* size of port range */
357 uint8_t allow_access; /* allow or deny access to range? */
358 };
359 typedef struct xen_domctl_ioport_permission xen_domctl_ioport_permission_t;
360 DEFINE_XEN_GUEST_HANDLE(xen_domctl_ioport_permission_t);
363 #define XEN_DOMCTL_hypercall_init 22
364 struct xen_domctl_hypercall_init {
365 uint64_aligned_t gmfn; /* GMFN to be initialised */
366 };
367 typedef struct xen_domctl_hypercall_init xen_domctl_hypercall_init_t;
368 DEFINE_XEN_GUEST_HANDLE(xen_domctl_hypercall_init_t);
371 #define XEN_DOMCTL_arch_setup 23
372 #define _XEN_DOMAINSETUP_hvm_guest 0
373 #define XEN_DOMAINSETUP_hvm_guest (1UL<<_XEN_DOMAINSETUP_hvm_guest)
374 #define _XEN_DOMAINSETUP_query 1 /* Get parameters (for save) */
375 #define XEN_DOMAINSETUP_query (1UL<<_XEN_DOMAINSETUP_query)
376 typedef struct xen_domctl_arch_setup {
377 uint64_aligned_t flags; /* XEN_DOMAINSETUP_* */
378 #ifdef __ia64__
379 uint64_aligned_t bp; /* mpaddr of boot param area */
380 uint64_aligned_t maxmem; /* Highest memory address for MDT. */
381 uint64_aligned_t xsi_va; /* Xen shared_info area virtual address. */
382 uint32_t hypercall_imm; /* Break imm for Xen hypercalls. */
383 #endif
384 } xen_domctl_arch_setup_t;
385 DEFINE_XEN_GUEST_HANDLE(xen_domctl_arch_setup_t);
388 #define XEN_DOMCTL_settimeoffset 24
389 struct xen_domctl_settimeoffset {
390 int32_t time_offset_seconds; /* applied to domain wallclock time */
391 };
392 typedef struct xen_domctl_settimeoffset xen_domctl_settimeoffset_t;
393 DEFINE_XEN_GUEST_HANDLE(xen_domctl_settimeoffset_t);
396 #define XEN_DOMCTL_gethvmcontext 33
397 #define XEN_DOMCTL_sethvmcontext 34
398 typedef struct xen_domctl_hvmcontext {
399 uint32_t size; /* IN/OUT: size of buffer / bytes filled */
400 XEN_GUEST_HANDLE_64(uint8_t) buffer; /* IN/OUT: data, or call
401 * gethvmcontext with NULL
402 * buffer to get size
403 * req'd */
404 } xen_domctl_hvmcontext_t;
405 DEFINE_XEN_GUEST_HANDLE(xen_domctl_hvmcontext_t);
408 #define XEN_DOMCTL_set_address_size 35
409 #define XEN_DOMCTL_get_address_size 36
410 typedef struct xen_domctl_address_size {
411 uint32_t size;
412 } xen_domctl_address_size_t;
413 DEFINE_XEN_GUEST_HANDLE(xen_domctl_address_size_t);
416 #define XEN_DOMCTL_real_mode_area 26
417 struct xen_domctl_real_mode_area {
418 uint32_t log; /* log2 of Real Mode Area size */
419 };
420 typedef struct xen_domctl_real_mode_area xen_domctl_real_mode_area_t;
421 DEFINE_XEN_GUEST_HANDLE(xen_domctl_real_mode_area_t);
424 #define XEN_DOMCTL_sendtrigger 28
425 #define XEN_DOMCTL_SENDTRIGGER_NMI 0
426 #define XEN_DOMCTL_SENDTRIGGER_RESET 1
427 #define XEN_DOMCTL_SENDTRIGGER_INIT 2
428 struct xen_domctl_sendtrigger {
429 uint32_t trigger; /* IN */
430 uint32_t vcpu; /* IN */
431 };
432 typedef struct xen_domctl_sendtrigger xen_domctl_sendtrigger_t;
433 DEFINE_XEN_GUEST_HANDLE(xen_domctl_sendtrigger_t);
436 struct xen_domctl {
437 uint32_t cmd;
438 uint32_t interface_version; /* XEN_DOMCTL_INTERFACE_VERSION */
439 domid_t domain;
440 union {
441 struct xen_domctl_createdomain createdomain;
442 struct xen_domctl_getdomaininfo getdomaininfo;
443 struct xen_domctl_getmemlist getmemlist;
444 struct xen_domctl_getpageframeinfo getpageframeinfo;
445 struct xen_domctl_getpageframeinfo2 getpageframeinfo2;
446 struct xen_domctl_vcpuaffinity vcpuaffinity;
447 struct xen_domctl_shadow_op shadow_op;
448 struct xen_domctl_max_mem max_mem;
449 struct xen_domctl_vcpucontext vcpucontext;
450 struct xen_domctl_getvcpuinfo getvcpuinfo;
451 struct xen_domctl_max_vcpus max_vcpus;
452 struct xen_domctl_scheduler_op scheduler_op;
453 struct xen_domctl_setdomainhandle setdomainhandle;
454 struct xen_domctl_setdebugging setdebugging;
455 struct xen_domctl_irq_permission irq_permission;
456 struct xen_domctl_iomem_permission iomem_permission;
457 struct xen_domctl_ioport_permission ioport_permission;
458 struct xen_domctl_hypercall_init hypercall_init;
459 struct xen_domctl_arch_setup arch_setup;
460 struct xen_domctl_settimeoffset settimeoffset;
461 struct xen_domctl_real_mode_area real_mode_area;
462 struct xen_domctl_hvmcontext hvmcontext;
463 struct xen_domctl_address_size address_size;
464 struct xen_domctl_sendtrigger sendtrigger;
465 uint8_t pad[128];
466 } u;
467 };
468 typedef struct xen_domctl xen_domctl_t;
469 DEFINE_XEN_GUEST_HANDLE(xen_domctl_t);
471 #endif /* __XEN_PUBLIC_DOMCTL_H__ */
473 /*
474 * Local variables:
475 * mode: C
476 * c-set-style: "BSD"
477 * c-basic-offset: 4
478 * tab-width: 4
479 * indent-tabs-mode: nil
480 * End:
481 */