interface.h 2.4 KB

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