1da278d58SPhilippe Mathieu-Daudé /*
2da278d58SPhilippe Mathieu-Daudé * QEMU Xen support
3da278d58SPhilippe Mathieu-Daudé *
4da278d58SPhilippe Mathieu-Daudé * This work is licensed under the terms of the GNU GPL, version 2 or later.
5da278d58SPhilippe Mathieu-Daudé * See the COPYING file in the top-level directory.
6da278d58SPhilippe Mathieu-Daudé */
7da278d58SPhilippe Mathieu-Daudé
869700301SPhilippe Mathieu-Daudé /* header to be included in non-Xen-specific code */
969700301SPhilippe Mathieu-Daudé
10da278d58SPhilippe Mathieu-Daudé #ifndef SYSEMU_XEN_H
11da278d58SPhilippe Mathieu-Daudé #define SYSEMU_XEN_H
12da278d58SPhilippe Mathieu-Daudé
13261bbc3bSPhilippe Mathieu-Daudé #ifdef CONFIG_USER_ONLY
14261bbc3bSPhilippe Mathieu-Daudé #error Cannot include sysemu/xen.h from user emulation
15261bbc3bSPhilippe Mathieu-Daudé #endif
16261bbc3bSPhilippe Mathieu-Daudé
17ce6936bcSPhilippe Mathieu-Daudé #include "exec/cpu-common.h"
18ce6936bcSPhilippe Mathieu-Daudé
197d7a21baSPhilippe Mathieu-Daudé #ifdef COMPILING_PER_TARGET
20da278d58SPhilippe Mathieu-Daudé # ifdef CONFIG_XEN
218e0ef068SPhilippe Mathieu-Daudé # define CONFIG_XEN_IS_POSSIBLE
228e0ef068SPhilippe Mathieu-Daudé # endif
238e0ef068SPhilippe Mathieu-Daudé #else
248e0ef068SPhilippe Mathieu-Daudé # define CONFIG_XEN_IS_POSSIBLE
257d7a21baSPhilippe Mathieu-Daudé #endif /* COMPILING_PER_TARGET */
26da278d58SPhilippe Mathieu-Daudé
278e0ef068SPhilippe Mathieu-Daudé #ifdef CONFIG_XEN_IS_POSSIBLE
288e0ef068SPhilippe Mathieu-Daudé
298e0ef068SPhilippe Mathieu-Daudé extern bool xen_allowed;
308e0ef068SPhilippe Mathieu-Daudé
318e0ef068SPhilippe Mathieu-Daudé #define xen_enabled() (xen_allowed)
32da278d58SPhilippe Mathieu-Daudé
33da278d58SPhilippe Mathieu-Daudé void xen_hvm_modified_memory(ram_addr_t start, ram_addr_t length);
34da278d58SPhilippe Mathieu-Daudé void xen_ram_alloc(ram_addr_t ram_addr, ram_addr_t size,
35da278d58SPhilippe Mathieu-Daudé struct MemoryRegion *mr, Error **errp);
36da278d58SPhilippe Mathieu-Daudé
378e0ef068SPhilippe Mathieu-Daudé #else /* !CONFIG_XEN_IS_POSSIBLE */
38da278d58SPhilippe Mathieu-Daudé
39da278d58SPhilippe Mathieu-Daudé #define xen_enabled() 0
xen_hvm_modified_memory(ram_addr_t start,ram_addr_t length)40da278d58SPhilippe Mathieu-Daudé static inline void xen_hvm_modified_memory(ram_addr_t start, ram_addr_t length)
41da278d58SPhilippe Mathieu-Daudé {
42da278d58SPhilippe Mathieu-Daudé /* nothing */
43da278d58SPhilippe Mathieu-Daudé }
xen_ram_alloc(ram_addr_t ram_addr,ram_addr_t size,MemoryRegion * mr,Error ** errp)44da278d58SPhilippe Mathieu-Daudé static inline void xen_ram_alloc(ram_addr_t ram_addr, ram_addr_t size,
45da278d58SPhilippe Mathieu-Daudé MemoryRegion *mr, Error **errp)
46da278d58SPhilippe Mathieu-Daudé {
47da278d58SPhilippe Mathieu-Daudé g_assert_not_reached();
48da278d58SPhilippe Mathieu-Daudé }
49da278d58SPhilippe Mathieu-Daudé
508e0ef068SPhilippe Mathieu-Daudé #endif /* CONFIG_XEN_IS_POSSIBLE */
51da278d58SPhilippe Mathieu-Daudé
521be974bcSEdgar E. Iglesias bool xen_mr_is_memory(MemoryRegion *mr);
53*9ecdd4bfSEdgar E. Iglesias bool xen_mr_is_grants(MemoryRegion *mr);
54da278d58SPhilippe Mathieu-Daudé #endif
55