1*b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */ 22fbadc30SMarc Zyngier /****************************************************************************** 32fbadc30SMarc Zyngier * Guest OS interface to ARM Xen. 42fbadc30SMarc Zyngier * 52fbadc30SMarc Zyngier * Stefano Stabellini <stefano.stabellini@eu.citrix.com>, Citrix, 2012 62fbadc30SMarc Zyngier */ 72fbadc30SMarc Zyngier 82fbadc30SMarc Zyngier #ifndef _ASM_ARM_XEN_INTERFACE_H 92fbadc30SMarc Zyngier #define _ASM_ARM_XEN_INTERFACE_H 102fbadc30SMarc Zyngier 112fbadc30SMarc Zyngier #include <linux/types.h> 122fbadc30SMarc Zyngier 132fbadc30SMarc Zyngier #define uint64_aligned_t uint64_t __attribute__((aligned(8))) 142fbadc30SMarc Zyngier 152fbadc30SMarc Zyngier #define __DEFINE_GUEST_HANDLE(name, type) \ 162fbadc30SMarc Zyngier typedef struct { union { type *p; uint64_aligned_t q; }; } \ 172fbadc30SMarc Zyngier __guest_handle_ ## name 182fbadc30SMarc Zyngier 192fbadc30SMarc Zyngier #define DEFINE_GUEST_HANDLE_STRUCT(name) \ 202fbadc30SMarc Zyngier __DEFINE_GUEST_HANDLE(name, struct name) 212fbadc30SMarc Zyngier #define DEFINE_GUEST_HANDLE(name) __DEFINE_GUEST_HANDLE(name, name) 222fbadc30SMarc Zyngier #define GUEST_HANDLE(name) __guest_handle_ ## name 232fbadc30SMarc Zyngier 242fbadc30SMarc Zyngier #define set_xen_guest_handle(hnd, val) \ 252fbadc30SMarc Zyngier do { \ 262fbadc30SMarc Zyngier if (sizeof(hnd) == 8) \ 272fbadc30SMarc Zyngier *(uint64_t *)&(hnd) = 0; \ 282fbadc30SMarc Zyngier (hnd).p = val; \ 292fbadc30SMarc Zyngier } while (0) 302fbadc30SMarc Zyngier 312fbadc30SMarc Zyngier #define __HYPERVISOR_platform_op_raw __HYPERVISOR_platform_op 322fbadc30SMarc Zyngier 332fbadc30SMarc Zyngier #ifndef __ASSEMBLY__ 342fbadc30SMarc Zyngier /* Explicitly size integers that represent pfns in the interface with 352fbadc30SMarc Zyngier * Xen so that we can have one ABI that works for 32 and 64 bit guests. 362fbadc30SMarc Zyngier * Note that this means that the xen_pfn_t type may be capable of 372fbadc30SMarc Zyngier * representing pfn's which the guest cannot represent in its own pfn 382fbadc30SMarc Zyngier * type. However since pfn space is controlled by the guest this is 392fbadc30SMarc Zyngier * fine since it simply wouldn't be able to create any sure pfns in 402fbadc30SMarc Zyngier * the first place. 412fbadc30SMarc Zyngier */ 422fbadc30SMarc Zyngier typedef uint64_t xen_pfn_t; 432fbadc30SMarc Zyngier #define PRI_xen_pfn "llx" 442fbadc30SMarc Zyngier typedef uint64_t xen_ulong_t; 452fbadc30SMarc Zyngier #define PRI_xen_ulong "llx" 462fbadc30SMarc Zyngier typedef int64_t xen_long_t; 472fbadc30SMarc Zyngier #define PRI_xen_long "llx" 482fbadc30SMarc Zyngier /* Guest handles for primitive C types. */ 492fbadc30SMarc Zyngier __DEFINE_GUEST_HANDLE(uchar, unsigned char); 502fbadc30SMarc Zyngier __DEFINE_GUEST_HANDLE(uint, unsigned int); 512fbadc30SMarc Zyngier DEFINE_GUEST_HANDLE(char); 522fbadc30SMarc Zyngier DEFINE_GUEST_HANDLE(int); 532fbadc30SMarc Zyngier DEFINE_GUEST_HANDLE(void); 542fbadc30SMarc Zyngier DEFINE_GUEST_HANDLE(uint64_t); 552fbadc30SMarc Zyngier DEFINE_GUEST_HANDLE(uint32_t); 562fbadc30SMarc Zyngier DEFINE_GUEST_HANDLE(xen_pfn_t); 572fbadc30SMarc Zyngier DEFINE_GUEST_HANDLE(xen_ulong_t); 582fbadc30SMarc Zyngier 592fbadc30SMarc Zyngier /* Maximum number of virtual CPUs in multi-processor guests. */ 602fbadc30SMarc Zyngier #define MAX_VIRT_CPUS 1 612fbadc30SMarc Zyngier 622fbadc30SMarc Zyngier struct arch_vcpu_info { }; 632fbadc30SMarc Zyngier struct arch_shared_info { }; 642fbadc30SMarc Zyngier 652fbadc30SMarc Zyngier /* TODO: Move pvclock definitions some place arch independent */ 662fbadc30SMarc Zyngier struct pvclock_vcpu_time_info { 672fbadc30SMarc Zyngier u32 version; 682fbadc30SMarc Zyngier u32 pad0; 692fbadc30SMarc Zyngier u64 tsc_timestamp; 702fbadc30SMarc Zyngier u64 system_time; 712fbadc30SMarc Zyngier u32 tsc_to_system_mul; 722fbadc30SMarc Zyngier s8 tsc_shift; 732fbadc30SMarc Zyngier u8 flags; 742fbadc30SMarc Zyngier u8 pad[2]; 752fbadc30SMarc Zyngier } __attribute__((__packed__)); /* 32 bytes */ 762fbadc30SMarc Zyngier 772fbadc30SMarc Zyngier /* It is OK to have a 12 bytes struct with no padding because it is packed */ 782fbadc30SMarc Zyngier struct pvclock_wall_clock { 792fbadc30SMarc Zyngier u32 version; 802fbadc30SMarc Zyngier u32 sec; 812fbadc30SMarc Zyngier u32 nsec; 822fbadc30SMarc Zyngier u32 sec_hi; 832fbadc30SMarc Zyngier } __attribute__((__packed__)); 842fbadc30SMarc Zyngier #endif 852fbadc30SMarc Zyngier 862fbadc30SMarc Zyngier #endif /* _ASM_ARM_XEN_INTERFACE_H */ 87