direct-io.hg

view tools/libxc/xc.h @ 2714:77fbe6c094f2

bitkeeper revision 1.1159.1.261 (41792d94c9Ck-m72kpZkL5_a2aSoZA)

Merge freefall.cl.cam.ac.uk:/auto/groups/xeno/users/cl349/BK/xeno.bk-26dom0
into freefall.cl.cam.ac.uk:/local/scratch/cl349/xeno.bk-24dom0
author cl349@freefall.cl.cam.ac.uk
date Fri Oct 22 15:56:04 2004 +0000 (2004-10-22)
parents 8aa9d487a8dd 06527e1d6757
children a5c335665fd6 3f929065a1d1
line source
1 /******************************************************************************
2 * xc.h
3 *
4 * A library for low-level access to the Xen control interfaces.
5 *
6 * Copyright (c) 2003, K A Fraser.
7 */
9 #ifndef __XC_H__
10 #define __XC_H__
12 typedef unsigned char u8;
13 typedef unsigned short u16;
14 typedef unsigned long u32;
15 typedef unsigned long long u64;
16 typedef signed char s8;
17 typedef signed short s16;
18 typedef signed long s32;
19 typedef signed long long s64;
21 /* Obtain or relinquish a handle on the 'xc' library. */
22 int xc_interface_open(void);
23 int xc_interface_close(int xc_handle);
25 typedef struct {
26 u32 domid;
27 unsigned int cpu;
28 unsigned int dying:1, crashed:1, shutdown:1,
29 paused:1, blocked:1, running:1;
30 unsigned int shutdown_reason; /* only meaningful if shutdown==1 */
31 unsigned long nr_pages;
32 unsigned long shared_info_frame;
33 u64 cpu_time;
34 unsigned long max_memkb;
35 } xc_dominfo_t;
37 typedef struct xc_shadow_control_stats_st
38 {
39 unsigned long fault_count;
40 unsigned long dirty_count;
41 unsigned long dirty_net_count;
42 unsigned long dirty_block_count;
43 } xc_shadow_control_stats_t;
45 int xc_domain_create(int xc_handle,
46 unsigned int mem_kb,
47 int cpu,
48 float cpu_weight,
49 u32 *pdomid);
50 int xc_domain_pause(int xc_handle,
51 u32 domid);
52 int xc_domain_unpause(int xc_handle,
53 u32 domid);
54 int xc_domain_destroy(int xc_handle,
55 u32 domid);
56 int xc_domain_pincpu(int xc_handle,
57 u32 domid,
58 int cpu);
59 int xc_domain_getinfo(int xc_handle,
60 u32 first_domid,
61 unsigned int max_doms,
62 xc_dominfo_t *info);
63 int xc_domain_setcpuweight(int xc_handle,
64 u32 domid,
65 float weight);
67 int xc_shadow_control(int xc_handle,
68 u32 domid,
69 unsigned int sop,
70 unsigned long *dirty_bitmap,
71 unsigned long pages,
72 xc_shadow_control_stats_t *stats);
75 #define XCFLAGS_VERBOSE 1
76 #define XCFLAGS_LIVE 2
77 #define XCFLAGS_DEBUG 4
78 #define XCFLAGS_CONFIGURE 8
80 struct XcIOContext;
81 int xc_linux_save(int xc_handle, struct XcIOContext *ioctxt);
82 int xc_linux_restore(int xc_handle, struct XcIOContext *ioctxt);
84 int xc_linux_build(int xc_handle,
85 u32 domid,
86 const char *image_name,
87 const char *ramdisk_name,
88 const char *cmdline,
89 unsigned int control_evtchn,
90 unsigned long flags);
92 int xc_bvtsched_global_set(int xc_handle,
93 unsigned long ctx_allow);
95 int xc_bvtsched_domain_set(int xc_handle,
96 u32 domid,
97 u32 mcuadv,
98 int warpback,
99 s32 warpvalue,
100 long long warpl,
101 long long warpu);
103 int xc_bvtsched_global_get(int xc_handle,
104 unsigned long *ctx_allow);
106 int xc_bvtsched_domain_get(int xc_handle,
107 u32 domid,
108 u32 *mcuadv,
109 int *warpback,
110 s32 *warpvalue,
111 long long *warpl,
112 long long *warpu);
114 int xc_atropos_domain_set(int xc_handle,
115 u32 domid,
116 u64 period, u64 slice, u64 latency,
117 int xtratime);
119 int xc_atropos_domain_get(int xc_handle,
120 u32 domid,
121 u64* period, u64 *slice, u64 *latency,
122 int *xtratime);
124 int xc_rrobin_global_set(int xc_handle, u64 slice);
126 int xc_rrobin_global_get(int xc_handle, u64 *slice);
128 #define DOMID_SELF (0x7FF0U)
129 #define DOMID_IO (0x7FF1U)
130 #define DOMID_XEN (0x7FF2U)
132 typedef struct {
133 #define EVTCHNSTAT_closed 0 /* Chennel is not in use. */
134 #define EVTCHNSTAT_unbound 1 /* Channel is not bound to a source. */
135 #define EVTCHNSTAT_interdomain 2 /* Channel is connected to remote domain. */
136 #define EVTCHNSTAT_pirq 3 /* Channel is bound to a phys IRQ line. */
137 #define EVTCHNSTAT_virq 4 /* Channel is bound to a virtual IRQ line */
138 int status;
139 union {
140 struct {
141 u32 dom;
142 int port;
143 } interdomain;
144 int pirq;
145 int virq;
146 } u;
147 } xc_evtchn_status_t;
149 int xc_evtchn_alloc_unbound(int xc_handle,
150 u32 dom,
151 int *port);
152 int xc_evtchn_bind_interdomain(int xc_handle,
153 u32 dom1, /* may be DOMID_SELF */
154 u32 dom2, /* may be DOMID_SELF */
155 int *port1,
156 int *port2);
157 int xc_evtchn_bind_virq(int xc_handle,
158 int virq,
159 int *port);
160 int xc_evtchn_close(int xc_handle,
161 u32 dom, /* may be DOMID_SELF */
162 int port);
163 int xc_evtchn_send(int xc_handle,
164 int local_port);
165 int xc_evtchn_status(int xc_handle,
166 u32 dom, /* may be DOMID_SELF */
167 int port,
168 xc_evtchn_status_t *status);
170 int xc_physdev_pci_access_modify(int xc_handle,
171 u32 domid,
172 int bus,
173 int dev,
174 int func,
175 int enable);
177 int xc_readconsolering(int xc_handle,
178 char *str,
179 unsigned int max_chars,
180 int clear);
182 typedef struct {
183 int ht_per_core;
184 int cores;
185 unsigned long total_pages;
186 unsigned long free_pages;
187 unsigned long cpu_khz;
188 } xc_physinfo_t;
190 int xc_physinfo(int xc_handle,
191 xc_physinfo_t *info);
193 int xc_sched_id(int xc_handle,
194 int *sched_id);
196 int xc_domain_setinitialmem(int xc_handle,
197 u32 domid,
198 unsigned int initial_memkb);
200 int xc_domain_setmaxmem(int xc_handle,
201 u32 domid,
202 unsigned int max_memkb);
204 int xc_domain_setvmassist(int xc_handle,
205 u32 domid,
206 unsigned int cmd,
207 unsigned int type);
210 void *xc_map_foreign_range(int xc_handle, u32 dom,
211 int size, int prot,
212 unsigned long mfn );
214 void *xc_map_foreign_batch(int xc_handle, u32 dom, int prot,
215 unsigned long *arr, int num );
217 #endif /* __XC_H__ */