1 #ifndef QEMU_HW_XEN_COMMON_H
2 #define QEMU_HW_XEN_COMMON_H 1
4 #include "config-host.h"
11 #include <xen/io/xenbus.h>
15 #include "qemu-queue.h"
18 * We don't support Xen prior to 3.3.0.
22 #if CONFIG_XEN_CTRL_INTERFACE_VERSION < 400
23 static inline void *xc_map_foreign_bulk(int xc_handle
, uint32_t dom
, int prot
,
24 xen_pfn_t
*arr
, int *err
,
27 return xc_map_foreign_batch(xc_handle
, dom
, prot
, arr
, num
);
33 #if CONFIG_XEN_CTRL_INTERFACE_VERSION < 410
36 typedef int XenEvtchn
;
37 typedef int XenGnttab
;
39 # define XC_INTERFACE_FMT "%i"
40 # define XC_HANDLER_INITIAL_VALUE -1
42 static inline XenEvtchn
xen_xc_evtchn_open(void *logger
,
43 unsigned int open_flags
)
45 return xc_evtchn_open();
48 static inline XenGnttab
xen_xc_gnttab_open(void *logger
,
49 unsigned int open_flags
)
51 return xc_gnttab_open();
54 static inline XenXC
xen_xc_interface_open(void *logger
, void *dombuild_logger
,
55 unsigned int open_flags
)
57 return xc_interface_open();
60 static inline int xc_fd(int xen_xc
)
66 static inline int xc_domain_populate_physmap_exact
67 (XenXC xc_handle
, uint32_t domid
, unsigned long nr_extents
,
68 unsigned int extent_order
, unsigned int mem_flags
, xen_pfn_t
*extent_start
)
70 return xc_domain_memory_populate_physmap
71 (xc_handle
, domid
, nr_extents
, extent_order
, mem_flags
, extent_start
);
74 static inline int xc_domain_add_to_physmap(int xc_handle
, uint32_t domid
,
75 unsigned int space
, unsigned long idx
,
78 struct xen_add_to_physmap xatp
= {
85 return xc_memory_op(xc_handle
, XENMEM_add_to_physmap
, &xatp
);
88 static inline struct xs_handle
*xs_open(unsigned long flags
)
90 return xs_daemon_open();
93 static inline void xs_close(struct xs_handle
*xsh
)
104 typedef xc_interface
*XenXC
;
105 typedef xc_evtchn
*XenEvtchn
;
106 typedef xc_gnttab
*XenGnttab
;
108 # define XC_INTERFACE_FMT "%p"
109 # define XC_HANDLER_INITIAL_VALUE NULL
111 static inline XenEvtchn
xen_xc_evtchn_open(void *logger
,
112 unsigned int open_flags
)
114 return xc_evtchn_open(logger
, open_flags
);
117 static inline XenGnttab
xen_xc_gnttab_open(void *logger
,
118 unsigned int open_flags
)
120 return xc_gnttab_open(logger
, open_flags
);
123 static inline XenXC
xen_xc_interface_open(void *logger
, void *dombuild_logger
,
124 unsigned int open_flags
)
126 return xc_interface_open(logger
, dombuild_logger
, open_flags
);
129 /* FIXME There is now way to have the xen fd */
130 static inline int xc_fd(xc_interface
*xen_xc
)
137 #if CONFIG_XEN_CTRL_INTERFACE_VERSION < 420
138 static inline int xen_xc_hvm_inject_msi(XenXC xen_xc
, domid_t dom
,
139 uint64_t addr
, uint32_t data
)
144 static inline int xen_xc_hvm_inject_msi(XenXC xen_xc
, domid_t dom
,
145 uint64_t addr
, uint32_t data
)
147 return xc_hvm_inject_msi(xen_xc
, dom
, addr
, data
);
151 void destroy_hvm_domain(void);
153 #endif /* QEMU_HW_XEN_COMMON_H */