xen.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. * QEMU Xen support
  3. *
  4. * This work is licensed under the terms of the GNU GPL, version 2 or later.
  5. * See the COPYING file in the top-level directory.
  6. */
  7. /* header to be included in non-Xen-specific code */
  8. #ifndef SYSTEM_XEN_H
  9. #define SYSTEM_XEN_H
  10. #ifdef CONFIG_USER_ONLY
  11. #error Cannot include system/xen.h from user emulation
  12. #endif
  13. #include "exec/cpu-common.h"
  14. #ifdef COMPILING_PER_TARGET
  15. # ifdef CONFIG_XEN
  16. # define CONFIG_XEN_IS_POSSIBLE
  17. # endif
  18. #else
  19. # define CONFIG_XEN_IS_POSSIBLE
  20. #endif /* COMPILING_PER_TARGET */
  21. #ifdef CONFIG_XEN_IS_POSSIBLE
  22. extern bool xen_allowed;
  23. #define xen_enabled() (xen_allowed)
  24. void xen_hvm_modified_memory(ram_addr_t start, ram_addr_t length);
  25. void xen_ram_alloc(ram_addr_t ram_addr, ram_addr_t size,
  26. struct MemoryRegion *mr, Error **errp);
  27. #else /* !CONFIG_XEN_IS_POSSIBLE */
  28. #define xen_enabled() 0
  29. static inline void xen_hvm_modified_memory(ram_addr_t start, ram_addr_t length)
  30. {
  31. /* nothing */
  32. }
  33. static inline void xen_ram_alloc(ram_addr_t ram_addr, ram_addr_t size,
  34. MemoryRegion *mr, Error **errp)
  35. {
  36. g_assert_not_reached();
  37. }
  38. #endif /* CONFIG_XEN_IS_POSSIBLE */
  39. bool xen_mr_is_memory(MemoryRegion *mr);
  40. bool xen_mr_is_grants(MemoryRegion *mr);
  41. #endif