Stefano Stabellini | 4c071ee | 2012-09-14 13:53:39 +0000 | [diff] [blame] | 1 | /****************************************************************************** |
| 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 Stabellini | 256f631 | 2012-09-14 13:34:43 +0000 | [diff] [blame] | 12 | #define uint64_aligned_t uint64_t __attribute__((aligned(8))) |
| 13 | |
Stefano Stabellini | 4c071ee | 2012-09-14 13:53:39 +0000 | [diff] [blame] | 14 | #define __DEFINE_GUEST_HANDLE(name, type) \ |
Stefano Stabellini | 256f631 | 2012-09-14 13:34:43 +0000 | [diff] [blame] | 15 | typedef struct { union { type *p; uint64_aligned_t q; }; } \ |
| 16 | __guest_handle_ ## name |
Stefano Stabellini | 4c071ee | 2012-09-14 13:53:39 +0000 | [diff] [blame] | 17 | |
| 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 Stabellini | 256f631 | 2012-09-14 13:34:43 +0000 | [diff] [blame] | 27 | (hnd).p = val; \ |
Stefano Stabellini | 4c071ee | 2012-09-14 13:53:39 +0000 | [diff] [blame] | 28 | } while (0) |
| 29 | |
| 30 | #ifndef __ASSEMBLY__ |
| 31 | /* Explicitly size integers that represent pfns in the interface with |
Ian Campbell | 3ab0b83 | 2012-10-18 08:26:17 +0100 | [diff] [blame] | 32 | * Xen so that we can have one ABI that works for 32 and 64 bit guests. |
| 33 | * Note that this means that the xen_pfn_t type may be capable of |
| 34 | * representing pfn's which the guest cannot represent in its own pfn |
| 35 | * type. However since pfn space is controlled by the guest this is |
| 36 | * fine since it simply wouldn't be able to create any sure pfns in |
| 37 | * the first place. |
| 38 | */ |
Stefano Stabellini | 4c071ee | 2012-09-14 13:53:39 +0000 | [diff] [blame] | 39 | typedef uint64_t xen_pfn_t; |
Ian Campbell | 37ea0fc | 2012-10-17 09:39:10 +0100 | [diff] [blame] | 40 | #define PRI_xen_pfn "llx" |
Stefano Stabellini | 256f631 | 2012-09-14 13:34:43 +0000 | [diff] [blame] | 41 | typedef uint64_t xen_ulong_t; |
Ian Campbell | 37ea0fc | 2012-10-17 09:39:10 +0100 | [diff] [blame] | 42 | #define PRI_xen_ulong "llx" |
Stefano Stabellini | 4c071ee | 2012-09-14 13:53:39 +0000 | [diff] [blame] | 43 | /* Guest handles for primitive C types. */ |
| 44 | __DEFINE_GUEST_HANDLE(uchar, unsigned char); |
| 45 | __DEFINE_GUEST_HANDLE(uint, unsigned int); |
Stefano Stabellini | 4c071ee | 2012-09-14 13:53:39 +0000 | [diff] [blame] | 46 | DEFINE_GUEST_HANDLE(char); |
| 47 | DEFINE_GUEST_HANDLE(int); |
Stefano Stabellini | 4c071ee | 2012-09-14 13:53:39 +0000 | [diff] [blame] | 48 | DEFINE_GUEST_HANDLE(void); |
| 49 | DEFINE_GUEST_HANDLE(uint64_t); |
| 50 | DEFINE_GUEST_HANDLE(uint32_t); |
| 51 | DEFINE_GUEST_HANDLE(xen_pfn_t); |
Ian Campbell | f832da0 | 2012-10-03 16:37:09 +0100 | [diff] [blame] | 52 | DEFINE_GUEST_HANDLE(xen_ulong_t); |
Stefano Stabellini | 4c071ee | 2012-09-14 13:53:39 +0000 | [diff] [blame] | 53 | |
| 54 | /* Maximum number of virtual CPUs in multi-processor guests. */ |
| 55 | #define MAX_VIRT_CPUS 1 |
| 56 | |
| 57 | struct arch_vcpu_info { }; |
| 58 | struct arch_shared_info { }; |
| 59 | |
| 60 | /* TODO: Move pvclock definitions some place arch independent */ |
| 61 | struct pvclock_vcpu_time_info { |
| 62 | u32 version; |
| 63 | u32 pad0; |
| 64 | u64 tsc_timestamp; |
| 65 | u64 system_time; |
| 66 | u32 tsc_to_system_mul; |
| 67 | s8 tsc_shift; |
| 68 | u8 flags; |
| 69 | u8 pad[2]; |
| 70 | } __attribute__((__packed__)); /* 32 bytes */ |
| 71 | |
| 72 | /* It is OK to have a 12 bytes struct with no padding because it is packed */ |
| 73 | struct pvclock_wall_clock { |
| 74 | u32 version; |
| 75 | u32 sec; |
| 76 | u32 nsec; |
| 77 | } __attribute__((__packed__)); |
| 78 | #endif |
| 79 | |
| 80 | #endif /* _ASM_ARM_XEN_INTERFACE_H */ |