xen.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #ifndef _XEN_XEN_H
  2. #define _XEN_XEN_H
  3. enum xen_domain_type {
  4. XEN_NATIVE, /* running on bare hardware */
  5. XEN_PV_DOMAIN, /* running in a PV domain */
  6. XEN_HVM_DOMAIN, /* running in a Xen hvm domain */
  7. };
  8. #ifdef CONFIG_XEN
  9. extern enum xen_domain_type xen_domain_type;
  10. #else
  11. #define xen_domain_type XEN_NATIVE
  12. #endif
  13. #define xen_domain() (xen_domain_type != XEN_NATIVE)
  14. #define xen_pv_domain() (xen_domain() && \
  15. xen_domain_type == XEN_PV_DOMAIN)
  16. #define xen_hvm_domain() (xen_domain() && \
  17. xen_domain_type == XEN_HVM_DOMAIN)
  18. #ifdef CONFIG_XEN_DOM0
  19. #include <xen/interface/xen.h>
  20. #include <asm/xen/hypervisor.h>
  21. #define xen_initial_domain() (xen_domain() && \
  22. xen_start_info && xen_start_info->flags & SIF_INITDOMAIN)
  23. #else /* !CONFIG_XEN_DOM0 */
  24. #define xen_initial_domain() (0)
  25. #endif /* CONFIG_XEN_DOM0 */
  26. #ifdef CONFIG_XEN_PVH
  27. /* This functionality exists only for x86. The XEN_PVHVM support exists
  28. * only in x86 world - hence on ARM it will be always disabled.
  29. * N.B. ARM guests are neither PV nor HVM nor PVHVM.
  30. * It's a bit like PVH but is different also (it's further towards the H
  31. * end of the spectrum than even PVH).
  32. */
  33. #include <xen/features.h>
  34. #define xen_pvh_domain() (xen_pv_domain() && \
  35. xen_feature(XENFEAT_auto_translated_physmap) && \
  36. xen_have_vector_callback)
  37. #else
  38. #define xen_pvh_domain() (0)
  39. #endif
  40. #endif /* _XEN_XEN_H */