]> git.proxmox.com Git - qemu.git/blame - hw/xen_common.h
usb: Pass the packet to the device's handle_control callback
[qemu.git] / hw / xen_common.h
CommitLineData
d94f9486
AL
1#ifndef QEMU_HW_XEN_COMMON_H
2#define QEMU_HW_XEN_COMMON_H 1
3
d5b93ddf
AP
4#include "config-host.h"
5
d94f9486
AL
6#include <stddef.h>
7#include <inttypes.h>
8
9#include <xenctrl.h>
10#include <xs.h>
11#include <xen/io/xenbus.h>
12
13#include "hw.h"
14#include "xen.h"
d8becc35 15#include "qemu-queue.h"
d94f9486
AL
16
17/*
d5b93ddf 18 * We don't support Xen prior to 3.3.0.
d94f9486 19 */
d5b93ddf
AP
20
21/* Xen before 4.0 */
22#if CONFIG_XEN_CTRL_INTERFACE_VERSION < 400
23static inline void *xc_map_foreign_bulk(int xc_handle, uint32_t dom, int prot,
24 xen_pfn_t *arr, int *err,
25 unsigned int num)
26{
27 return xc_map_foreign_batch(xc_handle, dom, prot, arr, num);
28}
d94f9486 29#endif
d5b93ddf
AP
30
31
32/* Xen before 4.1 */
33#if CONFIG_XEN_CTRL_INTERFACE_VERSION < 410
34
35typedef int XenXC;
36typedef int XenEvtchn;
37typedef int XenGnttab;
38
39# define XC_INTERFACE_FMT "%i"
40# define XC_HANDLER_INITIAL_VALUE -1
41
42static inline XenEvtchn xen_xc_evtchn_open(void *logger,
43 unsigned int open_flags)
44{
45 return xc_evtchn_open();
46}
47
48static inline XenGnttab xen_xc_gnttab_open(void *logger,
49 unsigned int open_flags)
50{
51 return xc_gnttab_open();
52}
53
54static inline XenXC xen_xc_interface_open(void *logger, void *dombuild_logger,
55 unsigned int open_flags)
56{
57 return xc_interface_open();
58}
59
60static inline int xc_fd(int xen_xc)
61{
62 return xen_xc;
63}
64
65
432d268c
JN
66static 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)
69{
70 return xc_domain_memory_populate_physmap
71 (xc_handle, domid, nr_extents, extent_order, mem_flags, extent_start);
72}
73
74
d5b93ddf
AP
75/* Xen 4.1 */
76#else
77
78typedef xc_interface *XenXC;
79typedef xc_evtchn *XenEvtchn;
80typedef xc_gnttab *XenGnttab;
81
82# define XC_INTERFACE_FMT "%p"
83# define XC_HANDLER_INITIAL_VALUE NULL
84
85static inline XenEvtchn xen_xc_evtchn_open(void *logger,
86 unsigned int open_flags)
87{
88 return xc_evtchn_open(logger, open_flags);
89}
90
91static inline XenGnttab xen_xc_gnttab_open(void *logger,
92 unsigned int open_flags)
93{
94 return xc_gnttab_open(logger, open_flags);
95}
96
97static inline XenXC xen_xc_interface_open(void *logger, void *dombuild_logger,
98 unsigned int open_flags)
99{
100 return xc_interface_open(logger, dombuild_logger, open_flags);
101}
102
103/* FIXME There is now way to have the xen fd */
104static inline int xc_fd(xc_interface *xen_xc)
105{
106 return -1;
107}
d94f9486
AL
108#endif
109
9ce94e7c
AS
110void destroy_hvm_domain(void);
111
d94f9486 112#endif /* QEMU_HW_XEN_COMMON_H */