ia64/xen-unstable

view xen/include/public/dom0_ops.h @ 7395:27d7c7f226f4

Extend VCPUINFO dom0_op to return status information about
run state of the VCPU. VCPUCONTEXT returns info about
hotplugged VCPUs.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Sat Oct 15 08:52:22 2005 +0100 (2005-10-15)
parents d48bc069122c
children fa0faada967b
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 0xAAAA1011
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 uint32_t ssidref;
48 xen_domain_handle_t handle;
49 /* IN/OUT parameters. */
50 /* Identifier for new domain (auto-allocate if zero is specified). */
51 domid_t domain;
52 } dom0_createdomain_t;
54 #define DOM0_DESTROYDOMAIN 9
55 typedef struct {
56 /* IN variables. */
57 domid_t domain;
58 } dom0_destroydomain_t;
60 #define DOM0_PAUSEDOMAIN 10
61 typedef struct {
62 /* IN parameters. */
63 domid_t domain;
64 } dom0_pausedomain_t;
66 #define DOM0_UNPAUSEDOMAIN 11
67 typedef struct {
68 /* IN parameters. */
69 domid_t domain;
70 } dom0_unpausedomain_t;
72 #define DOM0_GETDOMAININFO 12
73 typedef struct {
74 /* IN variables. */
75 domid_t domain; /* NB. IN/OUT variable. */
76 /* OUT variables. */
77 #define DOMFLAGS_DYING (1<<0) /* Domain is scheduled to die. */
78 #define DOMFLAGS_SHUTDOWN (1<<2) /* The guest OS has shut down. */
79 #define DOMFLAGS_PAUSED (1<<3) /* Currently paused by control software. */
80 #define DOMFLAGS_BLOCKED (1<<4) /* Currently blocked pending an event. */
81 #define DOMFLAGS_RUNNING (1<<5) /* Domain is currently running. */
82 #define DOMFLAGS_CPUMASK 255 /* CPU to which this domain is bound. */
83 #define DOMFLAGS_CPUSHIFT 8
84 #define DOMFLAGS_SHUTDOWNMASK 255 /* DOMFLAGS_SHUTDOWN guest-supplied code. */
85 #define DOMFLAGS_SHUTDOWNSHIFT 16
86 uint32_t flags;
87 unsigned long tot_pages;
88 unsigned long max_pages;
89 unsigned long shared_info_frame; /* MFN of shared_info struct */
90 uint64_t cpu_time;
91 uint32_t n_vcpu;
92 uint32_t ssidref;
93 xen_domain_handle_t handle;
94 } dom0_getdomaininfo_t;
96 #define DOM0_SETDOMAININFO 13
97 typedef struct {
98 /* IN variables. */
99 domid_t domain;
100 uint16_t 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 uint32_t write;
109 uint32_t cpu_mask;
110 uint32_t msr;
111 uint32_t in1;
112 uint32_t in2;
113 /* OUT variables. */
114 uint32_t out1;
115 uint32_t out2;
116 } dom0_msr_t;
118 #define DOM0_DEBUG 16
119 typedef struct {
120 /* IN variables. */
121 domid_t domain;
122 uint8_t opcode;
123 uint32_t in1;
124 uint32_t in2;
125 uint32_t in3;
126 uint32_t in4;
127 /* OUT variables. */
128 uint32_t status;
129 uint32_t out1;
130 uint32_t 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 uint32_t secs;
141 uint32_t nsecs;
142 uint64_t 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 uint32_t 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 uint32_t clear; /* Non-zero -> clear after reading. */
172 /* IN/OUT variables. */
173 char *buffer; /* In: Buffer start; Out: Used buffer start */
174 uint32_t 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 uint16_t 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 uint8_t op;
196 /* IN/OUT variables */
197 unsigned long cpu_mask;
198 uint32_t evt_mask;
199 /* OUT variables */
200 unsigned long buffer_mfn;
201 uint32_t size;
202 } dom0_tbufcontrol_t;
204 /*
205 * Get physical information about the host machine
206 */
207 #define DOM0_PHYSINFO 22
208 typedef struct {
209 uint32_t threads_per_core;
210 uint32_t cores_per_socket;
211 uint32_t sockets_per_node;
212 uint32_t nr_nodes;
213 uint32_t cpu_khz;
214 unsigned long total_pages;
215 unsigned long free_pages;
216 uint32_t hw_cap[8];
217 } dom0_physinfo_t;
219 /*
220 * Get the ID of the current scheduler.
221 */
222 #define DOM0_SCHED_ID 24
223 typedef struct {
224 /* OUT variable */
225 uint32_t sched_id;
226 } dom0_sched_id_t;
228 /*
229 * Control shadow pagetables operation
230 */
231 #define DOM0_SHADOW_CONTROL 25
233 #define DOM0_SHADOW_CONTROL_OP_OFF 0
234 #define DOM0_SHADOW_CONTROL_OP_ENABLE_TEST 1
235 #define DOM0_SHADOW_CONTROL_OP_ENABLE_LOGDIRTY 2
236 #define DOM0_SHADOW_CONTROL_OP_ENABLE_TRANSLATE 3
238 #define DOM0_SHADOW_CONTROL_OP_FLUSH 10 /* table ops */
239 #define DOM0_SHADOW_CONTROL_OP_CLEAN 11
240 #define DOM0_SHADOW_CONTROL_OP_PEEK 12
242 typedef struct dom0_shadow_control
243 {
244 uint32_t fault_count;
245 uint32_t dirty_count;
246 uint32_t dirty_net_count;
247 uint32_t dirty_block_count;
248 } dom0_shadow_control_stats_t;
250 typedef struct {
251 /* IN variables. */
252 domid_t domain;
253 uint32_t op;
254 unsigned long *dirty_bitmap; /* pointer to locked buffer */
255 /* IN/OUT variables. */
256 unsigned long pages; /* size of buffer, updated with actual size */
257 /* OUT variables. */
258 dom0_shadow_control_stats_t stats;
259 } dom0_shadow_control_t;
261 #define DOM0_SETDOMAINMAXMEM 28
262 typedef struct {
263 /* IN variables. */
264 domid_t domain;
265 unsigned long max_memkb;
266 } dom0_setdomainmaxmem_t;
268 #define DOM0_GETPAGEFRAMEINFO2 29 /* batched interface */
269 typedef struct {
270 /* IN variables. */
271 domid_t domain;
272 unsigned long num;
273 /* IN/OUT variables. */
274 unsigned long *array;
275 } dom0_getpageframeinfo2_t;
277 /*
278 * Request memory range (@pfn, @pfn+@nr_pfns-1) to have type @type.
279 * On x86, @type is an architecture-defined MTRR memory type.
280 * On success, returns the MTRR that was used (@reg) and a handle that can
281 * be passed to DOM0_DEL_MEMTYPE to accurately tear down the new setting.
282 * (x86-specific).
283 */
284 #define DOM0_ADD_MEMTYPE 31
285 typedef struct {
286 /* IN variables. */
287 unsigned long pfn;
288 unsigned long nr_pfns;
289 uint32_t type;
290 /* OUT variables. */
291 uint32_t handle;
292 uint32_t reg;
293 } dom0_add_memtype_t;
295 /*
296 * Tear down an existing memory-range type. If @handle is remembered then it
297 * should be passed in to accurately tear down the correct setting (in case
298 * of overlapping memory regions with differing types). If it is not known
299 * then @handle should be set to zero. In all cases @reg must be set.
300 * (x86-specific).
301 */
302 #define DOM0_DEL_MEMTYPE 32
303 typedef struct {
304 /* IN variables. */
305 uint32_t handle;
306 uint32_t reg;
307 } dom0_del_memtype_t;
309 /* Read current type of an MTRR (x86-specific). */
310 #define DOM0_READ_MEMTYPE 33
311 typedef struct {
312 /* IN variables. */
313 uint32_t reg;
314 /* OUT variables. */
315 unsigned long pfn;
316 unsigned long nr_pfns;
317 uint32_t type;
318 } dom0_read_memtype_t;
320 /* Interface for controlling Xen software performance counters. */
321 #define DOM0_PERFCCONTROL 34
322 /* Sub-operations: */
323 #define DOM0_PERFCCONTROL_OP_RESET 1 /* Reset all counters to zero. */
324 #define DOM0_PERFCCONTROL_OP_QUERY 2 /* Get perfctr information. */
325 typedef struct {
326 uint8_t name[80]; /* name of perf counter */
327 uint32_t nr_vals; /* number of values for this counter */
328 uint32_t vals[64]; /* array of values */
329 } dom0_perfc_desc_t;
330 typedef struct {
331 /* IN variables. */
332 uint32_t op; /* DOM0_PERFCCONTROL_OP_??? */
333 /* OUT variables. */
334 uint32_t nr_counters; /* number of counters */
335 dom0_perfc_desc_t *desc; /* counter information (or NULL) */
336 } dom0_perfccontrol_t;
338 #define DOM0_MICROCODE 35
339 typedef struct {
340 /* IN variables. */
341 void *data; /* Pointer to microcode data */
342 uint32_t length; /* Length of microcode data. */
343 } dom0_microcode_t;
345 #define DOM0_IOPORT_PERMISSION 36
346 typedef struct {
347 domid_t domain; /* domain to be affected */
348 uint16_t first_port; /* first port int range */
349 uint16_t nr_ports; /* size of port range */
350 uint16_t allow_access; /* allow or deny access to range? */
351 } dom0_ioport_permission_t;
353 #define DOM0_GETVCPUCONTEXT 37
354 typedef struct {
355 /* IN variables. */
356 domid_t domain; /* domain to be affected */
357 uint16_t vcpu; /* vcpu # */
358 /* OUT variables. */
359 vcpu_guest_context_t *ctxt;
360 } dom0_getvcpucontext_t;
362 #define DOM0_GETVCPUINFO 43
363 typedef struct {
364 /* IN variables. */
365 domid_t domain; /* domain to be affected */
366 uint16_t vcpu; /* vcpu # */
367 /* OUT variables. */
368 uint8_t online; /* currently online (not hotplugged)? */
369 uint8_t blocked; /* blocked waiting for an event? */
370 uint8_t running; /* currently scheduled on its CPU? */
371 uint64_t cpu_time; /* total cpu time consumed (ns) */
372 uint32_t cpu; /* current mapping */
373 cpumap_t cpumap; /* allowable mapping */
374 } dom0_getvcpuinfo_t;
376 #define DOM0_GETDOMAININFOLIST 38
377 typedef struct {
378 /* IN variables. */
379 domid_t first_domain;
380 unsigned int max_domains;
381 dom0_getdomaininfo_t *buffer;
382 /* OUT variables. */
383 unsigned int num_domains;
384 } dom0_getdomaininfolist_t;
386 #define DOM0_PLATFORM_QUIRK 39
387 #define QUIRK_NOIRQBALANCING 1
388 typedef struct {
389 /* IN variables. */
390 int quirk_id;
391 } dom0_platform_quirk_t;
393 #define DOM0_PHYSICAL_MEMORY_MAP 40
394 typedef struct {
395 /* IN variables. */
396 int max_map_entries;
397 /* OUT variables. */
398 int nr_map_entries;
399 struct dom0_memory_map_entry {
400 uint64_t start, end;
401 int is_ram;
402 } *memory_map;
403 } dom0_physical_memory_map_t;
405 #define DOM0_MAX_VCPUS 41
406 typedef struct {
407 domid_t domain; /* domain to be affected */
408 unsigned int max; /* maximum number of vcpus */
409 } dom0_max_vcpus_t;
411 #define DOM0_SETDOMAINHANDLE 44
412 typedef struct {
413 domid_t domain;
414 xen_domain_handle_t handle;
415 } dom0_setdomainhandle_t;
417 typedef struct {
418 uint32_t cmd;
419 uint32_t interface_version; /* DOM0_INTERFACE_VERSION */
420 union {
421 dom0_createdomain_t createdomain;
422 dom0_pausedomain_t pausedomain;
423 dom0_unpausedomain_t unpausedomain;
424 dom0_destroydomain_t destroydomain;
425 dom0_getmemlist_t getmemlist;
426 dom0_schedctl_t schedctl;
427 dom0_adjustdom_t adjustdom;
428 dom0_setdomaininfo_t setdomaininfo;
429 dom0_getdomaininfo_t getdomaininfo;
430 dom0_getpageframeinfo_t getpageframeinfo;
431 dom0_msr_t msr;
432 dom0_debug_t debug;
433 dom0_settime_t settime;
434 dom0_readconsole_t readconsole;
435 dom0_pincpudomain_t pincpudomain;
436 dom0_tbufcontrol_t tbufcontrol;
437 dom0_physinfo_t physinfo;
438 dom0_sched_id_t sched_id;
439 dom0_shadow_control_t shadow_control;
440 dom0_setdomainmaxmem_t setdomainmaxmem;
441 dom0_getpageframeinfo2_t getpageframeinfo2;
442 dom0_add_memtype_t add_memtype;
443 dom0_del_memtype_t del_memtype;
444 dom0_read_memtype_t read_memtype;
445 dom0_perfccontrol_t perfccontrol;
446 dom0_microcode_t microcode;
447 dom0_ioport_permission_t ioport_permission;
448 dom0_getvcpucontext_t getvcpucontext;
449 dom0_getvcpuinfo_t getvcpuinfo;
450 dom0_getdomaininfolist_t getdomaininfolist;
451 dom0_platform_quirk_t platform_quirk;
452 dom0_physical_memory_map_t physical_memory_map;
453 dom0_max_vcpus_t max_vcpus;
454 dom0_setdomainhandle_t setdomainhandle;
455 uint8_t pad[128];
456 } u;
457 } dom0_op_t;
459 #endif /* __XEN_PUBLIC_DOM0_OPS_H__ */
461 /*
462 * Local variables:
463 * mode: C
464 * c-set-style: "BSD"
465 * c-basic-offset: 4
466 * tab-width: 4
467 * indent-tabs-mode: nil
468 * End:
469 */