direct-io.hg

view tools/libxc/xc.h @ 2590:98bdf2c88015

bitkeeper revision 1.1159.1.201 (41600e1fkVMoQU0dVgk1h6vT502hEg)

Merge
author iap10@labyrinth.cl.cam.ac.uk
date Sun Oct 03 14:35:11 2004 +0000 (2004-10-03)
parents 875c25208085 a15ab016f0c6
children c084a63b2b64
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 #define XC_DOMINFO_MAXNAME 16
35 char name[XC_DOMINFO_MAXNAME];
36 unsigned long max_memkb;
37 } xc_dominfo_t;
39 typedef struct xc_shadow_control_stats_st
40 {
41 unsigned long fault_count;
42 unsigned long dirty_count;
43 unsigned long dirty_net_count;
44 unsigned long dirty_block_count;
45 } xc_shadow_control_stats_t;
47 int xc_domain_create(int xc_handle,
48 unsigned int mem_kb,
49 const char *name,
50 int cpu,
51 float cpu_weight,
52 u32 *pdomid);
53 int xc_domain_pause(int xc_handle,
54 u32 domid);
55 int xc_domain_unpause(int xc_handle,
56 u32 domid);
57 int xc_domain_destroy(int xc_handle,
58 u32 domid);
59 int xc_domain_pincpu(int xc_handle,
60 u32 domid,
61 int cpu);
62 int xc_domain_getinfo(int xc_handle,
63 u32 first_domid,
64 unsigned int max_doms,
65 xc_dominfo_t *info);
66 int xc_domain_setcpuweight(int xc_handle,
67 u32 domid,
68 float weight);
70 int xc_shadow_control(int xc_handle,
71 u32 domid,
72 unsigned int sop,
73 unsigned long *dirty_bitmap,
74 unsigned long pages,
75 xc_shadow_control_stats_t *stats);
78 #define XCFLAGS_VERBOSE 1
79 #define XCFLAGS_LIVE 2
80 #define XCFLAGS_DEBUG 4
81 #define XCFLAGS_CONFIGURE 8
83 struct XcIOContext;
84 int xc_linux_save(int xc_handle, struct XcIOContext *ioctxt);
85 int xc_linux_restore(int xc_handle, struct XcIOContext *ioctxt);
87 int xc_linux_build(int xc_handle,
88 u32 domid,
89 const char *image_name,
90 const char *ramdisk_name,
91 const char *cmdline,
92 unsigned int control_evtchn,
93 unsigned long flags);
95 int xc_netbsd_build(int xc_handle,
96 u32 domid,
97 const char *image_name,
98 const char *cmdline,
99 unsigned int control_evtchn);
101 int xc_bvtsched_global_set(int xc_handle,
102 unsigned long ctx_allow);
104 int xc_bvtsched_domain_set(int xc_handle,
105 u32 domid,
106 u32 mcuadv,
107 int warpback,
108 s32 warpvalue,
109 long long warpl,
110 long long warpu);
112 int xc_bvtsched_global_get(int xc_handle,
113 unsigned long *ctx_allow);
115 int xc_bvtsched_domain_get(int xc_handle,
116 u32 domid,
117 u32 *mcuadv,
118 int *warpback,
119 s32 *warpvalue,
120 long long *warpl,
121 long long *warpu);
123 int xc_fbvtsched_global_set(int xc_handle,
124 unsigned long ctx_allow);
126 int xc_fbvtsched_domain_set(int xc_handle,
127 u32 domid,
128 unsigned long mcuadv,
129 unsigned long warp,
130 unsigned long warpl,
131 unsigned long warpu);
133 int xc_fbvtsched_global_get(int xc_handle,
134 unsigned long *ctx_allow);
136 int xc_fbvtsched_domain_get(int xc_handle,
137 u32 domid,
138 unsigned long *mcuadv,
139 unsigned long *warp,
140 unsigned long *warpl,
141 unsigned long *warpu);
143 int xc_atropos_domain_set(int xc_handle,
144 u32 domid,
145 u64 period, u64 slice, u64 latency,
146 int xtratime);
148 int xc_atropos_domain_get(int xc_handle,
149 u32 domid,
150 u64* period, u64 *slice, u64 *latency,
151 int *xtratime);
153 int xc_rrobin_global_set(int xc_handle, u64 slice);
155 int xc_rrobin_global_get(int xc_handle, u64 *slice);
157 #define DOMID_SELF (0x7FF0U)
158 #define DOMID_IO (0x7FF1U)
159 #define DOMID_XEN (0x7FF2U)
161 typedef struct {
162 #define EVTCHNSTAT_closed 0 /* Chennel is not in use. */
163 #define EVTCHNSTAT_unbound 1 /* Channel is not bound to a source. */
164 #define EVTCHNSTAT_interdomain 2 /* Channel is connected to remote domain. */
165 #define EVTCHNSTAT_pirq 3 /* Channel is bound to a phys IRQ line. */
166 #define EVTCHNSTAT_virq 4 /* Channel is bound to a virtual IRQ line */
167 int status;
168 union {
169 struct {
170 u32 dom;
171 int port;
172 } interdomain;
173 int pirq;
174 int virq;
175 } u;
176 } xc_evtchn_status_t;
178 int xc_evtchn_bind_interdomain(int xc_handle,
179 u32 dom1, /* may be DOMID_SELF */
180 u32 dom2, /* may be DOMID_SELF */
181 int *port1,
182 int *port2);
183 int xc_evtchn_bind_virq(int xc_handle,
184 int virq,
185 int *port);
186 int xc_evtchn_close(int xc_handle,
187 u32 dom, /* may be DOMID_SELF */
188 int port);
189 int xc_evtchn_send(int xc_handle,
190 int local_port);
191 int xc_evtchn_status(int xc_handle,
192 u32 dom, /* may be DOMID_SELF */
193 int port,
194 xc_evtchn_status_t *status);
196 int xc_physdev_pci_access_modify(int xc_handle,
197 u32 domid,
198 int bus,
199 int dev,
200 int func,
201 int enable);
203 int xc_readconsolering(int xc_handle,
204 char *str,
205 unsigned int max_chars,
206 int clear);
208 typedef struct {
209 int ht_per_core;
210 int cores;
211 unsigned long total_pages;
212 unsigned long free_pages;
213 unsigned long cpu_khz;
214 } xc_physinfo_t;
216 int xc_physinfo(int xc_handle,
217 xc_physinfo_t *info);
219 int xc_sched_id(int xc_handle,
220 int *sched_id);
222 int xc_domain_setname(int xc_handle,
223 u32 domid,
224 char *name);
226 int xc_domain_setinitialmem(int xc_handle,
227 u32 domid,
228 unsigned int initial_memkb);
230 int xc_domain_setmaxmem(int xc_handle,
231 u32 domid,
232 unsigned int max_memkb);
234 int xc_domain_setvmassist(int xc_handle,
235 u32 domid,
236 unsigned int cmd,
237 unsigned int type);
240 void *xc_map_foreign_range(int xc_handle, u32 dom,
241 int size, int prot,
242 unsigned long mfn );
244 void *xc_map_foreign_batch(int xc_handle, u32 dom, int prot,
245 unsigned long *arr, int num );
247 #endif /* __XC_H__ */