interface.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /******************************************************************************
  2. * Guest OS interface to ARM Xen.
  3. *
  4. * Stefano Stabellini <stefano.stabellini@eu.citrix.com>, Citrix, 2012
  5. */
  6. #ifndef _ASM_ARM_XEN_INTERFACE_H
  7. #define _ASM_ARM_XEN_INTERFACE_H
  8. #include <linux/types.h>
  9. #define uint64_aligned_t uint64_t __attribute__((aligned(8)))
  10. #define __DEFINE_GUEST_HANDLE(name, type) \
  11. typedef struct { union { type *p; uint64_aligned_t q; }; } \
  12. __guest_handle_ ## name
  13. #define DEFINE_GUEST_HANDLE_STRUCT(name) \
  14. __DEFINE_GUEST_HANDLE(name, struct name)
  15. #define DEFINE_GUEST_HANDLE(name) __DEFINE_GUEST_HANDLE(name, name)
  16. #define GUEST_HANDLE(name) __guest_handle_ ## name
  17. #define set_xen_guest_handle(hnd, val) \
  18. do { \
  19. if (sizeof(hnd) == 8) \
  20. *(uint64_t *)&(hnd) = 0; \
  21. (hnd).p = val; \
  22. } while (0)
  23. #define __HYPERVISOR_platform_op_raw __HYPERVISOR_platform_op
  24. #ifndef __ASSEMBLY__
  25. /* Explicitly size integers that represent pfns in the interface with
  26. * Xen so that we can have one ABI that works for 32 and 64 bit guests.
  27. * Note that this means that the xen_pfn_t type may be capable of
  28. * representing pfn's which the guest cannot represent in its own pfn
  29. * type. However since pfn space is controlled by the guest this is
  30. * fine since it simply wouldn't be able to create any sure pfns in
  31. * the first place.
  32. */
  33. typedef uint64_t xen_pfn_t;
  34. #define PRI_xen_pfn "llx"
  35. typedef uint64_t xen_ulong_t;
  36. #define PRI_xen_ulong "llx"
  37. typedef int64_t xen_long_t;
  38. #define PRI_xen_long "llx"
  39. /* Guest handles for primitive C types. */
  40. __DEFINE_GUEST_HANDLE(uchar, unsigned char);
  41. __DEFINE_GUEST_HANDLE(uint, unsigned int);
  42. DEFINE_GUEST_HANDLE(char);
  43. DEFINE_GUEST_HANDLE(int);
  44. DEFINE_GUEST_HANDLE(void);
  45. DEFINE_GUEST_HANDLE(uint64_t);
  46. DEFINE_GUEST_HANDLE(uint32_t);
  47. DEFINE_GUEST_HANDLE(xen_pfn_t);
  48. DEFINE_GUEST_HANDLE(xen_ulong_t);
  49. /* Maximum number of virtual CPUs in multi-processor guests. */
  50. #define MAX_VIRT_CPUS 1
  51. struct arch_vcpu_info { };
  52. struct arch_shared_info { };
  53. /* TODO: Move pvclock definitions some place arch independent */
  54. struct 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. /* It is OK to have a 12 bytes struct with no padding because it is packed */
  65. struct pvclock_wall_clock {
  66. u32 version;
  67. u32 sec;
  68. u32 nsec;
  69. u32 sec_hi;
  70. } __attribute__((__packed__));
  71. #endif
  72. #endif /* _ASM_ARM_XEN_INTERFACE_H */