blob: 0801468f9abed879eb1b9b1d52363aaeb979a2ae [file] [log] [blame]
Jeremy Fitzhardingea42089d2007-07-17 18:37:04 -07001/******************************************************************************
2 * xen.h
3 *
4 * Guest OS interface to Xen.
5 *
6 * Copyright (c) 2004, K A Fraser
7 */
8
9#ifndef __XEN_PUBLIC_XEN_H__
10#define __XEN_PUBLIC_XEN_H__
11
12#include <asm/xen/interface.h>
Gerd Hoffmann1c7b67f2008-06-03 16:17:30 +020013#include <asm/pvclock-abi.h>
Jeremy Fitzhardingea42089d2007-07-17 18:37:04 -070014
15/*
16 * XEN "SYSTEM CALLS" (a.k.a. HYPERCALLS).
17 */
18
19/*
20 * x86_32: EAX = vector; EBX, ECX, EDX, ESI, EDI = args 1, 2, 3, 4, 5.
21 * EAX = return value
22 * (argument registers may be clobbered on return)
23 * x86_64: RAX = vector; RDI, RSI, RDX, R10, R8, R9 = args 1, 2, 3, 4, 5, 6.
24 * RAX = return value
25 * (argument registers not clobbered on return; RCX, R11 are)
26 */
27#define __HYPERVISOR_set_trap_table 0
28#define __HYPERVISOR_mmu_update 1
29#define __HYPERVISOR_set_gdt 2
30#define __HYPERVISOR_stack_switch 3
31#define __HYPERVISOR_set_callbacks 4
32#define __HYPERVISOR_fpu_taskswitch 5
Ian Campbella8b74582011-02-17 11:04:20 +000033#define __HYPERVISOR_sched_op_compat 6
Jeremy Fitzhardingea42089d2007-07-17 18:37:04 -070034#define __HYPERVISOR_dom0_op 7
35#define __HYPERVISOR_set_debugreg 8
36#define __HYPERVISOR_get_debugreg 9
37#define __HYPERVISOR_update_descriptor 10
38#define __HYPERVISOR_memory_op 12
39#define __HYPERVISOR_multicall 13
40#define __HYPERVISOR_update_va_mapping 14
41#define __HYPERVISOR_set_timer_op 15
42#define __HYPERVISOR_event_channel_op_compat 16
43#define __HYPERVISOR_xen_version 17
44#define __HYPERVISOR_console_io 18
45#define __HYPERVISOR_physdev_op_compat 19
46#define __HYPERVISOR_grant_table_op 20
47#define __HYPERVISOR_vm_assist 21
48#define __HYPERVISOR_update_va_mapping_otherdomain 22
49#define __HYPERVISOR_iret 23 /* x86 only */
50#define __HYPERVISOR_vcpu_op 24
51#define __HYPERVISOR_set_segment_base 25 /* x86/64 only */
52#define __HYPERVISOR_mmuext_op 26
53#define __HYPERVISOR_acm_op 27
54#define __HYPERVISOR_nmi_op 28
Ian Campbella8b74582011-02-17 11:04:20 +000055#define __HYPERVISOR_sched_op 29
Jeremy Fitzhardingea42089d2007-07-17 18:37:04 -070056#define __HYPERVISOR_callback_op 30
57#define __HYPERVISOR_xenoprof_op 31
58#define __HYPERVISOR_event_channel_op 32
59#define __HYPERVISOR_physdev_op 33
60#define __HYPERVISOR_hvm_op 34
Dan Magenheimer5bc20fc2011-05-26 10:02:21 -060061#define __HYPERVISOR_tmem_op 38
Jeremy Fitzhardingea42089d2007-07-17 18:37:04 -070062
Isaku Yamahata9a9db272008-04-02 10:53:50 -070063/* Architecture-specific hypercall definitions. */
64#define __HYPERVISOR_arch_0 48
65#define __HYPERVISOR_arch_1 49
66#define __HYPERVISOR_arch_2 50
67#define __HYPERVISOR_arch_3 51
68#define __HYPERVISOR_arch_4 52
69#define __HYPERVISOR_arch_5 53
70#define __HYPERVISOR_arch_6 54
71#define __HYPERVISOR_arch_7 55
72
Jeremy Fitzhardingea42089d2007-07-17 18:37:04 -070073/*
74 * VIRTUAL INTERRUPTS
75 *
76 * Virtual interrupts that a guest OS may receive from Xen.
77 */
78#define VIRQ_TIMER 0 /* Timebase update, and/or requested timeout. */
79#define VIRQ_DEBUG 1 /* Request guest to dump debug info. */
80#define VIRQ_CONSOLE 2 /* (DOM0) Bytes received on emergency console. */
81#define VIRQ_DOM_EXC 3 /* (DOM0) Exceptional event for some domain. */
82#define VIRQ_DEBUGGER 6 /* (DOM0) A domain has paused for debugging. */
Liu, Jinsongf65c9bb2012-06-11 20:38:08 +080083#define VIRQ_PCPU_STATE 9 /* (DOM0) PCPU state changed */
Jeremy Fitzhardingea42089d2007-07-17 18:37:04 -070084
Isaku Yamahata2eb6d5e2008-04-02 10:53:51 -070085/* Architecture-specific VIRQ definitions. */
86#define VIRQ_ARCH_0 16
87#define VIRQ_ARCH_1 17
88#define VIRQ_ARCH_2 18
89#define VIRQ_ARCH_3 19
90#define VIRQ_ARCH_4 20
91#define VIRQ_ARCH_5 21
92#define VIRQ_ARCH_6 22
93#define VIRQ_ARCH_7 23
94
95#define NR_VIRQS 24
Jeremy Fitzhardingea42089d2007-07-17 18:37:04 -070096/*
97 * MMU-UPDATE REQUESTS
98 *
99 * HYPERVISOR_mmu_update() accepts a list of (ptr, val) pairs.
100 * A foreigndom (FD) can be specified (or DOMID_SELF for none).
101 * Where the FD has some effect, it is described below.
102 * ptr[1:0] specifies the appropriate MMU_* command.
103 *
104 * ptr[1:0] == MMU_NORMAL_PT_UPDATE:
105 * Updates an entry in a page table. If updating an L1 table, and the new
106 * table entry is valid/present, the mapped frame must belong to the FD, if
107 * an FD has been specified. If attempting to map an I/O page then the
108 * caller assumes the privilege of the FD.
109 * FD == DOMID_IO: Permit /only/ I/O mappings, at the priv level of the caller.
110 * FD == DOMID_XEN: Map restricted areas of Xen's heap space.
111 * ptr[:2] -- Machine address of the page-table entry to modify.
112 * val -- Value to write.
113 *
114 * ptr[1:0] == MMU_MACHPHYS_UPDATE:
115 * Updates an entry in the machine->pseudo-physical mapping table.
116 * ptr[:2] -- Machine address within the frame whose mapping to modify.
117 * The frame must belong to the FD, if one is specified.
118 * val -- Value to write into the mapping entry.
Jeremy Fitzhardingee57778a2008-06-16 04:30:02 -0700119 *
120 * ptr[1:0] == MMU_PT_UPDATE_PRESERVE_AD:
121 * As MMU_NORMAL_PT_UPDATE above, but A/D bits currently in the PTE are ORed
122 * with those in @val.
Jeremy Fitzhardingea42089d2007-07-17 18:37:04 -0700123 */
Jeremy Fitzhardingee57778a2008-06-16 04:30:02 -0700124#define MMU_NORMAL_PT_UPDATE 0 /* checked '*ptr = val'. ptr is MA. */
125#define MMU_MACHPHYS_UPDATE 1 /* ptr = MA of frame to modify entry for */
126#define MMU_PT_UPDATE_PRESERVE_AD 2 /* atomically: *ptr = val | (*ptr&(A|D)) */
Jeremy Fitzhardingea42089d2007-07-17 18:37:04 -0700127
128/*
129 * MMU EXTENDED OPERATIONS
130 *
131 * HYPERVISOR_mmuext_op() accepts a list of mmuext_op structures.
132 * A foreigndom (FD) can be specified (or DOMID_SELF for none).
133 * Where the FD has some effect, it is described below.
134 *
135 * cmd: MMUEXT_(UN)PIN_*_TABLE
136 * mfn: Machine frame number to be (un)pinned as a p.t. page.
137 * The frame must belong to the FD, if one is specified.
138 *
139 * cmd: MMUEXT_NEW_BASEPTR
140 * mfn: Machine frame number of new page-table base to install in MMU.
141 *
142 * cmd: MMUEXT_NEW_USER_BASEPTR [x86/64 only]
143 * mfn: Machine frame number of new page-table base to install in MMU
144 * when in user space.
145 *
146 * cmd: MMUEXT_TLB_FLUSH_LOCAL
147 * No additional arguments. Flushes local TLB.
148 *
149 * cmd: MMUEXT_INVLPG_LOCAL
150 * linear_addr: Linear address to be flushed from the local TLB.
151 *
152 * cmd: MMUEXT_TLB_FLUSH_MULTI
153 * vcpumask: Pointer to bitmap of VCPUs to be flushed.
154 *
155 * cmd: MMUEXT_INVLPG_MULTI
156 * linear_addr: Linear address to be flushed.
157 * vcpumask: Pointer to bitmap of VCPUs to be flushed.
158 *
159 * cmd: MMUEXT_TLB_FLUSH_ALL
160 * No additional arguments. Flushes all VCPUs' TLBs.
161 *
162 * cmd: MMUEXT_INVLPG_ALL
163 * linear_addr: Linear address to be flushed from all VCPUs' TLBs.
164 *
165 * cmd: MMUEXT_FLUSH_CACHE
166 * No additional arguments. Writes back and flushes cache contents.
167 *
168 * cmd: MMUEXT_SET_LDT
169 * linear_addr: Linear address of LDT base (NB. must be page-aligned).
170 * nr_ents: Number of entries in LDT.
171 */
172#define MMUEXT_PIN_L1_TABLE 0
173#define MMUEXT_PIN_L2_TABLE 1
174#define MMUEXT_PIN_L3_TABLE 2
175#define MMUEXT_PIN_L4_TABLE 3
176#define MMUEXT_UNPIN_TABLE 4
177#define MMUEXT_NEW_BASEPTR 5
178#define MMUEXT_TLB_FLUSH_LOCAL 6
179#define MMUEXT_INVLPG_LOCAL 7
180#define MMUEXT_TLB_FLUSH_MULTI 8
181#define MMUEXT_INVLPG_MULTI 9
182#define MMUEXT_TLB_FLUSH_ALL 10
183#define MMUEXT_INVLPG_ALL 11
184#define MMUEXT_FLUSH_CACHE 12
185#define MMUEXT_SET_LDT 13
186#define MMUEXT_NEW_USER_BASEPTR 15
187
188#ifndef __ASSEMBLY__
189struct mmuext_op {
190 unsigned int cmd;
191 union {
192 /* [UN]PIN_TABLE, NEW_BASEPTR, NEW_USER_BASEPTR */
193 unsigned long mfn;
194 /* INVLPG_LOCAL, INVLPG_ALL, SET_LDT */
195 unsigned long linear_addr;
196 } arg1;
197 union {
198 /* SET_LDT */
199 unsigned int nr_ents;
200 /* TLB_FLUSH_MULTI, INVLPG_MULTI */
201 void *vcpumask;
202 } arg2;
203};
204DEFINE_GUEST_HANDLE_STRUCT(mmuext_op);
205#endif
206
207/* These are passed as 'flags' to update_va_mapping. They can be ORed. */
208/* When specifying UVMF_MULTI, also OR in a pointer to a CPU bitmap. */
209/* UVMF_LOCAL is merely UVMF_MULTI with a NULL bitmap pointer. */
210#define UVMF_NONE (0UL<<0) /* No flushing at all. */
211#define UVMF_TLB_FLUSH (1UL<<0) /* Flush entire TLB(s). */
212#define UVMF_INVLPG (2UL<<0) /* Flush only one entry. */
213#define UVMF_FLUSHTYPE_MASK (3UL<<0)
214#define UVMF_MULTI (0UL<<2) /* Flush subset of TLBs. */
215#define UVMF_LOCAL (0UL<<2) /* Flush local TLB. */
216#define UVMF_ALL (1UL<<2) /* Flush all TLBs. */
217
218/*
219 * Commands to HYPERVISOR_console_io().
220 */
221#define CONSOLEIO_write 0
222#define CONSOLEIO_read 1
223
224/*
225 * Commands to HYPERVISOR_vm_assist().
226 */
227#define VMASST_CMD_enable 0
228#define VMASST_CMD_disable 1
229#define VMASST_TYPE_4gb_segments 0
230#define VMASST_TYPE_4gb_segments_notify 1
231#define VMASST_TYPE_writable_pagetables 2
232#define VMASST_TYPE_pae_extended_cr3 3
233#define MAX_VMASST_TYPE 3
234
235#ifndef __ASSEMBLY__
236
237typedef uint16_t domid_t;
238
239/* Domain ids >= DOMID_FIRST_RESERVED cannot be used for ordinary domains. */
240#define DOMID_FIRST_RESERVED (0x7FF0U)
241
242/* DOMID_SELF is used in certain contexts to refer to oneself. */
243#define DOMID_SELF (0x7FF0U)
244
245/*
246 * DOMID_IO is used to restrict page-table updates to mapping I/O memory.
247 * Although no Foreign Domain need be specified to map I/O pages, DOMID_IO
248 * is useful to ensure that no mappings to the OS's own heap are accidentally
249 * installed. (e.g., in Linux this could cause havoc as reference counts
250 * aren't adjusted on the I/O-mapping code path).
251 * This only makes sense in MMUEXT_SET_FOREIGNDOM, but in that context can
252 * be specified by any calling domain.
253 */
254#define DOMID_IO (0x7FF1U)
255
256/*
257 * DOMID_XEN is used to allow privileged domains to map restricted parts of
258 * Xen's heap space (e.g., the machine_to_phys table).
259 * This only makes sense in MMUEXT_SET_FOREIGNDOM, and is only permitted if
260 * the caller is privileged.
261 */
262#define DOMID_XEN (0x7FF2U)
263
264/*
265 * Send an array of these to HYPERVISOR_mmu_update().
266 * NB. The fields are natural pointer/address size for this architecture.
267 */
268struct mmu_update {
269 uint64_t ptr; /* Machine address of PTE. */
270 uint64_t val; /* New contents of PTE. */
271};
272DEFINE_GUEST_HANDLE_STRUCT(mmu_update);
273
274/*
275 * Send an array of these to HYPERVISOR_multicall().
276 * NB. The fields are natural register size for this architecture.
277 */
278struct multicall_entry {
279 unsigned long op;
280 long result;
281 unsigned long args[6];
282};
283DEFINE_GUEST_HANDLE_STRUCT(multicall_entry);
284
285/*
286 * Event channel endpoints per domain:
287 * 1024 if a long is 32 bits; 4096 if a long is 64 bits.
288 */
289#define NR_EVENT_CHANNELS (sizeof(unsigned long) * sizeof(unsigned long) * 64)
290
291struct vcpu_time_info {
292 /*
293 * Updates to the following values are preceded and followed
294 * by an increment of 'version'. The guest can therefore
295 * detect updates by looking for changes to 'version'. If the
296 * least-significant bit of the version number is set then an
297 * update is in progress and the guest must wait to read a
298 * consistent set of values. The correct way to interact with
299 * the version number is similar to Linux's seqlock: see the
300 * implementations of read_seqbegin/read_seqretry.
301 */
302 uint32_t version;
303 uint32_t pad0;
304 uint64_t tsc_timestamp; /* TSC at last update of time vals. */
305 uint64_t system_time; /* Time, in nanosecs, since boot. */
306 /*
307 * Current system time:
308 * system_time + ((tsc - tsc_timestamp) << tsc_shift) * tsc_to_system_mul
309 * CPU frequency (Hz):
310 * ((10^9 << 32) / tsc_to_system_mul) >> tsc_shift
311 */
312 uint32_t tsc_to_system_mul;
313 int8_t tsc_shift;
314 int8_t pad1[3];
315}; /* 32 bytes */
316
317struct vcpu_info {
318 /*
319 * 'evtchn_upcall_pending' is written non-zero by Xen to indicate
320 * a pending notification for a particular VCPU. It is then cleared
321 * by the guest OS /before/ checking for pending work, thus avoiding
322 * a set-and-check race. Note that the mask is only accessed by Xen
323 * on the CPU that is currently hosting the VCPU. This means that the
324 * pending and mask flags can be updated by the guest without special
325 * synchronisation (i.e., no need for the x86 LOCK prefix).
326 * This may seem suboptimal because if the pending flag is set by
327 * a different CPU then an IPI may be scheduled even when the mask
328 * is set. However, note:
329 * 1. The task of 'interrupt holdoff' is covered by the per-event-
330 * channel mask bits. A 'noisy' event that is continually being
331 * triggered can be masked at source at this very precise
332 * granularity.
333 * 2. The main purpose of the per-VCPU mask is therefore to restrict
334 * reentrant execution: whether for concurrency control, or to
335 * prevent unbounded stack usage. Whatever the purpose, we expect
336 * that the mask will be asserted only for short periods at a time,
337 * and so the likelihood of a 'spurious' IPI is suitably small.
338 * The mask is read before making an event upcall to the guest: a
339 * non-zero mask therefore guarantees that the VCPU will not receive
340 * an upcall activation. The mask is cleared when the VCPU requests
341 * to block: this avoids wakeup-waiting races.
342 */
343 uint8_t evtchn_upcall_pending;
344 uint8_t evtchn_upcall_mask;
345 unsigned long evtchn_pending_sel;
346 struct arch_vcpu_info arch;
Gerd Hoffmann1c7b67f2008-06-03 16:17:30 +0200347 struct pvclock_vcpu_time_info time;
Jeremy Fitzhardingea42089d2007-07-17 18:37:04 -0700348}; /* 64 bytes (x86) */
349
350/*
351 * Xen/kernel shared data -- pointer provided in start_info.
352 * NB. We expect that this struct is smaller than a page.
353 */
354struct shared_info {
355 struct vcpu_info vcpu_info[MAX_VIRT_CPUS];
356
357 /*
358 * A domain can create "event channels" on which it can send and receive
359 * asynchronous event notifications. There are three classes of event that
360 * are delivered by this mechanism:
361 * 1. Bi-directional inter- and intra-domain connections. Domains must
362 * arrange out-of-band to set up a connection (usually by allocating
363 * an unbound 'listener' port and avertising that via a storage service
364 * such as xenstore).
365 * 2. Physical interrupts. A domain with suitable hardware-access
366 * privileges can bind an event-channel port to a physical interrupt
367 * source.
368 * 3. Virtual interrupts ('events'). A domain can bind an event-channel
369 * port to a virtual interrupt source, such as the virtual-timer
370 * device or the emergency console.
371 *
372 * Event channels are addressed by a "port index". Each channel is
373 * associated with two bits of information:
374 * 1. PENDING -- notifies the domain that there is a pending notification
375 * to be processed. This bit is cleared by the guest.
376 * 2. MASK -- if this bit is clear then a 0->1 transition of PENDING
377 * will cause an asynchronous upcall to be scheduled. This bit is only
378 * updated by the guest. It is read-only within Xen. If a channel
379 * becomes pending while the channel is masked then the 'edge' is lost
380 * (i.e., when the channel is unmasked, the guest must manually handle
381 * pending notifications as no upcall will be scheduled by Xen).
382 *
383 * To expedite scanning of pending notifications, any 0->1 pending
384 * transition on an unmasked channel causes a corresponding bit in a
385 * per-vcpu selector word to be set. Each bit in the selector covers a
386 * 'C long' in the PENDING bitfield array.
387 */
388 unsigned long evtchn_pending[sizeof(unsigned long) * 8];
389 unsigned long evtchn_mask[sizeof(unsigned long) * 8];
390
391 /*
392 * Wallclock time: updated only by control software. Guests should base
393 * their gettimeofday() syscall on this wallclock-base value.
394 */
Gerd Hoffmann1c7b67f2008-06-03 16:17:30 +0200395 struct pvclock_wall_clock wc;
Jeremy Fitzhardingea42089d2007-07-17 18:37:04 -0700396
397 struct arch_shared_info arch;
398
399};
400
401/*
402 * Start-of-day memory layout for the initial domain (DOM0):
403 * 1. The domain is started within contiguous virtual-memory region.
404 * 2. The contiguous region begins and ends on an aligned 4MB boundary.
405 * 3. The region start corresponds to the load address of the OS image.
406 * If the load address is not 4MB aligned then the address is rounded down.
407 * 4. This the order of bootstrap elements in the initial virtual region:
408 * a. relocated kernel image
409 * b. initial ram disk [mod_start, mod_len]
410 * c. list of allocated page frames [mfn_list, nr_pages]
411 * d. start_info_t structure [register ESI (x86)]
412 * e. bootstrap page tables [pt_base, CR3 (x86)]
413 * f. bootstrap stack [register ESP (x86)]
414 * 5. Bootstrap elements are packed together, but each is 4kB-aligned.
415 * 6. The initial ram disk may be omitted.
416 * 7. The list of page frames forms a contiguous 'pseudo-physical' memory
417 * layout for the domain. In particular, the bootstrap virtual-memory
418 * region is a 1:1 mapping to the first section of the pseudo-physical map.
419 * 8. All bootstrap elements are mapped read-writable for the guest OS. The
420 * only exception is the bootstrap page table, which is mapped read-only.
421 * 9. There is guaranteed to be at least 512kB padding after the final
422 * bootstrap element. If necessary, the bootstrap virtual region is
423 * extended by an extra 4MB to ensure this.
424 */
425
426#define MAX_GUEST_CMDLINE 1024
427struct start_info {
428 /* THE FOLLOWING ARE FILLED IN BOTH ON INITIAL BOOT AND ON RESUME. */
429 char magic[32]; /* "xen-<version>-<platform>". */
430 unsigned long nr_pages; /* Total pages allocated to this domain. */
431 unsigned long shared_info; /* MACHINE address of shared info struct. */
432 uint32_t flags; /* SIF_xxx flags. */
433 unsigned long store_mfn; /* MACHINE page number of shared page. */
434 uint32_t store_evtchn; /* Event channel for store communication. */
435 union {
436 struct {
437 unsigned long mfn; /* MACHINE page number of console page. */
438 uint32_t evtchn; /* Event channel for console page. */
439 } domU;
440 struct {
441 uint32_t info_off; /* Offset of console_info struct. */
442 uint32_t info_size; /* Size of console_info struct from start.*/
443 } dom0;
444 } console;
445 /* THE FOLLOWING ARE ONLY FILLED IN ON INITIAL BOOT (NOT RESUME). */
446 unsigned long pt_base; /* VIRTUAL address of page directory. */
447 unsigned long nr_pt_frames; /* Number of bootstrap p.t. frames. */
448 unsigned long mfn_list; /* VIRTUAL address of page-frame list. */
449 unsigned long mod_start; /* VIRTUAL address of pre-loaded module. */
450 unsigned long mod_len; /* Size (bytes) of pre-loaded module. */
451 int8_t cmd_line[MAX_GUEST_CMDLINE];
452};
453
Jeremy Fitzhardingec2419b42011-05-31 10:50:10 -0400454struct dom0_vga_console_info {
455 uint8_t video_type;
456#define XEN_VGATYPE_TEXT_MODE_3 0x03
457#define XEN_VGATYPE_VESA_LFB 0x23
458
459 union {
460 struct {
461 /* Font height, in pixels. */
462 uint16_t font_height;
463 /* Cursor location (column, row). */
464 uint16_t cursor_x, cursor_y;
465 /* Number of rows and columns (dimensions in characters). */
466 uint16_t rows, columns;
467 } text_mode_3;
468
469 struct {
470 /* Width and height, in pixels. */
471 uint16_t width, height;
472 /* Bytes per scan line. */
473 uint16_t bytes_per_line;
474 /* Bits per pixel. */
475 uint16_t bits_per_pixel;
476 /* LFB physical address, and size (in units of 64kB). */
477 uint32_t lfb_base;
478 uint32_t lfb_size;
479 /* RGB mask offsets and sizes, as defined by VBE 1.2+ */
480 uint8_t red_pos, red_size;
481 uint8_t green_pos, green_size;
482 uint8_t blue_pos, blue_size;
483 uint8_t rsvd_pos, rsvd_size;
484
485 /* VESA capabilities (offset 0xa, VESA command 0x4f00). */
486 uint32_t gbl_caps;
487 /* Mode attributes (offset 0x0, VESA command 0x4f01). */
488 uint16_t mode_attrs;
489 } vesa_lfb;
490 } u;
491};
492
Jeremy Fitzhardingea42089d2007-07-17 18:37:04 -0700493/* These flags are passed in the 'flags' field of start_info_t. */
494#define SIF_PRIVILEGED (1<<0) /* Is the domain privileged? */
495#define SIF_INITDOMAIN (1<<1) /* Is this the initial control domain? */
Yu Ke3e099672010-03-24 11:01:13 -0700496#define SIF_PM_MASK (0xFF<<8) /* reserve 1 byte for xen-pm options */
Jeremy Fitzhardingea42089d2007-07-17 18:37:04 -0700497
498typedef uint64_t cpumap_t;
499
500typedef uint8_t xen_domain_handle_t[16];
501
502/* Turn a plain number into a C unsigned long constant. */
503#define __mk_unsigned_long(x) x ## UL
504#define mk_unsigned_long(x) __mk_unsigned_long(x)
505
Dan Magenheimer5bc20fc2011-05-26 10:02:21 -0600506#define TMEM_SPEC_VERSION 1
507
508struct tmem_op {
509 uint32_t cmd;
510 int32_t pool_id;
511 union {
512 struct { /* for cmd == TMEM_NEW_POOL */
513 uint64_t uuid[2];
514 uint32_t flags;
515 } new;
516 struct {
517 uint64_t oid[3];
518 uint32_t index;
519 uint32_t tmem_offset;
520 uint32_t pfn_offset;
521 uint32_t len;
522 GUEST_HANDLE(void) gmfn; /* guest machine page frame */
523 } gen;
524 } u;
525};
526
Annie Li0f9f5a92011-11-22 09:58:06 +0800527DEFINE_GUEST_HANDLE(u64);
528
Jeremy Fitzhardingea42089d2007-07-17 18:37:04 -0700529#else /* __ASSEMBLY__ */
530
531/* In assembly code we cannot use C numeric constant suffixes. */
532#define mk_unsigned_long(x) x
533
534#endif /* !__ASSEMBLY__ */
535
536#endif /* __XEN_PUBLIC_XEN_H__ */