direct-io.hg

view xen/include/public/dom0_ops.h @ 3231:9035b6656818

bitkeeper revision 1.1159.187.48 (41adc6420WlNaaoUkvfgNxl44rpYYg)

Export Xen s/w perfctrs to DOM0 via new 'xenperf' utility.
author kaf24@scramble.cl.cam.ac.uk
date Wed Dec 01 13:25:22 2004 +0000 (2004-12-01)
parents 842780fc6584
children f2e12f9f7cc8
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 0xAAAA001A
24 /************************************************************************/
26 #define DOM0_GETMEMLIST 2
27 typedef struct {
28 /* IN variables. */
29 domid_t domain; /* 0 */
30 u16 __pad0;
31 u32 __pad1;
32 memory_t max_pfns; /* 8 */
33 MEMORY_PADDING;
34 void *buffer; /* 16 */
35 MEMORY_PADDING;
36 /* OUT variables. */
37 memory_t num_pfns; /* 24 */
38 MEMORY_PADDING;
39 } PACKED dom0_getmemlist_t; /* 32 bytes */
41 #define DOM0_SCHEDCTL 6
42 /* struct sched_ctl_cmd is from sched-ctl.h */
43 typedef struct sched_ctl_cmd dom0_schedctl_t;
45 #define DOM0_ADJUSTDOM 7
46 /* struct sched_adjdom_cmd is from sched-ctl.h */
47 typedef struct sched_adjdom_cmd dom0_adjustdom_t;
49 #define DOM0_CREATEDOMAIN 8
50 typedef struct {
51 /* IN parameters. */
52 memory_t memory_kb; /* 0 */
53 MEMORY_PADDING;
54 u32 cpu; /* 8 */
55 u32 __pad0; /* 12 */
56 /* IN/OUT parameters. */
57 /* If 0, domain is allocated. If non-zero use it unless in use. */
58 domid_t domain; /* 16 */
59 u16 __pad1;
60 /* OUT parameters. */
61 } PACKED dom0_createdomain_t; /* 20 bytes */
63 #define DOM0_DESTROYDOMAIN 9
64 typedef struct {
65 /* IN variables. */
66 domid_t domain; /* 0 */
67 u16 __pad;
68 } PACKED dom0_destroydomain_t; /* 4 bytes */
70 #define DOM0_PAUSEDOMAIN 10
71 typedef struct {
72 /* IN parameters. */
73 domid_t domain; /* 0 */
74 u16 __pad;
75 } PACKED dom0_pausedomain_t; /* 4 bytes */
77 #define DOM0_UNPAUSEDOMAIN 11
78 typedef struct {
79 /* IN parameters. */
80 domid_t domain; /* 0 */
81 u16 __pad;
82 } PACKED dom0_unpausedomain_t; /* 4 bytes */
84 #define DOM0_GETDOMAININFO 12
85 typedef struct {
86 /* IN variables. */
87 domid_t domain; /* 0 */ /* NB. IN/OUT variable. */
88 u16 __pad;
89 /* OUT variables. */
90 #define DOMFLAGS_DYING (1<<0) /* Domain is scheduled to die. */
91 #define DOMFLAGS_CRASHED (1<<1) /* Crashed domain; frozen for postmortem. */
92 #define DOMFLAGS_SHUTDOWN (1<<2) /* The guest OS has shut itself down. */
93 #define DOMFLAGS_PAUSED (1<<3) /* Currently paused by control software. */
94 #define DOMFLAGS_BLOCKED (1<<4) /* Currently blocked pending an event. */
95 #define DOMFLAGS_RUNNING (1<<5) /* Domain is currently running. */
96 #define DOMFLAGS_CPUMASK 255 /* CPU to which this domain is bound. */
97 #define DOMFLAGS_CPUSHIFT 8
98 #define DOMFLAGS_SHUTDOWNMASK 255 /* DOMFLAGS_SHUTDOWN guest-supplied code. */
99 #define DOMFLAGS_SHUTDOWNSHIFT 16
100 u32 flags; /* 4 */
101 full_execution_context_t *ctxt; /* 8 */ /* NB. IN/OUT variable. */
102 MEMORY_PADDING;
103 memory_t tot_pages; /* 16 */
104 MEMORY_PADDING;
105 memory_t max_pages; /* 24 */
106 MEMORY_PADDING;
107 memory_t shared_info_frame; /* 32: MFN of shared_info struct */
108 MEMORY_PADDING;
109 u64 cpu_time; /* 40 */
110 } PACKED dom0_getdomaininfo_t; /* 48 bytes */
112 #define DOM0_BUILDDOMAIN 13
113 typedef struct {
114 /* IN variables. */
115 domid_t domain; /* 0 */
116 u16 __pad0; /* 2 */
117 u32 __pad1; /* 4 */
118 /* IN/OUT parameters */
119 full_execution_context_t *ctxt; /* 8 */
120 MEMORY_PADDING;
121 } PACKED dom0_builddomain_t; /* 16 bytes */
123 #define DOM0_IOPL 14
124 typedef struct {
125 domid_t domain; /* 0 */
126 u16 __pad;
127 u32 iopl; /* 4 */
128 } PACKED dom0_iopl_t; /* 8 bytes */
130 #define DOM0_MSR 15
131 typedef struct {
132 /* IN variables. */
133 u32 write; /* 0 */
134 u32 cpu_mask; /* 4 */
135 u32 msr; /* 8 */
136 u32 in1; /* 12 */
137 u32 in2; /* 16 */
138 /* OUT variables. */
139 u32 out1; /* 20 */
140 u32 out2; /* 24 */
141 } PACKED dom0_msr_t; /* 28 bytes */
143 #define DOM0_DEBUG 16
144 typedef struct {
145 /* IN variables. */
146 domid_t domain; /* 0 */
147 u8 opcode; /* 2 */
148 u8 __pad;
149 u32 in1; /* 4 */
150 u32 in2; /* 8 */
151 u32 in3; /* 12 */
152 u32 in4; /* 16 */
153 /* OUT variables. */
154 u32 status; /* 20 */
155 u32 out1; /* 24 */
156 u32 out2; /* 28 */
157 } PACKED dom0_debug_t; /* 32 bytes */
159 /*
160 * Set clock such that it would read <secs,usecs> after 00:00:00 UTC,
161 * 1 January, 1970 if the current system time was <system_time>.
162 */
163 #define DOM0_SETTIME 17
164 typedef struct {
165 /* IN variables. */
166 u32 secs; /* 0 */
167 u32 usecs; /* 4 */
168 u64 system_time; /* 8 */
169 } PACKED dom0_settime_t; /* 16 bytes */
171 #define DOM0_GETPAGEFRAMEINFO 18
172 #define NOTAB 0 /* normal page */
173 #define L1TAB (1<<28)
174 #define L2TAB (2<<28)
175 #define L3TAB (3<<28)
176 #define L4TAB (4<<28)
177 #define LPINTAB (1<<31)
178 #define XTAB (0xf<<28) /* invalid page */
179 #define LTAB_MASK XTAB
180 #define LTABTYPE_MASK (0x7<<28)
182 typedef struct {
183 /* IN variables. */
184 memory_t pfn; /* 0: Machine page frame number to query. */
185 MEMORY_PADDING;
186 domid_t domain; /* 8: To which domain does the frame belong? */
187 u16 __pad;
188 /* OUT variables. */
189 /* Is the page PINNED to a type? */
190 u32 type; /* 12: see above type defs */
191 } PACKED dom0_getpageframeinfo_t; /* 16 bytes */
193 /*
194 * Read console content from Xen buffer ring.
195 */
196 #define DOM0_READCONSOLE 19
197 typedef struct {
198 memory_t str; /* 0 */
199 MEMORY_PADDING;
200 u32 count; /* 8 */
201 u32 cmd; /* 12 */
202 } PACKED dom0_readconsole_t; /* 16 bytes */
204 /*
205 * Pin Domain to a particular CPU (use -1 to unpin)
206 */
207 #define DOM0_PINCPUDOMAIN 20
208 typedef struct {
209 /* IN variables. */
210 domid_t domain; /* 0 */
211 u16 __pad;
212 s32 cpu; /* 4: -1 implies unpin */
213 } PACKED dom0_pincpudomain_t; /* 8 bytes */
215 /* Get trace buffers machine base address */
216 #define DOM0_GETTBUFS 21
217 typedef struct {
218 /* OUT variables */
219 memory_t mach_addr; /* 0: location of the trace buffers */
220 MEMORY_PADDING;
221 u32 size; /* 8: size of each trace buffer, in bytes */
222 } PACKED dom0_gettbufs_t; /* 12 bytes */
224 /*
225 * Get physical information about the host machine
226 */
227 #define DOM0_PHYSINFO 22
228 typedef struct {
229 u32 ht_per_core; /* 0 */
230 u32 cores; /* 4 */
231 u32 cpu_khz; /* 8 */
232 u32 __pad; /* 12 */
233 memory_t total_pages; /* 16 */
234 MEMORY_PADDING;
235 memory_t free_pages; /* 24 */
236 MEMORY_PADDING;
237 } PACKED dom0_physinfo_t; /* 32 bytes */
239 /*
240 * Allow a domain access to a physical PCI device
241 */
242 #define DOM0_PCIDEV_ACCESS 23
243 typedef struct {
244 /* IN variables. */
245 domid_t domain; /* 0 */
246 u16 __pad;
247 u32 bus; /* 4 */
248 u32 dev; /* 8 */
249 u32 func; /* 12 */
250 u32 enable; /* 16 */
251 } PACKED dom0_pcidev_access_t; /* 20 bytes */
253 /*
254 * Get the ID of the current scheduler.
255 */
256 #define DOM0_SCHED_ID 24
257 typedef struct {
258 /* OUT variable */
259 u32 sched_id; /* 0 */
260 } PACKED dom0_sched_id_t; /* 4 bytes */
262 /*
263 * Control shadow pagetables operation
264 */
265 #define DOM0_SHADOW_CONTROL 25
267 #define DOM0_SHADOW_CONTROL_OP_OFF 0
268 #define DOM0_SHADOW_CONTROL_OP_ENABLE_TEST 1
269 #define DOM0_SHADOW_CONTROL_OP_ENABLE_LOGDIRTY 2
270 #define DOM0_SHADOW_CONTROL_OP_ENABLE_TRANSLATE 3
271 #define DOM0_SHADOW_CONTROL_OP_FLUSH 10 /* table ops */
272 #define DOM0_SHADOW_CONTROL_OP_CLEAN 11
273 #define DOM0_SHADOW_CONTROL_OP_PEEK 12
275 typedef struct dom0_shadow_control
276 {
277 u32 fault_count;
278 u32 dirty_count;
279 u32 dirty_net_count;
280 u32 dirty_block_count;
281 } dom0_shadow_control_stats_t;
283 typedef struct {
284 /* IN variables. */
285 domid_t domain; /* 0 */
286 u16 __pad;
287 u32 op; /* 4 */
288 unsigned long *dirty_bitmap; /* 8: pointer to locked buffer */
289 MEMORY_PADDING;
290 /* IN/OUT variables. */
291 memory_t pages; /* 16: size of buffer, updated with actual size */
292 MEMORY_PADDING;
293 /* OUT variables. */
294 dom0_shadow_control_stats_t stats;
295 } PACKED dom0_shadow_control_t;
297 #define DOM0_SETDOMAININITIALMEM 27
298 typedef struct {
299 /* IN variables. */
300 domid_t domain; /* 0 */
301 u16 __pad0;
302 u32 __pad1;
303 memory_t initial_memkb; /* 8 */
304 MEMORY_PADDING;
305 } PACKED dom0_setdomaininitialmem_t; /* 16 bytes */
307 #define DOM0_SETDOMAINMAXMEM 28
308 typedef struct {
309 /* IN variables. */
310 domid_t domain; /* 0 */
311 u16 __pad0;
312 u32 __pad1;
313 memory_t max_memkb; /* 8 */
314 MEMORY_PADDING;
315 } PACKED dom0_setdomainmaxmem_t; /* 16 bytes */
317 #define DOM0_GETPAGEFRAMEINFO2 29 /* batched interface */
318 typedef struct {
319 /* IN variables. */
320 domid_t domain; /* 0 */
321 u16 __pad0;
322 u32 __pad1;
323 memory_t num; /* 8 */
324 MEMORY_PADDING;
325 /* IN/OUT variables. */
326 unsigned long *array; /* 16 */
327 MEMORY_PADDING;
328 } PACKED dom0_getpageframeinfo2_t; /* 24 bytes */
330 #define DOM0_SETDOMAINVMASSIST 30
331 typedef struct {
332 /* IN variables. */
333 domid_t domain; /* 0 */
334 u16 __pad0;
335 u32 cmd; /* 4: vm_assist cmd */
336 u32 type; /* 8: vm_assist cmd */
337 } PACKED dom0_setdomainvmassist_t; /* 12 bytes */
339 /*
340 * Request memory range (@pfn, @pfn+@nr_pfns-1) to have type @type.
341 * On x86, @type is an architecture-defined MTRR memory type.
342 * On success, returns the MTRR that was used (@reg) and a handle that can
343 * be passed to DOM0_DEL_MEMTYPE to accurately tear down the new setting.
344 * (x86-specific).
345 */
346 #define DOM0_ADD_MEMTYPE 31
347 typedef struct {
348 /* IN variables. */
349 memory_t pfn; /* 0 */
350 MEMORY_PADDING;
351 memory_t nr_pfns; /* 8 */
352 MEMORY_PADDING;
353 u32 type; /* 16 */
354 u32 __pad0;
355 /* OUT variables. */
356 u32 handle; /* 24 */
357 u32 reg; /* 28 */
358 } PACKED dom0_add_memtype_t; /* 32 bytes */
360 /*
361 * Tear down an existing memory-range type. If @handle is remembered then it
362 * should be passed in to accurately tear down the correct setting (in case
363 * of overlapping memory regions with differing types). If it is not known
364 * then @handle should be set to zero. In all cases @reg must be set.
365 * (x86-specific).
366 */
367 #define DOM0_DEL_MEMTYPE 32
368 typedef struct {
369 /* IN variables. */
370 u32 handle; /* 0 */
371 u32 reg; /* 4 */
372 } PACKED dom0_del_memtype_t; /* 8 bytes */
374 /* Read current type of an MTRR (x86-specific). */
375 #define DOM0_READ_MEMTYPE 33
376 typedef struct {
377 /* IN variables. */
378 u32 reg; /* 0 */
379 u32 __pad0;
380 /* OUT variables. */
381 memory_t pfn; /* 8 */
382 MEMORY_PADDING;
383 memory_t nr_pfns; /* 16 */
384 MEMORY_PADDING;
385 u32 type; /* 24 */
386 u32 __pad1;
387 } PACKED dom0_read_memtype_t; /* 32 bytes */
389 /* Interface for controlling Xen software performance counters. */
390 #define DOM0_PERFCCONTROL 34
391 /* Sub-operations: */
392 #define DOM0_PERFCCONTROL_OP_RESET 1 /* Reset all counters to zero. */
393 #define DOM0_PERFCCONTROL_OP_QUERY 2 /* Get perfctr information. */
394 typedef struct {
395 u8 name[80]; /* 0: name of perf counter */
396 u32 nr_vals; /* 80: number of values for this counter */
397 u32 vals[64]; /* 84: array of values */
398 } PACKED dom0_perfc_desc_t; /* 340 bytes */
399 typedef struct {
400 /* IN variables. */
401 u32 op; /* 0: DOM0_PERFCCONTROL_OP_??? */
402 /* OUT variables. */
403 u32 nr_counters; /* 4: number of counters */
404 dom0_perfc_desc_t *desc; /* 8: counter information (or NULL) */
405 MEMORY_PADDING;
406 } PACKED dom0_perfccontrol_t; /* 16 bytes */
408 typedef struct {
409 u32 cmd; /* 0 */
410 u32 interface_version; /* 4 */ /* DOM0_INTERFACE_VERSION */
411 union { /* 8 */
412 u32 dummy[18]; /* 72 bytes */
413 dom0_createdomain_t createdomain;
414 dom0_pausedomain_t pausedomain;
415 dom0_unpausedomain_t unpausedomain;
416 dom0_destroydomain_t destroydomain;
417 dom0_getmemlist_t getmemlist;
418 dom0_schedctl_t schedctl;
419 dom0_adjustdom_t adjustdom;
420 dom0_builddomain_t builddomain;
421 dom0_getdomaininfo_t getdomaininfo;
422 dom0_getpageframeinfo_t getpageframeinfo;
423 dom0_iopl_t iopl;
424 dom0_msr_t msr;
425 dom0_debug_t debug;
426 dom0_settime_t settime;
427 dom0_readconsole_t readconsole;
428 dom0_pincpudomain_t pincpudomain;
429 dom0_gettbufs_t gettbufs;
430 dom0_physinfo_t physinfo;
431 dom0_pcidev_access_t pcidev_access;
432 dom0_sched_id_t sched_id;
433 dom0_shadow_control_t shadow_control;
434 dom0_setdomaininitialmem_t setdomaininitialmem;
435 dom0_setdomainmaxmem_t setdomainmaxmem;
436 dom0_getpageframeinfo2_t getpageframeinfo2;
437 dom0_setdomainvmassist_t setdomainvmassist;
438 dom0_add_memtype_t add_memtype;
439 dom0_del_memtype_t del_memtype;
440 dom0_read_memtype_t read_memtype;
441 dom0_perfccontrol_t perfccontrol;
442 } PACKED u;
443 } PACKED dom0_op_t; /* 80 bytes */
445 #endif /* __XEN_PUBLIC_DOM0_OPS_H__ */