blob: ae05e56dd17d6eb2e270117172dbc327f27b82d2 [file] [log] [blame]
Stefano Stabellini4c071ee2012-09-14 13:53:39 +00001/******************************************************************************
2 * Guest OS interface to ARM Xen.
3 *
4 * Stefano Stabellini <stefano.stabellini@eu.citrix.com>, Citrix, 2012
5 */
6
7#ifndef _ASM_ARM_XEN_INTERFACE_H
8#define _ASM_ARM_XEN_INTERFACE_H
9
10#include <linux/types.h>
11
Stefano Stabellini256f6312012-09-14 13:34:43 +000012#define uint64_aligned_t uint64_t __attribute__((aligned(8)))
13
Stefano Stabellini4c071ee2012-09-14 13:53:39 +000014#define __DEFINE_GUEST_HANDLE(name, type) \
Stefano Stabellini256f6312012-09-14 13:34:43 +000015 typedef struct { union { type *p; uint64_aligned_t q; }; } \
16 __guest_handle_ ## name
Stefano Stabellini4c071ee2012-09-14 13:53:39 +000017
18#define DEFINE_GUEST_HANDLE_STRUCT(name) \
19 __DEFINE_GUEST_HANDLE(name, struct name)
20#define DEFINE_GUEST_HANDLE(name) __DEFINE_GUEST_HANDLE(name, name)
21#define GUEST_HANDLE(name) __guest_handle_ ## name
22
23#define set_xen_guest_handle(hnd, val) \
24 do { \
25 if (sizeof(hnd) == 8) \
26 *(uint64_t *)&(hnd) = 0; \
Stefano Stabellini256f6312012-09-14 13:34:43 +000027 (hnd).p = val; \
Stefano Stabellini4c071ee2012-09-14 13:53:39 +000028 } while (0)
29
30#ifndef __ASSEMBLY__
31/* Explicitly size integers that represent pfns in the interface with
32 * Xen so that we can have one ABI that works for 32 and 64 bit guests. */
33typedef uint64_t xen_pfn_t;
Stefano Stabellini256f6312012-09-14 13:34:43 +000034typedef uint64_t xen_ulong_t;
Stefano Stabellini4c071ee2012-09-14 13:53:39 +000035/* Guest handles for primitive C types. */
36__DEFINE_GUEST_HANDLE(uchar, unsigned char);
37__DEFINE_GUEST_HANDLE(uint, unsigned int);
38__DEFINE_GUEST_HANDLE(ulong, unsigned long);
39DEFINE_GUEST_HANDLE(char);
40DEFINE_GUEST_HANDLE(int);
41DEFINE_GUEST_HANDLE(long);
42DEFINE_GUEST_HANDLE(void);
43DEFINE_GUEST_HANDLE(uint64_t);
44DEFINE_GUEST_HANDLE(uint32_t);
45DEFINE_GUEST_HANDLE(xen_pfn_t);
46
47/* Maximum number of virtual CPUs in multi-processor guests. */
48#define MAX_VIRT_CPUS 1
49
50struct arch_vcpu_info { };
51struct arch_shared_info { };
52
53/* TODO: Move pvclock definitions some place arch independent */
54struct pvclock_vcpu_time_info {
55 u32 version;
56 u32 pad0;
57 u64 tsc_timestamp;
58 u64 system_time;
59 u32 tsc_to_system_mul;
60 s8 tsc_shift;
61 u8 flags;
62 u8 pad[2];
63} __attribute__((__packed__)); /* 32 bytes */
64
65/* It is OK to have a 12 bytes struct with no padding because it is packed */
66struct pvclock_wall_clock {
67 u32 version;
68 u32 sec;
69 u32 nsec;
70} __attribute__((__packed__));
71#endif
72
73#endif /* _ASM_ARM_XEN_INTERFACE_H */