Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /******************************************************************************
0003  * Guest OS interface to ARM Xen.
0004  *
0005  * Stefano Stabellini <stefano.stabellini@eu.citrix.com>, Citrix, 2012
0006  */
0007 
0008 #ifndef _ASM_ARM_XEN_INTERFACE_H
0009 #define _ASM_ARM_XEN_INTERFACE_H
0010 
0011 #include <linux/types.h>
0012 
0013 #define uint64_aligned_t uint64_t __attribute__((aligned(8)))
0014 
0015 #define __DEFINE_GUEST_HANDLE(name, type) \
0016     typedef struct { union { type *p; uint64_aligned_t q; }; }  \
0017         __guest_handle_ ## name
0018 
0019 #define DEFINE_GUEST_HANDLE_STRUCT(name) \
0020     __DEFINE_GUEST_HANDLE(name, struct name)
0021 #define DEFINE_GUEST_HANDLE(name) __DEFINE_GUEST_HANDLE(name, name)
0022 #define GUEST_HANDLE(name)        __guest_handle_ ## name
0023 
0024 #define set_xen_guest_handle(hnd, val)          \
0025     do {                        \
0026         if (sizeof(hnd) == 8)           \
0027             *(uint64_t *)&(hnd) = 0;    \
0028         (hnd).p = val;              \
0029     } while (0)
0030 
0031 #define __HYPERVISOR_platform_op_raw __HYPERVISOR_platform_op
0032 
0033 #ifndef __ASSEMBLY__
0034 /* Explicitly size integers that represent pfns in the interface with
0035  * Xen so that we can have one ABI that works for 32 and 64 bit guests.
0036  * Note that this means that the xen_pfn_t type may be capable of
0037  * representing pfn's which the guest cannot represent in its own pfn
0038  * type. However since pfn space is controlled by the guest this is
0039  * fine since it simply wouldn't be able to create any sure pfns in
0040  * the first place.
0041  */
0042 typedef uint64_t xen_pfn_t;
0043 #define PRI_xen_pfn "llx"
0044 typedef uint64_t xen_ulong_t;
0045 #define PRI_xen_ulong "llx"
0046 typedef int64_t xen_long_t;
0047 #define PRI_xen_long "llx"
0048 /* Guest handles for primitive C types. */
0049 __DEFINE_GUEST_HANDLE(uchar, unsigned char);
0050 __DEFINE_GUEST_HANDLE(uint,  unsigned int);
0051 DEFINE_GUEST_HANDLE(char);
0052 DEFINE_GUEST_HANDLE(int);
0053 DEFINE_GUEST_HANDLE(void);
0054 DEFINE_GUEST_HANDLE(uint64_t);
0055 DEFINE_GUEST_HANDLE(uint32_t);
0056 DEFINE_GUEST_HANDLE(xen_pfn_t);
0057 DEFINE_GUEST_HANDLE(xen_ulong_t);
0058 
0059 /* Maximum number of virtual CPUs in multi-processor guests. */
0060 #define MAX_VIRT_CPUS 1
0061 
0062 struct arch_vcpu_info { };
0063 struct arch_shared_info { };
0064 
0065 /* TODO: Move pvclock definitions some place arch independent */
0066 struct pvclock_vcpu_time_info {
0067     u32   version;
0068     u32   pad0;
0069     u64   tsc_timestamp;
0070     u64   system_time;
0071     u32   tsc_to_system_mul;
0072     s8    tsc_shift;
0073     u8    flags;
0074     u8    pad[2];
0075 } __attribute__((__packed__)); /* 32 bytes */
0076 
0077 /* It is OK to have a 12 bytes struct with no padding because it is packed */
0078 struct pvclock_wall_clock {
0079     u32   version;
0080     u32   sec;
0081     u32   nsec;
0082     u32   sec_hi;
0083 } __attribute__((__packed__));
0084 #endif
0085 
0086 #endif /* _ASM_ARM_XEN_INTERFACE_H */