xref: /openbmc/qemu/include/sysemu/xen.h (revision 71f364b7)
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 
8 #ifndef SYSEMU_XEN_H
9 #define SYSEMU_XEN_H
10 
11 #include "exec/cpu-common.h"
12 
13 #ifdef NEED_CPU_H
14 # ifdef CONFIG_XEN
15 #  define CONFIG_XEN_IS_POSSIBLE
16 # endif
17 #else
18 # define CONFIG_XEN_IS_POSSIBLE
19 #endif
20 
21 #ifdef CONFIG_XEN_IS_POSSIBLE
22 
23 extern bool xen_allowed;
24 
25 #define xen_enabled()           (xen_allowed)
26 
27 #ifndef CONFIG_USER_ONLY
28 void xen_hvm_modified_memory(ram_addr_t start, ram_addr_t length);
29 void xen_ram_alloc(ram_addr_t ram_addr, ram_addr_t size,
30                    struct MemoryRegion *mr, Error **errp);
31 #endif
32 
33 #else /* !CONFIG_XEN_IS_POSSIBLE */
34 
35 #define xen_enabled() 0
36 #ifndef CONFIG_USER_ONLY
37 static inline void xen_hvm_modified_memory(ram_addr_t start, ram_addr_t length)
38 {
39     /* nothing */
40 }
41 static inline void xen_ram_alloc(ram_addr_t ram_addr, ram_addr_t size,
42                                  MemoryRegion *mr, Error **errp)
43 {
44     g_assert_not_reached();
45 }
46 #endif
47 
48 #endif /* CONFIG_XEN_IS_POSSIBLE */
49 
50 #endif
51