ia64/xen-unstable

view xen/include/public/dom0_ops.h @ 6316:f7dfaa2af90c

merge?
author cl349@firebug.cl.cam.ac.uk
date Sun Aug 21 11:02:00 2005 +0000 (2005-08-21)
parents 1872e09bfba3
children 6721abf6b16d
line source
1 /******************************************************************************
2 * dom0_ops.h
3 *
4 * Process command requests from domain-0 guest OS.
5 *
6 * Copyright (c) 2002-2003, B Dragovic
7 * Copyright (c) 2002-2004, K Fraser
8 */
11 #ifndef __XEN_PUBLIC_DOM0_OPS_H__
12 #define __XEN_PUBLIC_DOM0_OPS_H__
14 #include "xen.h"
15 #include "sched_ctl.h"
17 /*
18 * Make sure you increment the interface version whenever you modify this file!
19 * This makes sure that old versions of dom0 tools will stop working in a
20 * well-defined way (rather than crashing the machine, for instance).
21 */
22 #define DOM0_INTERFACE_VERSION 0xAAAA100F
24 /************************************************************************/
26 #define DOM0_GETMEMLIST 2
27 typedef struct {
28 /* IN variables. */
29 domid_t domain;
30 unsigned long max_pfns;
31 void *buffer;
32 /* OUT variables. */
33 unsigned long num_pfns;
34 } dom0_getmemlist_t;
36 #define DOM0_SCHEDCTL 6
37 /* struct sched_ctl_cmd is from sched-ctl.h */
38 typedef struct sched_ctl_cmd dom0_schedctl_t;
40 #define DOM0_ADJUSTDOM 7
41 /* struct sched_adjdom_cmd is from sched-ctl.h */
42 typedef struct sched_adjdom_cmd dom0_adjustdom_t;
44 #define DOM0_CREATEDOMAIN 8
45 typedef struct {
46 /* IN parameters */
47 u32 ssidref;
48 /* IN/OUT parameters. */
49 /* Identifier for new domain (auto-allocate if zero is specified). */
50 domid_t domain;
51 } dom0_createdomain_t;
53 #define DOM0_DESTROYDOMAIN 9
54 typedef struct {
55 /* IN variables. */
56 domid_t domain;
57 } dom0_destroydomain_t;
59 #define DOM0_PAUSEDOMAIN 10
60 typedef struct {
61 /* IN parameters. */
62 domid_t domain;
63 } dom0_pausedomain_t;
65 #define DOM0_UNPAUSEDOMAIN 11
66 typedef struct {
67 /* IN parameters. */
68 domid_t domain;
69 } dom0_unpausedomain_t;
71 #define DOM0_GETDOMAININFO 12
72 typedef struct {
73 /* IN variables. */
74 domid_t domain; /* NB. IN/OUT variable. */
75 /* OUT variables. */
76 #define DOMFLAGS_DYING (1<<0) /* Domain is scheduled to die. */
77 #define DOMFLAGS_SHUTDOWN (1<<2) /* The guest OS has shut down. */
78 #define DOMFLAGS_PAUSED (1<<3) /* Currently paused by control software. */
79 #define DOMFLAGS_BLOCKED (1<<4) /* Currently blocked pending an event. */
80 #define DOMFLAGS_RUNNING (1<<5) /* Domain is currently running. */
81 #define DOMFLAGS_CPUMASK 255 /* CPU to which this domain is bound. */
82 #define DOMFLAGS_CPUSHIFT 8
83 #define DOMFLAGS_SHUTDOWNMASK 255 /* DOMFLAGS_SHUTDOWN guest-supplied code. */
84 #define DOMFLAGS_SHUTDOWNSHIFT 16
85 u32 flags;
86 unsigned long tot_pages;
87 unsigned long max_pages;
88 unsigned long shared_info_frame; /* MFN of shared_info struct */
89 u64 cpu_time;
90 u32 n_vcpu;
91 s32 vcpu_to_cpu[MAX_VIRT_CPUS]; /* current mapping */
92 cpumap_t cpumap[MAX_VIRT_CPUS]; /* allowable mapping */
93 u32 ssidref;
94 } dom0_getdomaininfo_t;
96 #define DOM0_SETDOMAININFO 13
97 typedef struct {
98 /* IN variables. */
99 domid_t domain;
100 u16 vcpu;
101 /* IN/OUT parameters */
102 vcpu_guest_context_t *ctxt;
103 } dom0_setdomaininfo_t;
105 #define DOM0_MSR 15
106 typedef struct {
107 /* IN variables. */
108 u32 write;
109 u32 cpu_mask;
110 u32 msr;
111 u32 in1;
112 u32 in2;
113 /* OUT variables. */
114 u32 out1;
115 u32 out2;
116 } dom0_msr_t;
118 #define DOM0_DEBUG 16
119 typedef struct {
120 /* IN variables. */
121 domid_t domain;
122 u8 opcode;
123 u32 in1;
124 u32 in2;
125 u32 in3;
126 u32 in4;
127 /* OUT variables. */
128 u32 status;
129 u32 out1;
130 u32 out2;
131 } dom0_debug_t;
133 /*
134 * Set clock such that it would read <secs,nsecs> after 00:00:00 UTC,
135 * 1 January, 1970 if the current system time was <system_time>.
136 */
137 #define DOM0_SETTIME 17
138 typedef struct {
139 /* IN variables. */
140 u32 secs;
141 u32 nsecs;
142 u64 system_time;
143 } dom0_settime_t;
145 #define DOM0_GETPAGEFRAMEINFO 18
146 #define NOTAB 0 /* normal page */
147 #define L1TAB (1<<28)
148 #define L2TAB (2<<28)
149 #define L3TAB (3<<28)
150 #define L4TAB (4<<28)
151 #define LPINTAB (1<<31)
152 #define XTAB (0xf<<28) /* invalid page */
153 #define LTAB_MASK XTAB
154 #define LTABTYPE_MASK (0x7<<28)
156 typedef struct {
157 /* IN variables. */
158 unsigned long pfn; /* Machine page frame number to query. */
159 domid_t domain; /* To which domain does the frame belong? */
160 /* OUT variables. */
161 /* Is the page PINNED to a type? */
162 u32 type; /* see above type defs */
163 } dom0_getpageframeinfo_t;
165 /*
166 * Read console content from Xen buffer ring.
167 */
168 #define DOM0_READCONSOLE 19
169 typedef struct {
170 /* IN variables. */
171 u32 clear; /* Non-zero -> clear after reading. */
172 /* IN/OUT variables. */
173 char *buffer; /* In: Buffer start; Out: Used buffer start */
174 u32 count; /* In: Buffer size; Out: Used buffer size */
175 } dom0_readconsole_t;
177 /*
178 * Set which physical cpus a vcpu can execute on.
179 */
180 #define DOM0_PINCPUDOMAIN 20
181 typedef struct {
182 /* IN variables. */
183 domid_t domain;
184 u16 vcpu;
185 cpumap_t *cpumap;
186 } dom0_pincpudomain_t;
188 /* Get trace buffers machine base address */
189 #define DOM0_TBUFCONTROL 21
190 typedef struct {
191 /* IN variables */
192 #define DOM0_TBUF_GET_INFO 0
193 #define DOM0_TBUF_SET_CPU_MASK 1
194 #define DOM0_TBUF_SET_EVT_MASK 2
195 u8 op;
196 /* IN/OUT variables */
197 unsigned long cpu_mask;
198 u32 evt_mask;
199 /* OUT variables */
200 unsigned long buffer_mfn;
201 u32 size;
202 } dom0_tbufcontrol_t;
204 /*
205 * Get physical information about the host machine
206 */
207 #define DOM0_PHYSINFO 22
208 typedef struct {
209 u32 threads_per_core;
210 u32 cores_per_socket;
211 u32 sockets_per_node;
212 u32 nr_nodes;
213 u32 cpu_khz;
214 unsigned long total_pages;
215 unsigned long free_pages;
216 } dom0_physinfo_t;
218 /*
219 * Get the ID of the current scheduler.
220 */
221 #define DOM0_SCHED_ID 24
222 typedef struct {
223 /* OUT variable */
224 u32 sched_id;
225 } dom0_sched_id_t;
227 /*
228 * Control shadow pagetables operation
229 */
230 #define DOM0_SHADOW_CONTROL 25
232 #define DOM0_SHADOW_CONTROL_OP_OFF 0
233 #define DOM0_SHADOW_CONTROL_OP_ENABLE_TEST 1
234 #define DOM0_SHADOW_CONTROL_OP_ENABLE_LOGDIRTY 2
235 #define DOM0_SHADOW_CONTROL_OP_ENABLE_TRANSLATE 3
237 #define DOM0_SHADOW_CONTROL_OP_FLUSH 10 /* table ops */
238 #define DOM0_SHADOW_CONTROL_OP_CLEAN 11
239 #define DOM0_SHADOW_CONTROL_OP_PEEK 12
241 typedef struct dom0_shadow_control
242 {
243 u32 fault_count;
244 u32 dirty_count;
245 u32 dirty_net_count;
246 u32 dirty_block_count;
247 } dom0_shadow_control_stats_t;
249 typedef struct {
250 /* IN variables. */
251 domid_t domain;
252 u32 op;
253 unsigned long *dirty_bitmap; /* pointer to locked buffer */
254 /* IN/OUT variables. */
255 unsigned long pages; /* size of buffer, updated with actual size */
256 /* OUT variables. */
257 dom0_shadow_control_stats_t stats;
258 } dom0_shadow_control_t;
260 #define DOM0_SETDOMAINMAXMEM 28
261 typedef struct {
262 /* IN variables. */
263 domid_t domain;
264 unsigned long max_memkb;
265 } dom0_setdomainmaxmem_t;
267 #define DOM0_GETPAGEFRAMEINFO2 29 /* batched interface */
268 typedef struct {
269 /* IN variables. */
270 domid_t domain;
271 unsigned long num;
272 /* IN/OUT variables. */
273 unsigned long *array;
274 } dom0_getpageframeinfo2_t;
276 /*
277 * Request memory range (@pfn, @pfn+@nr_pfns-1) to have type @type.
278 * On x86, @type is an architecture-defined MTRR memory type.
279 * On success, returns the MTRR that was used (@reg) and a handle that can
280 * be passed to DOM0_DEL_MEMTYPE to accurately tear down the new setting.
281 * (x86-specific).
282 */
283 #define DOM0_ADD_MEMTYPE 31
284 typedef struct {
285 /* IN variables. */
286 unsigned long pfn;
287 unsigned long nr_pfns;
288 u32 type;
289 /* OUT variables. */
290 u32 handle;
291 u32 reg;
292 } dom0_add_memtype_t;
294 /*
295 * Tear down an existing memory-range type. If @handle is remembered then it
296 * should be passed in to accurately tear down the correct setting (in case
297 * of overlapping memory regions with differing types). If it is not known
298 * then @handle should be set to zero. In all cases @reg must be set.
299 * (x86-specific).
300 */
301 #define DOM0_DEL_MEMTYPE 32
302 typedef struct {
303 /* IN variables. */
304 u32 handle;
305 u32 reg;
306 } dom0_del_memtype_t;
308 /* Read current type of an MTRR (x86-specific). */
309 #define DOM0_READ_MEMTYPE 33
310 typedef struct {
311 /* IN variables. */
312 u32 reg;
313 /* OUT variables. */
314 unsigned long pfn;
315 unsigned long nr_pfns;
316 u32 type;
317 } dom0_read_memtype_t;
319 /* Interface for controlling Xen software performance counters. */
320 #define DOM0_PERFCCONTROL 34
321 /* Sub-operations: */
322 #define DOM0_PERFCCONTROL_OP_RESET 1 /* Reset all counters to zero. */
323 #define DOM0_PERFCCONTROL_OP_QUERY 2 /* Get perfctr information. */
324 typedef struct {
325 u8 name[80]; /* name of perf counter */
326 u32 nr_vals; /* number of values for this counter */
327 u32 vals[64]; /* array of values */
328 } dom0_perfc_desc_t;
329 typedef struct {
330 /* IN variables. */
331 u32 op; /* DOM0_PERFCCONTROL_OP_??? */
332 /* OUT variables. */
333 u32 nr_counters; /* number of counters */
334 dom0_perfc_desc_t *desc; /* counter information (or NULL) */
335 } dom0_perfccontrol_t;
337 #define DOM0_MICROCODE 35
338 typedef struct {
339 /* IN variables. */
340 void *data; /* Pointer to microcode data */
341 u32 length; /* Length of microcode data. */
342 } dom0_microcode_t;
344 #define DOM0_IOPORT_PERMISSION 36
345 typedef struct {
346 domid_t domain; /* domain to be affected */
347 u16 first_port; /* first port int range */
348 u16 nr_ports; /* size of port range */
349 u16 allow_access; /* allow or deny access to range? */
350 } dom0_ioport_permission_t;
352 #define DOM0_GETVCPUCONTEXT 37
353 typedef struct {
354 domid_t domain; /* domain to be affected */
355 u16 vcpu; /* vcpu # */
356 vcpu_guest_context_t *ctxt; /* NB. IN/OUT variable. */
357 u64 cpu_time;
358 } dom0_getvcpucontext_t;
360 #define DOM0_GETDOMAININFOLIST 38
361 typedef struct {
362 /* IN variables. */
363 domid_t first_domain;
364 unsigned int max_domains;
365 dom0_getdomaininfo_t *buffer;
366 /* OUT variables. */
367 unsigned int num_domains;
368 } dom0_getdomaininfolist_t;
370 #define DOM0_PLATFORM_QUIRK 39
371 #define QUIRK_NOIRQBALANCING 1
372 typedef struct {
373 /* IN variables. */
374 int quirk_id;
375 } dom0_platform_quirk_t;
377 typedef struct {
378 u32 cmd;
379 u32 interface_version; /* DOM0_INTERFACE_VERSION */
380 union {
381 dom0_createdomain_t createdomain;
382 dom0_pausedomain_t pausedomain;
383 dom0_unpausedomain_t unpausedomain;
384 dom0_destroydomain_t destroydomain;
385 dom0_getmemlist_t getmemlist;
386 dom0_schedctl_t schedctl;
387 dom0_adjustdom_t adjustdom;
388 dom0_setdomaininfo_t setdomaininfo;
389 dom0_getdomaininfo_t getdomaininfo;
390 dom0_getpageframeinfo_t getpageframeinfo;
391 dom0_msr_t msr;
392 dom0_debug_t debug;
393 dom0_settime_t settime;
394 dom0_readconsole_t readconsole;
395 dom0_pincpudomain_t pincpudomain;
396 dom0_tbufcontrol_t tbufcontrol;
397 dom0_physinfo_t physinfo;
398 dom0_sched_id_t sched_id;
399 dom0_shadow_control_t shadow_control;
400 dom0_setdomainmaxmem_t setdomainmaxmem;
401 dom0_getpageframeinfo2_t getpageframeinfo2;
402 dom0_add_memtype_t add_memtype;
403 dom0_del_memtype_t del_memtype;
404 dom0_read_memtype_t read_memtype;
405 dom0_perfccontrol_t perfccontrol;
406 dom0_microcode_t microcode;
407 dom0_ioport_permission_t ioport_permission;
408 dom0_getvcpucontext_t getvcpucontext;
409 dom0_getdomaininfolist_t getdomaininfolist;
410 dom0_platform_quirk_t platform_quirk;
411 } u;
412 } dom0_op_t;
414 #endif /* __XEN_PUBLIC_DOM0_OPS_H__ */