direct-io.hg

view xen/include/public/dom0_ops.h @ 8686:c0a0f4db5ab1

Create a block of reserved PFNs in shadow translate mode guests, and
move the shared info and grant table pfns into that block. This
allows us to remove the get_gnttablist dom0 op, and simplifies the
domain creation code slightly. Having the reserved block managed by
Xen may also make it slightly easier to handle the case where the
grant table needs to be extended at run time.

Suggested-by: kaf24
Signed-off-by: Steven Smith, sos22@cam.ac.uk
author sos22@douglas.cl.cam.ac.uk
date Thu Jan 26 19:40:13 2006 +0100 (2006-01-26)
parents cc9bb3e0e348
children a47b7a464f09
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 0x03000000
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 nr_online_vcpus; /* Number of VCPUs currently online. */
92 uint32_t max_vcpu_id; /* Maximum VCPUID in use by this domain. */
93 uint32_t ssidref;
94 xen_domain_handle_t handle;
95 } dom0_getdomaininfo_t;
97 #define DOM0_SETVCPUCONTEXT 13
98 typedef struct {
99 /* IN variables. */
100 domid_t domain;
101 uint32_t vcpu;
102 /* IN/OUT parameters */
103 vcpu_guest_context_t *ctxt;
104 } dom0_setvcpucontext_t;
106 #define DOM0_MSR 15
107 typedef struct {
108 /* IN variables. */
109 uint32_t write;
110 cpumap_t cpu_mask;
111 uint32_t msr;
112 uint32_t in1;
113 uint32_t in2;
114 /* OUT variables. */
115 uint32_t out1;
116 uint32_t out2;
117 } dom0_msr_t;
119 /*
120 * Set clock such that it would read <secs,nsecs> after 00:00:00 UTC,
121 * 1 January, 1970 if the current system time was <system_time>.
122 */
123 #define DOM0_SETTIME 17
124 typedef struct {
125 /* IN variables. */
126 uint32_t secs;
127 uint32_t nsecs;
128 uint64_t system_time;
129 } dom0_settime_t;
131 #define DOM0_GETPAGEFRAMEINFO 18
132 #define NOTAB 0 /* normal page */
133 #define L1TAB (1<<28)
134 #define L2TAB (2<<28)
135 #define L3TAB (3<<28)
136 #define L4TAB (4<<28)
137 #define LPINTAB (1<<31)
138 #define XTAB (0xf<<28) /* invalid page */
139 #define LTAB_MASK XTAB
140 #define LTABTYPE_MASK (0x7<<28)
142 typedef struct {
143 /* IN variables. */
144 unsigned long pfn; /* Machine page frame number to query. */
145 domid_t domain; /* To which domain does the frame belong? */
146 /* OUT variables. */
147 /* Is the page PINNED to a type? */
148 uint32_t type; /* see above type defs */
149 } dom0_getpageframeinfo_t;
151 /*
152 * Read console content from Xen buffer ring.
153 */
154 #define DOM0_READCONSOLE 19
155 typedef struct {
156 /* IN variables. */
157 uint32_t clear; /* Non-zero -> clear after reading. */
158 /* IN/OUT variables. */
159 char *buffer; /* In: Buffer start; Out: Used buffer start */
160 uint32_t count; /* In: Buffer size; Out: Used buffer size */
161 } dom0_readconsole_t;
163 /*
164 * Set which physical cpus a vcpu can execute on.
165 */
166 #define DOM0_SETVCPUAFFINITY 20
167 typedef struct {
168 /* IN variables. */
169 domid_t domain;
170 uint32_t vcpu;
171 cpumap_t cpumap;
172 } dom0_setvcpuaffinity_t;
174 /* Get trace buffers machine base address */
175 #define DOM0_TBUFCONTROL 21
176 typedef struct {
177 /* IN variables */
178 #define DOM0_TBUF_GET_INFO 0
179 #define DOM0_TBUF_SET_CPU_MASK 1
180 #define DOM0_TBUF_SET_EVT_MASK 2
181 #define DOM0_TBUF_SET_SIZE 3
182 #define DOM0_TBUF_ENABLE 4
183 #define DOM0_TBUF_DISABLE 5
184 uint32_t op;
185 /* IN/OUT variables */
186 cpumap_t cpu_mask;
187 uint32_t evt_mask;
188 /* OUT variables */
189 unsigned long buffer_mfn;
190 uint32_t size;
191 } dom0_tbufcontrol_t;
193 /*
194 * Get physical information about the host machine
195 */
196 #define DOM0_PHYSINFO 22
197 typedef struct {
198 uint32_t threads_per_core;
199 uint32_t cores_per_socket;
200 uint32_t sockets_per_node;
201 uint32_t nr_nodes;
202 uint32_t cpu_khz;
203 unsigned long total_pages;
204 unsigned long free_pages;
205 uint32_t hw_cap[8];
206 } dom0_physinfo_t;
208 /*
209 * Get the ID of the current scheduler.
210 */
211 #define DOM0_SCHED_ID 24
212 typedef struct {
213 /* OUT variable */
214 uint32_t sched_id;
215 } dom0_sched_id_t;
217 /*
218 * Control shadow pagetables operation
219 */
220 #define DOM0_SHADOW_CONTROL 25
222 #define DOM0_SHADOW_CONTROL_OP_OFF 0
223 #define DOM0_SHADOW_CONTROL_OP_ENABLE_TEST 1
224 #define DOM0_SHADOW_CONTROL_OP_ENABLE_LOGDIRTY 2
225 #define DOM0_SHADOW_CONTROL_OP_ENABLE_TRANSLATE 3
227 #define DOM0_SHADOW_CONTROL_OP_FLUSH 10 /* table ops */
228 #define DOM0_SHADOW_CONTROL_OP_CLEAN 11
229 #define DOM0_SHADOW_CONTROL_OP_PEEK 12
231 typedef struct dom0_shadow_control
232 {
233 uint32_t fault_count;
234 uint32_t dirty_count;
235 uint32_t dirty_net_count;
236 uint32_t dirty_block_count;
237 } dom0_shadow_control_stats_t;
239 typedef struct {
240 /* IN variables. */
241 domid_t domain;
242 uint32_t op;
243 unsigned long *dirty_bitmap; /* pointer to locked buffer */
244 /* IN/OUT variables. */
245 unsigned long pages; /* size of buffer, updated with actual size */
246 /* OUT variables. */
247 dom0_shadow_control_stats_t stats;
248 } dom0_shadow_control_t;
250 #define DOM0_SETDOMAINMAXMEM 28
251 typedef struct {
252 /* IN variables. */
253 domid_t domain;
254 unsigned long max_memkb;
255 } dom0_setdomainmaxmem_t;
257 #define DOM0_GETPAGEFRAMEINFO2 29 /* batched interface */
258 typedef struct {
259 /* IN variables. */
260 domid_t domain;
261 unsigned long num;
262 /* IN/OUT variables. */
263 unsigned long *array;
264 } dom0_getpageframeinfo2_t;
266 /*
267 * Request memory range (@pfn, @pfn+@nr_pfns-1) to have type @type.
268 * On x86, @type is an architecture-defined MTRR memory type.
269 * On success, returns the MTRR that was used (@reg) and a handle that can
270 * be passed to DOM0_DEL_MEMTYPE to accurately tear down the new setting.
271 * (x86-specific).
272 */
273 #define DOM0_ADD_MEMTYPE 31
274 typedef struct {
275 /* IN variables. */
276 unsigned long pfn;
277 unsigned long nr_pfns;
278 uint32_t type;
279 /* OUT variables. */
280 uint32_t handle;
281 uint32_t reg;
282 } dom0_add_memtype_t;
284 /*
285 * Tear down an existing memory-range type. If @handle is remembered then it
286 * should be passed in to accurately tear down the correct setting (in case
287 * of overlapping memory regions with differing types). If it is not known
288 * then @handle should be set to zero. In all cases @reg must be set.
289 * (x86-specific).
290 */
291 #define DOM0_DEL_MEMTYPE 32
292 typedef struct {
293 /* IN variables. */
294 uint32_t handle;
295 uint32_t reg;
296 } dom0_del_memtype_t;
298 /* Read current type of an MTRR (x86-specific). */
299 #define DOM0_READ_MEMTYPE 33
300 typedef struct {
301 /* IN variables. */
302 uint32_t reg;
303 /* OUT variables. */
304 unsigned long pfn;
305 unsigned long nr_pfns;
306 uint32_t type;
307 } dom0_read_memtype_t;
309 /* Interface for controlling Xen software performance counters. */
310 #define DOM0_PERFCCONTROL 34
311 /* Sub-operations: */
312 #define DOM0_PERFCCONTROL_OP_RESET 1 /* Reset all counters to zero. */
313 #define DOM0_PERFCCONTROL_OP_QUERY 2 /* Get perfctr information. */
314 typedef struct {
315 uint8_t name[80]; /* name of perf counter */
316 uint32_t nr_vals; /* number of values for this counter */
317 uint32_t vals[64]; /* array of values */
318 } dom0_perfc_desc_t;
319 typedef struct {
320 /* IN variables. */
321 uint32_t op; /* DOM0_PERFCCONTROL_OP_??? */
322 /* OUT variables. */
323 uint32_t nr_counters; /* number of counters */
324 dom0_perfc_desc_t *desc; /* counter information (or NULL) */
325 } dom0_perfccontrol_t;
327 #define DOM0_MICROCODE 35
328 typedef struct {
329 /* IN variables. */
330 void *data; /* Pointer to microcode data */
331 uint32_t length; /* Length of microcode data. */
332 } dom0_microcode_t;
334 #define DOM0_IOPORT_PERMISSION 36
335 typedef struct {
336 domid_t domain; /* domain to be affected */
337 uint32_t first_port; /* first port int range */
338 uint32_t nr_ports; /* size of port range */
339 uint8_t allow_access; /* allow or deny access to range? */
340 } dom0_ioport_permission_t;
342 #define DOM0_GETVCPUCONTEXT 37
343 typedef struct {
344 /* IN variables. */
345 domid_t domain; /* domain to be affected */
346 uint32_t vcpu; /* vcpu # */
347 /* OUT variables. */
348 vcpu_guest_context_t *ctxt;
349 } dom0_getvcpucontext_t;
351 #define DOM0_GETVCPUINFO 43
352 typedef struct {
353 /* IN variables. */
354 domid_t domain; /* domain to be affected */
355 uint32_t vcpu; /* vcpu # */
356 /* OUT variables. */
357 uint8_t online; /* currently online (not hotplugged)? */
358 uint8_t blocked; /* blocked waiting for an event? */
359 uint8_t running; /* currently scheduled on its CPU? */
360 uint64_t cpu_time; /* total cpu time consumed (ns) */
361 uint32_t cpu; /* current mapping */
362 cpumap_t cpumap; /* allowable mapping */
363 } dom0_getvcpuinfo_t;
365 #define DOM0_GETDOMAININFOLIST 38
366 typedef struct {
367 /* IN variables. */
368 domid_t first_domain;
369 uint32_t max_domains;
370 dom0_getdomaininfo_t *buffer;
371 /* OUT variables. */
372 uint32_t num_domains;
373 } dom0_getdomaininfolist_t;
375 #define DOM0_PLATFORM_QUIRK 39
376 #define QUIRK_NOIRQBALANCING 1
377 typedef struct {
378 /* IN variables. */
379 uint32_t quirk_id;
380 } dom0_platform_quirk_t;
382 #define DOM0_PHYSICAL_MEMORY_MAP 40
383 typedef struct {
384 /* IN variables. */
385 uint32_t max_map_entries;
386 /* OUT variables. */
387 uint32_t nr_map_entries;
388 struct dom0_memory_map_entry {
389 uint64_t start, end;
390 uint32_t flags; /* reserved */
391 uint8_t is_ram;
392 } *memory_map;
393 } dom0_physical_memory_map_t;
395 #define DOM0_MAX_VCPUS 41
396 typedef struct {
397 domid_t domain; /* domain to be affected */
398 uint32_t max; /* maximum number of vcpus */
399 } dom0_max_vcpus_t;
401 #define DOM0_SETDOMAINHANDLE 44
402 typedef struct {
403 domid_t domain;
404 xen_domain_handle_t handle;
405 } dom0_setdomainhandle_t;
407 #define DOM0_SETDEBUGGING 45
408 typedef struct {
409 domid_t domain;
410 uint8_t enable;
411 } dom0_setdebugging_t;
413 #define DOM0_IRQ_PERMISSION 46
414 typedef struct {
415 domid_t domain; /* domain to be affected */
416 uint8_t pirq;
417 uint8_t allow_access; /* flag to specify enable/disable of IRQ access */
418 } dom0_irq_permission_t;
420 #define DOM0_IOMEM_PERMISSION 47
421 typedef struct {
422 domid_t domain; /* domain to be affected */
423 unsigned long first_pfn; /* first page (physical page number) in range */
424 unsigned long nr_pfns; /* number of pages in range (>0) */
425 uint8_t allow_access; /* allow (!0) or deny (0) access to range? */
426 } dom0_iomem_permission_t;
428 #define DOM0_HYPERCALL_INIT 48
429 typedef struct {
430 domid_t domain; /* domain to be affected */
431 unsigned long mfn; /* machine frame to be initialised */
432 } dom0_hypercall_init_t;
434 typedef struct {
435 uint32_t cmd;
436 uint32_t interface_version; /* DOM0_INTERFACE_VERSION */
437 union {
438 dom0_createdomain_t createdomain;
439 dom0_pausedomain_t pausedomain;
440 dom0_unpausedomain_t unpausedomain;
441 dom0_destroydomain_t destroydomain;
442 dom0_getmemlist_t getmemlist;
443 dom0_schedctl_t schedctl;
444 dom0_adjustdom_t adjustdom;
445 dom0_setvcpucontext_t setvcpucontext;
446 dom0_getdomaininfo_t getdomaininfo;
447 dom0_getpageframeinfo_t getpageframeinfo;
448 dom0_msr_t msr;
449 dom0_settime_t settime;
450 dom0_readconsole_t readconsole;
451 dom0_setvcpuaffinity_t setvcpuaffinity;
452 dom0_tbufcontrol_t tbufcontrol;
453 dom0_physinfo_t physinfo;
454 dom0_sched_id_t sched_id;
455 dom0_shadow_control_t shadow_control;
456 dom0_setdomainmaxmem_t setdomainmaxmem;
457 dom0_getpageframeinfo2_t getpageframeinfo2;
458 dom0_add_memtype_t add_memtype;
459 dom0_del_memtype_t del_memtype;
460 dom0_read_memtype_t read_memtype;
461 dom0_perfccontrol_t perfccontrol;
462 dom0_microcode_t microcode;
463 dom0_ioport_permission_t ioport_permission;
464 dom0_getvcpucontext_t getvcpucontext;
465 dom0_getvcpuinfo_t getvcpuinfo;
466 dom0_getdomaininfolist_t getdomaininfolist;
467 dom0_platform_quirk_t platform_quirk;
468 dom0_physical_memory_map_t physical_memory_map;
469 dom0_max_vcpus_t max_vcpus;
470 dom0_setdomainhandle_t setdomainhandle;
471 dom0_setdebugging_t setdebugging;
472 dom0_irq_permission_t irq_permission;
473 dom0_iomem_permission_t iomem_permission;
474 dom0_hypercall_init_t hypercall_init;
475 uint8_t pad[128];
476 } u;
477 } dom0_op_t;
479 #endif /* __XEN_PUBLIC_DOM0_OPS_H__ */
481 /*
482 * Local variables:
483 * mode: C
484 * c-set-style: "BSD"
485 * c-basic-offset: 4
486 * tab-width: 4
487 * indent-tabs-mode: nil
488 * End:
489 */