direct-io.hg

view tools/libxc/xc.h @ 2693:2584528df9e1

bitkeeper revision 1.1159.123.2 (4177d169N58TtQXn_XJO4xNBKbMQUw)

Merge freefall.cl.cam.ac.uk:/auto/groups/xeno/BK/xeno.bk
into freefall.cl.cam.ac.uk:/local/scratch/kaf24/xeno
author kaf24@freefall.cl.cam.ac.uk
date Thu Oct 21 15:10:33 2004 +0000 (2004-10-21)
parents 7bc73b540515 d8e27145f1eb
children 8aa9d487a8dd
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_bind_interdomain(int xc_handle,
150 u32 dom1, /* may be DOMID_SELF */
151 u32 dom2, /* may be DOMID_SELF */
152 int *port1,
153 int *port2);
154 int xc_evtchn_bind_virq(int xc_handle,
155 int virq,
156 int *port);
157 int xc_evtchn_close(int xc_handle,
158 u32 dom, /* may be DOMID_SELF */
159 int port);
160 int xc_evtchn_send(int xc_handle,
161 int local_port);
162 int xc_evtchn_status(int xc_handle,
163 u32 dom, /* may be DOMID_SELF */
164 int port,
165 xc_evtchn_status_t *status);
167 int xc_physdev_pci_access_modify(int xc_handle,
168 u32 domid,
169 int bus,
170 int dev,
171 int func,
172 int enable);
174 int xc_readconsolering(int xc_handle,
175 char *str,
176 unsigned int max_chars,
177 int clear);
179 typedef struct {
180 int ht_per_core;
181 int cores;
182 unsigned long total_pages;
183 unsigned long free_pages;
184 unsigned long cpu_khz;
185 } xc_physinfo_t;
187 int xc_physinfo(int xc_handle,
188 xc_physinfo_t *info);
190 int xc_sched_id(int xc_handle,
191 int *sched_id);
193 int xc_domain_setinitialmem(int xc_handle,
194 u32 domid,
195 unsigned int initial_memkb);
197 int xc_domain_setmaxmem(int xc_handle,
198 u32 domid,
199 unsigned int max_memkb);
201 int xc_domain_setvmassist(int xc_handle,
202 u32 domid,
203 unsigned int cmd,
204 unsigned int type);
207 void *xc_map_foreign_range(int xc_handle, u32 dom,
208 int size, int prot,
209 unsigned long mfn );
211 void *xc_map_foreign_batch(int xc_handle, u32 dom, int prot,
212 unsigned long *arr, int num );
214 #endif /* __XC_H__ */