win-pvdrivers

view common/include/public/xen.h @ 1054:471c94d04d8a

Refactoring to support xencache (tmem)
author James Harper <james.harper@bendigoit.com.au>
date Sun Jun 02 16:37:21 2013 +1000 (2013-06-02)
parents 52da65ad3f0c
children
line source
1 /******************************************************************************
2 * xen.h
3 *
4 * Guest OS interface to Xen.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to
8 * deal in the Software without restriction, including without limitation the
9 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10 * sell copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
23 *
24 * Copyright (c) 2004, K A Fraser
25 */
27 #ifndef __XEN_PUBLIC_XEN_H__
28 #define __XEN_PUBLIC_XEN_H__
30 #include "xen-compat.h"
32 #if defined(__i386__) || defined(__x86_64__)
33 #include "arch-x86/xen.h"
34 #elif defined(__ia64__)
35 #include "arch-ia64.h"
36 #elif defined(__powerpc__)
37 #include "arch-powerpc.h"
38 #else
39 #error "Unsupported architecture"
40 #endif
42 /*
43 * HYPERCALLS
44 */
46 #define __HYPERVISOR_set_trap_table 0
47 #define __HYPERVISOR_mmu_update 1
48 #define __HYPERVISOR_set_gdt 2
49 #define __HYPERVISOR_stack_switch 3
50 #define __HYPERVISOR_set_callbacks 4
51 #define __HYPERVISOR_fpu_taskswitch 5
52 #define __HYPERVISOR_sched_op_compat 6 /* compat since 0x00030101 */
53 #define __HYPERVISOR_platform_op 7
54 #define __HYPERVISOR_set_debugreg 8
55 #define __HYPERVISOR_get_debugreg 9
56 #define __HYPERVISOR_update_descriptor 10
57 #define __HYPERVISOR_memory_op 12
58 #define __HYPERVISOR_multicall 13
59 #define __HYPERVISOR_update_va_mapping 14
60 #define __HYPERVISOR_set_timer_op 15
61 #define __HYPERVISOR_event_channel_op_compat 16 /* compat since 0x00030202 */
62 #define __HYPERVISOR_xen_version 17
63 #define __HYPERVISOR_console_io 18
64 #define __HYPERVISOR_physdev_op_compat 19 /* compat since 0x00030202 */
65 #define __HYPERVISOR_grant_table_op 20
66 #define __HYPERVISOR_vm_assist 21
67 #define __HYPERVISOR_update_va_mapping_otherdomain 22
68 #define __HYPERVISOR_iret 23 /* x86 only */
69 #define __HYPERVISOR_vcpu_op 24
70 #define __HYPERVISOR_set_segment_base 25 /* x86/64 only */
71 #define __HYPERVISOR_mmuext_op 26
72 #define __HYPERVISOR_acm_op 27
73 #define __HYPERVISOR_nmi_op 28
74 #define __HYPERVISOR_sched_op 29
75 #define __HYPERVISOR_callback_op 30
76 #define __HYPERVISOR_xenoprof_op 31
77 #define __HYPERVISOR_event_channel_op 32
78 #define __HYPERVISOR_physdev_op 33
79 #define __HYPERVISOR_hvm_op 34
80 #define __HYPERVISOR_sysctl 35
81 #define __HYPERVISOR_domctl 36
82 #define __HYPERVISOR_kexec_op 37
83 #define __HYPERVISOR_tmem_op 38
85 /* Architecture-specific hypercall definitions. */
86 #define __HYPERVISOR_arch_0 48
87 #define __HYPERVISOR_arch_1 49
88 #define __HYPERVISOR_arch_2 50
89 #define __HYPERVISOR_arch_3 51
90 #define __HYPERVISOR_arch_4 52
91 #define __HYPERVISOR_arch_5 53
92 #define __HYPERVISOR_arch_6 54
93 #define __HYPERVISOR_arch_7 55
95 /*
96 * HYPERCALL COMPATIBILITY.
97 */
99 /* New sched_op hypercall introduced in 0x00030101. */
100 #if __XEN_INTERFACE_VERSION__ < 0x00030101
101 #undef __HYPERVISOR_sched_op
102 #define __HYPERVISOR_sched_op __HYPERVISOR_sched_op_compat
103 #endif
105 /* New event-channel and physdev hypercalls introduced in 0x00030202. */
106 #if __XEN_INTERFACE_VERSION__ < 0x00030202
107 #undef __HYPERVISOR_event_channel_op
108 #define __HYPERVISOR_event_channel_op __HYPERVISOR_event_channel_op_compat
109 #undef __HYPERVISOR_physdev_op
110 #define __HYPERVISOR_physdev_op __HYPERVISOR_physdev_op_compat
111 #endif
113 /* New platform_op hypercall introduced in 0x00030204. */
114 #if __XEN_INTERFACE_VERSION__ < 0x00030204
115 #define __HYPERVISOR_dom0_op __HYPERVISOR_platform_op
116 #endif
118 /*
119 * VIRTUAL INTERRUPTS
120 *
121 * Virtual interrupts that a guest OS may receive from Xen.
122 *
123 * In the side comments, 'V.' denotes a per-VCPU VIRQ while 'G.' denotes a
124 * global VIRQ. The former can be bound once per VCPU and cannot be re-bound.
125 * The latter can be allocated only once per guest: they must initially be
126 * allocated to VCPU0 but can subsequently be re-bound.
127 */
128 #define VIRQ_TIMER 0 /* V. Timebase update, and/or requested timeout. */
129 #define VIRQ_DEBUG 1 /* V. Request guest to dump debug info. */
130 #define VIRQ_CONSOLE 2 /* G. (DOM0) Bytes received on emergency console. */
131 #define VIRQ_DOM_EXC 3 /* G. (DOM0) Exceptional event for some domain. */
132 #define VIRQ_TBUF 4 /* G. (DOM0) Trace buffer has records available. */
133 #define VIRQ_DEBUGGER 6 /* G. (DOM0) A domain has paused for debugging. */
134 #define VIRQ_XENOPROF 7 /* V. XenOprofile interrupt: new sample available */
135 #define VIRQ_CON_RING 8 /* G. (DOM0) Bytes received on console */
137 /* Architecture-specific VIRQ definitions. */
138 #define VIRQ_ARCH_0 16
139 #define VIRQ_ARCH_1 17
140 #define VIRQ_ARCH_2 18
141 #define VIRQ_ARCH_3 19
142 #define VIRQ_ARCH_4 20
143 #define VIRQ_ARCH_5 21
144 #define VIRQ_ARCH_6 22
145 #define VIRQ_ARCH_7 23
147 #define NR_VIRQS 24
149 /*
150 * MMU-UPDATE REQUESTS
151 *
152 * HYPERVISOR_mmu_update() accepts a list of (ptr, val) pairs.
153 * A foreigndom (FD) can be specified (or DOMID_SELF for none).
154 * Where the FD has some effect, it is described below.
155 * ptr[1:0] specifies the appropriate MMU_* command.
156 *
157 * ptr[1:0] == MMU_NORMAL_PT_UPDATE:
158 * Updates an entry in a page table. If updating an L1 table, and the new
159 * table entry is valid/present, the mapped frame must belong to the FD, if
160 * an FD has been specified. If attempting to map an I/O page then the
161 * caller assumes the privilege of the FD.
162 * FD == DOMID_IO: Permit /only/ I/O mappings, at the priv level of the caller.
163 * FD == DOMID_XEN: Map restricted areas of Xen's heap space.
164 * ptr[:2] -- Machine address of the page-table entry to modify.
165 * val -- Value to write.
166 *
167 * ptr[1:0] == MMU_MACHPHYS_UPDATE:
168 * Updates an entry in the machine->pseudo-physical mapping table.
169 * ptr[:2] -- Machine address within the frame whose mapping to modify.
170 * The frame must belong to the FD, if one is specified.
171 * val -- Value to write into the mapping entry.
172 */
173 #define MMU_NORMAL_PT_UPDATE 0 /* checked '*ptr = val'. ptr is MA. */
174 #define MMU_MACHPHYS_UPDATE 1 /* ptr = MA of frame to modify entry for */
176 /*
177 * MMU EXTENDED OPERATIONS
178 *
179 * HYPERVISOR_mmuext_op() accepts a list of mmuext_op structures.
180 * A foreigndom (FD) can be specified (or DOMID_SELF for none).
181 * Where the FD has some effect, it is described below.
182 *
183 * cmd: MMUEXT_(UN)PIN_*_TABLE
184 * mfn: Machine frame number to be (un)pinned as a p.t. page.
185 * The frame must belong to the FD, if one is specified.
186 *
187 * cmd: MMUEXT_NEW_BASEPTR
188 * mfn: Machine frame number of new page-table base to install in MMU.
189 *
190 * cmd: MMUEXT_NEW_USER_BASEPTR [x86/64 only]
191 * mfn: Machine frame number of new page-table base to install in MMU
192 * when in user space.
193 *
194 * cmd: MMUEXT_TLB_FLUSH_LOCAL
195 * No additional arguments. Flushes local TLB.
196 *
197 * cmd: MMUEXT_INVLPG_LOCAL
198 * linear_addr: Linear address to be flushed from the local TLB.
199 *
200 * cmd: MMUEXT_TLB_FLUSH_MULTI
201 * vcpumask: Pointer to bitmap of VCPUs to be flushed.
202 *
203 * cmd: MMUEXT_INVLPG_MULTI
204 * linear_addr: Linear address to be flushed.
205 * vcpumask: Pointer to bitmap of VCPUs to be flushed.
206 *
207 * cmd: MMUEXT_TLB_FLUSH_ALL
208 * No additional arguments. Flushes all VCPUs' TLBs.
209 *
210 * cmd: MMUEXT_INVLPG_ALL
211 * linear_addr: Linear address to be flushed from all VCPUs' TLBs.
212 *
213 * cmd: MMUEXT_FLUSH_CACHE
214 * No additional arguments. Writes back and flushes cache contents.
215 *
216 * cmd: MMUEXT_SET_LDT
217 * linear_addr: Linear address of LDT base (NB. must be page-aligned).
218 * nr_ents: Number of entries in LDT.
219 */
220 #define MMUEXT_PIN_L1_TABLE 0
221 #define MMUEXT_PIN_L2_TABLE 1
222 #define MMUEXT_PIN_L3_TABLE 2
223 #define MMUEXT_PIN_L4_TABLE 3
224 #define MMUEXT_UNPIN_TABLE 4
225 #define MMUEXT_NEW_BASEPTR 5
226 #define MMUEXT_TLB_FLUSH_LOCAL 6
227 #define MMUEXT_INVLPG_LOCAL 7
228 #define MMUEXT_TLB_FLUSH_MULTI 8
229 #define MMUEXT_INVLPG_MULTI 9
230 #define MMUEXT_TLB_FLUSH_ALL 10
231 #define MMUEXT_INVLPG_ALL 11
232 #define MMUEXT_FLUSH_CACHE 12
233 #define MMUEXT_SET_LDT 13
234 #define MMUEXT_NEW_USER_BASEPTR 15
236 #ifndef __ASSEMBLY__
237 struct mmuext_op {
238 unsigned int cmd;
239 union {
240 /* [UN]PIN_TABLE, NEW_BASEPTR, NEW_USER_BASEPTR */
241 xen_pfn_t mfn;
242 /* INVLPG_LOCAL, INVLPG_ALL, SET_LDT */
243 xen_ulong_t linear_addr;
244 } arg1;
245 union {
246 /* SET_LDT */
247 unsigned int nr_ents;
248 /* TLB_FLUSH_MULTI, INVLPG_MULTI */
249 XEN_GUEST_HANDLE_00030205(void) vcpumask;
250 } arg2;
251 };
252 typedef struct mmuext_op mmuext_op_t;
253 DEFINE_XEN_GUEST_HANDLE(mmuext_op_t);
254 #endif
256 /* These are passed as 'flags' to update_va_mapping. They can be ORed. */
257 /* When specifying UVMF_MULTI, also OR in a pointer to a CPU bitmap. */
258 /* UVMF_LOCAL is merely UVMF_MULTI with a NULL bitmap pointer. */
259 #define UVMF_NONE (0UL<<0) /* No flushing at all. */
260 #define UVMF_TLB_FLUSH (1UL<<0) /* Flush entire TLB(s). */
261 #define UVMF_INVLPG (2UL<<0) /* Flush only one entry. */
262 #define UVMF_FLUSHTYPE_MASK (3UL<<0)
263 #define UVMF_MULTI (0UL<<2) /* Flush subset of TLBs. */
264 #define UVMF_LOCAL (0UL<<2) /* Flush local TLB. */
265 #define UVMF_ALL (1UL<<2) /* Flush all TLBs. */
267 /*
268 * Commands to HYPERVISOR_console_io().
269 */
270 #define CONSOLEIO_write 0
271 #define CONSOLEIO_read 1
273 /*
274 * Commands to HYPERVISOR_vm_assist().
275 */
276 #define VMASST_CMD_enable 0
277 #define VMASST_CMD_disable 1
279 /* x86/32 guests: simulate full 4GB segment limits. */
280 #define VMASST_TYPE_4gb_segments 0
282 /* x86/32 guests: trap (vector 15) whenever above vmassist is used. */
283 #define VMASST_TYPE_4gb_segments_notify 1
285 /*
286 * x86 guests: support writes to bottom-level PTEs.
287 * NB1. Page-directory entries cannot be written.
288 * NB2. Guest must continue to remove all writable mappings of PTEs.
289 */
290 #define VMASST_TYPE_writable_pagetables 2
292 /* x86/PAE guests: support PDPTs above 4GB. */
293 #define VMASST_TYPE_pae_extended_cr3 3
295 #define MAX_VMASST_TYPE 3
297 #ifndef __ASSEMBLY__
299 typedef uint16_t domid_t;
301 /* Domain ids >= DOMID_FIRST_RESERVED cannot be used for ordinary domains. */
302 #define DOMID_FIRST_RESERVED (0x7FF0U)
304 /* DOMID_SELF is used in certain contexts to refer to oneself. */
305 #define DOMID_SELF (0x7FF0U)
307 /*
308 * DOMID_IO is used to restrict page-table updates to mapping I/O memory.
309 * Although no Foreign Domain need be specified to map I/O pages, DOMID_IO
310 * is useful to ensure that no mappings to the OS's own heap are accidentally
311 * installed. (e.g., in Linux this could cause havoc as reference counts
312 * aren't adjusted on the I/O-mapping code path).
313 * This only makes sense in MMUEXT_SET_FOREIGNDOM, but in that context can
314 * be specified by any calling domain.
315 */
316 #define DOMID_IO (0x7FF1U)
318 /*
319 * DOMID_XEN is used to allow privileged domains to map restricted parts of
320 * Xen's heap space (e.g., the machine_to_phys table).
321 * This only makes sense in MMUEXT_SET_FOREIGNDOM, and is only permitted if
322 * the caller is privileged.
323 */
324 #define DOMID_XEN (0x7FF2U)
326 /*
327 * Send an array of these to HYPERVISOR_mmu_update().
328 * NB. The fields are natural pointer/address size for this architecture.
329 */
330 struct mmu_update {
331 uint64_t ptr; /* Machine address of PTE. */
332 uint64_t val; /* New contents of PTE. */
333 };
334 typedef struct mmu_update mmu_update_t;
335 DEFINE_XEN_GUEST_HANDLE(mmu_update_t);
337 /*
338 * Send an array of these to HYPERVISOR_multicall().
339 * NB. The fields are natural register size for this architecture.
340 */
341 struct multicall_entry {
342 xen_ulong_t op, result;
343 xen_ulong_t args[6];
344 };
345 typedef struct multicall_entry multicall_entry_t;
346 DEFINE_XEN_GUEST_HANDLE(multicall_entry_t);
348 /*
349 * Event channel endpoints per domain:
350 * 1024 if a long is 32 bits; 4096 if a long is 64 bits.
351 */
352 #define NR_EVENT_CHANNELS (sizeof(xen_ulong_t) * sizeof(xen_ulong_t) * 64)
354 struct vcpu_time_info {
355 /*
356 * Updates to the following values are preceded and followed by an
357 * increment of 'version'. The guest can therefore detect updates by
358 * looking for changes to 'version'. If the least-significant bit of
359 * the version number is set then an update is in progress and the guest
360 * must wait to read a consistent set of values.
361 * The correct way to interact with the version number is similar to
362 * Linux's seqlock: see the implementations of read_seqbegin/read_seqretry.
363 */
364 uint32_t version;
365 uint32_t pad0;
366 uint64_t tsc_timestamp; /* TSC at last update of time vals. */
367 uint64_t system_time; /* Time, in nanosecs, since boot. */
368 /*
369 * Current system time:
370 * system_time +
371 * ((((tsc - tsc_timestamp) << tsc_shift) * tsc_to_system_mul) >> 32)
372 * CPU frequency (Hz):
373 * ((10^9 << 32) / tsc_to_system_mul) >> tsc_shift
374 */
375 uint32_t tsc_to_system_mul;
376 int8_t tsc_shift;
377 int8_t pad1[3];
378 }; /* 32 bytes */
379 typedef struct vcpu_time_info vcpu_time_info_t;
381 struct vcpu_info {
382 /*
383 * 'evtchn_upcall_pending' is written non-zero by Xen to indicate
384 * a pending notification for a particular VCPU. It is then cleared
385 * by the guest OS /before/ checking for pending work, thus avoiding
386 * a set-and-check race. Note that the mask is only accessed by Xen
387 * on the CPU that is currently hosting the VCPU. This means that the
388 * pending and mask flags can be updated by the guest without special
389 * synchronisation (i.e., no need for the x86 LOCK prefix).
390 * This may seem suboptimal because if the pending flag is set by
391 * a different CPU then an IPI may be scheduled even when the mask
392 * is set. However, note:
393 * 1. The task of 'interrupt holdoff' is covered by the per-event-
394 * channel mask bits. A 'noisy' event that is continually being
395 * triggered can be masked at source at this very precise
396 * granularity.
397 * 2. The main purpose of the per-VCPU mask is therefore to restrict
398 * reentrant execution: whether for concurrency control, or to
399 * prevent unbounded stack usage. Whatever the purpose, we expect
400 * that the mask will be asserted only for short periods at a time,
401 * and so the likelihood of a 'spurious' IPI is suitably small.
402 * The mask is read before making an event upcall to the guest: a
403 * non-zero mask therefore guarantees that the VCPU will not receive
404 * an upcall activation. The mask is cleared when the VCPU requests
405 * to block: this avoids wakeup-waiting races.
406 */
407 uint8_t evtchn_upcall_pending;
408 uint8_t evtchn_upcall_mask;
409 xen_ulong_t evtchn_pending_sel;
410 #if !defined(__ia64__)
411 struct arch_vcpu_info arch;
412 #endif
413 struct vcpu_time_info time;
414 }; /* 64 bytes (x86) */
415 #ifndef __XEN__
416 typedef struct vcpu_info vcpu_info_t;
417 #endif
419 /*
420 * Xen/kernel shared data -- pointer provided in start_info.
421 *
422 * This structure is defined to be both smaller than a page, and the
423 * only data on the shared page, but may vary in actual size even within
424 * compatible Xen versions; guests should not rely on the size
425 * of this structure remaining constant.
426 */
427 struct shared_info {
428 struct vcpu_info vcpu_info[MAX_VIRT_CPUS];
430 /*
431 * A domain can create "event channels" on which it can send and receive
432 * asynchronous event notifications. There are three classes of event that
433 * are delivered by this mechanism:
434 * 1. Bi-directional inter- and intra-domain connections. Domains must
435 * arrange out-of-band to set up a connection (usually by allocating
436 * an unbound 'listener' port and avertising that via a storage service
437 * such as xenstore).
438 * 2. Physical interrupts. A domain with suitable hardware-access
439 * privileges can bind an event-channel port to a physical interrupt
440 * source.
441 * 3. Virtual interrupts ('events'). A domain can bind an event-channel
442 * port to a virtual interrupt source, such as the virtual-timer
443 * device or the emergency console.
444 *
445 * Event channels are addressed by a "port index". Each channel is
446 * associated with two bits of information:
447 * 1. PENDING -- notifies the domain that there is a pending notification
448 * to be processed. This bit is cleared by the guest.
449 * 2. MASK -- if this bit is clear then a 0->1 transition of PENDING
450 * will cause an asynchronous upcall to be scheduled. This bit is only
451 * updated by the guest. It is read-only within Xen. If a channel
452 * becomes pending while the channel is masked then the 'edge' is lost
453 * (i.e., when the channel is unmasked, the guest must manually handle
454 * pending notifications as no upcall will be scheduled by Xen).
455 *
456 * To expedite scanning of pending notifications, any 0->1 pending
457 * transition on an unmasked channel causes a corresponding bit in a
458 * per-vcpu selector word to be set. Each bit in the selector covers a
459 * 'C long' in the PENDING bitfield array.
460 */
461 xen_ulong_t evtchn_pending[sizeof(xen_ulong_t) * 8];
462 xen_ulong_t evtchn_mask[sizeof(xen_ulong_t) * 8];
464 /*
465 * Wallclock time: updated only by control software. Guests should base
466 * their gettimeofday() syscall on this wallclock-base value.
467 */
468 uint32_t wc_version; /* Version counter: see vcpu_time_info_t. */
469 uint32_t wc_sec; /* Secs 00:00:00 UTC, Jan 1, 1970. */
470 uint32_t wc_nsec; /* Nsecs 00:00:00 UTC, Jan 1, 1970. */
472 struct arch_shared_info arch;
474 };
475 #ifndef __XEN__
476 typedef struct shared_info shared_info_t;
477 #endif
479 /*
480 * Start-of-day memory layout:
481 * 1. The domain is started within contiguous virtual-memory region.
482 * 2. The contiguous region ends on an aligned 4MB boundary.
483 * 3. This the order of bootstrap elements in the initial virtual region:
484 * a. relocated kernel image
485 * b. initial ram disk [mod_start, mod_len]
486 * c. list of allocated page frames [mfn_list, nr_pages]
487 * d. start_info_t structure [register ESI (x86)]
488 * e. bootstrap page tables [pt_base, CR3 (x86)]
489 * f. bootstrap stack [register ESP (x86)]
490 * 4. Bootstrap elements are packed together, but each is 4kB-aligned.
491 * 5. The initial ram disk may be omitted.
492 * 6. The list of page frames forms a contiguous 'pseudo-physical' memory
493 * layout for the domain. In particular, the bootstrap virtual-memory
494 * region is a 1:1 mapping to the first section of the pseudo-physical map.
495 * 7. All bootstrap elements are mapped read-writable for the guest OS. The
496 * only exception is the bootstrap page table, which is mapped read-only.
497 * 8. There is guaranteed to be at least 512kB padding after the final
498 * bootstrap element. If necessary, the bootstrap virtual region is
499 * extended by an extra 4MB to ensure this.
500 */
502 #define MAX_GUEST_CMDLINE 1024
503 struct start_info {
504 /* THE FOLLOWING ARE FILLED IN BOTH ON INITIAL BOOT AND ON RESUME. */
505 char magic[32]; /* "xen-<version>-<platform>". */
506 xen_ulong_t nr_pages; /* Total pages allocated to this domain. */
507 xen_ulong_t shared_info; /* MACHINE address of shared info struct. */
508 uint32_t flags; /* SIF_xxx flags. */
509 xen_pfn_t store_mfn; /* MACHINE page number of shared page. */
510 uint32_t store_evtchn; /* Event channel for store communication. */
511 union {
512 struct {
513 xen_pfn_t mfn; /* MACHINE page number of console page. */
514 uint32_t evtchn; /* Event channel for console page. */
515 } domU;
516 struct {
517 uint32_t info_off; /* Offset of console_info struct. */
518 uint32_t info_size; /* Size of console_info struct from start.*/
519 } dom0;
520 } console;
521 /* THE FOLLOWING ARE ONLY FILLED IN ON INITIAL BOOT (NOT RESUME). */
522 xen_ulong_t pt_base; /* VIRTUAL address of page directory. */
523 xen_ulong_t nr_pt_frames; /* Number of bootstrap p.t. frames. */
524 xen_ulong_t mfn_list; /* VIRTUAL address of page-frame list. */
525 xen_ulong_t mod_start; /* VIRTUAL address of pre-loaded module. */
526 xen_ulong_t mod_len; /* Size (bytes) of pre-loaded module. */
527 int8_t cmd_line[MAX_GUEST_CMDLINE];
528 };
529 typedef struct start_info start_info_t;
531 /* New console union for dom0 introduced in 0x00030203. */
532 #if __XEN_INTERFACE_VERSION__ < 0x00030203
533 #define console_mfn console.domU.mfn
534 #define console_evtchn console.domU.evtchn
535 #endif
537 /* These flags are passed in the 'flags' field of start_info_t. */
538 #define SIF_PRIVILEGED (1<<0) /* Is the domain privileged? */
539 #define SIF_INITDOMAIN (1<<1) /* Is this the initial control domain? */
541 typedef struct dom0_vga_console_info {
542 uint8_t video_type; /* DOM0_VGA_CONSOLE_??? */
543 #define XEN_VGATYPE_TEXT_MODE_3 0x03
544 #define XEN_VGATYPE_VESA_LFB 0x23
546 union {
547 struct {
548 /* Font height, in pixels. */
549 uint16_t font_height;
550 /* Cursor location (column, row). */
551 uint16_t cursor_x, cursor_y;
552 /* Number of rows and columns (dimensions in characters). */
553 uint16_t rows, columns;
554 } text_mode_3;
556 struct {
557 /* Width and height, in pixels. */
558 uint16_t width, height;
559 /* Bytes per scan line. */
560 uint16_t bytes_per_line;
561 /* Bits per pixel. */
562 uint16_t bits_per_pixel;
563 /* LFB physical address, and size (in units of 64kB). */
564 uint32_t lfb_base;
565 uint32_t lfb_size;
566 /* RGB mask offsets and sizes, as defined by VBE 1.2+ */
567 uint8_t red_pos, red_size;
568 uint8_t green_pos, green_size;
569 uint8_t blue_pos, blue_size;
570 uint8_t rsvd_pos, rsvd_size;
571 } vesa_lfb;
572 } u;
573 } dom0_vga_console_info_t;
574 #define xen_vga_console_info dom0_vga_console_info
575 #define xen_vga_console_info_t dom0_vga_console_info_t
577 typedef uint8_t xen_domain_handle_t[16];
579 /* Turn a plain number into a C xen_ulong_t constant. */
580 #define __mk_unsigned_long(x) x ## UL
581 #define mk_unsigned_long(x) __mk_unsigned_long(x)
583 DEFINE_XEN_GUEST_HANDLE(uint8_t);
584 DEFINE_XEN_GUEST_HANDLE(uint16_t);
585 DEFINE_XEN_GUEST_HANDLE(uint32_t);
586 DEFINE_XEN_GUEST_HANDLE(uint64_t);
588 #else /* __ASSEMBLY__ */
590 /* In assembly code we cannot use C numeric constant suffixes. */
591 #define mk_unsigned_long(x) x
593 #endif /* !__ASSEMBLY__ */
595 #define TMEM_SPEC_VERSION 1
597 struct tmem_op {
598 uint32_t cmd;
599 int32_t pool_id;
600 union {
601 struct { /* for cmd == TMEM_NEW_POOL */
602 uint64_t uuid[2];
603 uint32_t flags;
604 } new;
605 struct {
606 uint64_t oid[3];
607 uint32_t index;
608 uint32_t tmem_offset;
609 uint32_t pfn_offset;
610 uint32_t len;
611 XEN_GUEST_HANDLE(void) gmfn; /* guest machine page frame */
612 } gen;
613 } u;
614 };
617 /* Default definitions for macros used by domctl/sysctl. */
618 #if defined(__XEN__) || defined(__XEN_TOOLS__)
619 #ifndef uint64_aligned_t
620 #define uint64_aligned_t uint64_t
621 #endif
622 #ifndef XEN_GUEST_HANDLE_64
623 #define XEN_GUEST_HANDLE_64(name) XEN_GUEST_HANDLE(name)
624 #endif
625 #endif
627 #endif /* __XEN_PUBLIC_XEN_H__ */
629 /*
630 * Local variables:
631 * mode: C
632 * c-set-style: "BSD"
633 * c-basic-offset: 4
634 * tab-width: 4
635 * indent-tabs-mode: nil
636 * End:
637 */