2009-04-22 19:19:15 +04:00
|
|
|
#ifndef QEMU_HW_XEN_COMMON_H
|
2016-06-29 16:29:06 +03:00
|
|
|
#define QEMU_HW_XEN_COMMON_H
|
2009-04-22 19:19:15 +04:00
|
|
|
|
2016-01-15 16:23:42 +03:00
|
|
|
/*
|
|
|
|
* If we have new enough libxenctrl then we do not want/need these compat
|
|
|
|
* interfaces, despite what the user supplied cflags might say. They
|
|
|
|
* must be undefined before including xenctrl.h
|
|
|
|
*/
|
|
|
|
#undef XC_WANT_COMPAT_EVTCHN_API
|
|
|
|
#undef XC_WANT_COMPAT_GNTTAB_API
|
|
|
|
#undef XC_WANT_COMPAT_MAP_FOREIGN_API
|
|
|
|
|
2009-04-22 19:19:15 +04:00
|
|
|
#include <xenctrl.h>
|
2016-02-10 14:07:01 +03:00
|
|
|
#include <xenstore.h>
|
2009-04-22 19:19:15 +04:00
|
|
|
#include <xen/io/xenbus.h>
|
|
|
|
|
2013-02-04 18:40:22 +04:00
|
|
|
#include "hw/hw.h"
|
2013-02-05 20:06:20 +04:00
|
|
|
#include "hw/xen/xen.h"
|
2015-01-20 14:06:19 +03:00
|
|
|
#include "hw/pci/pci.h"
|
2012-12-17 21:20:00 +04:00
|
|
|
#include "qemu/queue.h"
|
2015-01-20 14:06:19 +03:00
|
|
|
#include "trace.h"
|
2009-04-22 19:19:15 +04:00
|
|
|
|
|
|
|
/*
|
2016-02-10 14:07:01 +03:00
|
|
|
* We don't support Xen prior to 4.2.0.
|
2009-04-22 19:19:15 +04:00
|
|
|
*/
|
2011-02-25 19:20:34 +03:00
|
|
|
|
2016-03-23 17:59:57 +03:00
|
|
|
/* Xen 4.2 through 4.6 */
|
2016-02-10 14:07:01 +03:00
|
|
|
#if CONFIG_XEN_CTRL_INTERFACE_VERSION < 471
|
2011-02-25 19:20:34 +03:00
|
|
|
|
2016-02-10 14:07:03 +03:00
|
|
|
typedef xc_interface xenforeignmemory_handle;
|
2016-01-15 16:23:38 +03:00
|
|
|
typedef xc_evtchn xenevtchn_handle;
|
2016-01-15 16:23:39 +03:00
|
|
|
typedef xc_gnttab xengnttab_handle;
|
2011-02-25 19:20:34 +03:00
|
|
|
|
2016-01-15 16:23:38 +03:00
|
|
|
#define xenevtchn_open(l, f) xc_evtchn_open(l, f);
|
|
|
|
#define xenevtchn_close(h) xc_evtchn_close(h)
|
|
|
|
#define xenevtchn_fd(h) xc_evtchn_fd(h)
|
|
|
|
#define xenevtchn_pending(h) xc_evtchn_pending(h)
|
|
|
|
#define xenevtchn_notify(h, p) xc_evtchn_notify(h, p)
|
|
|
|
#define xenevtchn_bind_interdomain(h, d, p) xc_evtchn_bind_interdomain(h, d, p)
|
|
|
|
#define xenevtchn_unmask(h, p) xc_evtchn_unmask(h, p)
|
|
|
|
#define xenevtchn_unbind(h, p) xc_evtchn_unbind(h, p)
|
2011-02-25 19:20:34 +03:00
|
|
|
|
2016-01-15 16:23:39 +03:00
|
|
|
#define xengnttab_open(l, f) xc_gnttab_open(l, f)
|
|
|
|
#define xengnttab_close(h) xc_gnttab_close(h)
|
|
|
|
#define xengnttab_set_max_grants(h, n) xc_gnttab_set_max_grants(h, n)
|
|
|
|
#define xengnttab_map_grant_ref(h, d, r, p) xc_gnttab_map_grant_ref(h, d, r, p)
|
|
|
|
#define xengnttab_unmap(h, a, n) xc_gnttab_munmap(h, a, n)
|
|
|
|
#define xengnttab_map_grant_refs(h, c, d, r, p) \
|
|
|
|
xc_gnttab_map_grant_refs(h, c, d, r, p)
|
2016-05-12 17:13:41 +03:00
|
|
|
#define xengnttab_map_domain_grant_refs(h, c, d, r, p) \
|
|
|
|
xc_gnttab_map_domain_grant_refs(h, c, d, r, p)
|
2011-02-25 19:20:34 +03:00
|
|
|
|
2016-02-10 14:07:04 +03:00
|
|
|
#define xenforeignmemory_open(l, f) xen_xc
|
|
|
|
|
|
|
|
static inline void *xenforeignmemory_map(xc_interface *h, uint32_t dom,
|
|
|
|
int prot, size_t pages,
|
|
|
|
const xen_pfn_t arr[/*pages*/],
|
|
|
|
int err[/*pages*/])
|
|
|
|
{
|
|
|
|
if (err)
|
|
|
|
return xc_map_foreign_bulk(h, dom, prot, arr, err, pages);
|
|
|
|
else
|
|
|
|
return xc_map_foreign_pages(h, dom, prot, arr, pages);
|
|
|
|
}
|
|
|
|
|
|
|
|
#define xenforeignmemory_unmap(h, p, s) munmap(p, s * XC_PAGE_SIZE)
|
xen: Switch uses of xc_map_foreign_{pages,bulk} to use libxenforeignmemory API.
In Xen 4.7 we are refactoring parts libxenctrl into a number of
separate libraries which will provide backward and forward API and ABI
compatiblity.
One such library will be libxenforeignmemory which provides access to
privileged foreign mappings and which will provide an interface
equivalent to xc_map_foreign_{pages,bulk}.
The new xenforeignmemory_map() function behaves like
xc_map_foreign_pages() when the err argument is NULL and like
xc_map_foreign_bulk() when err is non-NULL, which maps into the shim
here onto checking err == NULL and calling the appropriate old
function.
Note that xenforeignmemory_map() takes the number of pages before the
arrays themselves, in order to support potentially future use of
variable-length-arrays in the prototype (in the future, when Xen's
baseline toolchain requirements are new enough to ensure VLAs are
supported).
In preparation for adding support for libxenforeignmemory add support
to the <=4.0 and <=4.6 compat code in xen_common.h to allow us to
switch to using the new API. These shims will disappear for versions
of Xen which include libxenforeignmemory.
Since libxenforeignmemory will have its own handle type but for <= 4.6
the functionality is provided by using a libxenctrl handle we
introduce a new global xen_fmem alongside the existing xen_xc. In fact
we make xen_fmem a pointer to the existing xen_xc, which then works
correctly with both <=4.0 (xc handle is an int) and <=4.6 (xc handle
is a pointer). In the latter case xen_fmem is actually a double
indirect pointer, but it all falls out in the wash.
Unlike libxenctrl libxenforeignmemory has an explicit unmap function,
rather than just specifying that munmap should be used, so the unmap
paths are updated to use xenforeignmemory_unmap, which is a shim for
munmap on these versions of xen. The mappings in xen-hvm.c do not
appear to be unmapped (which makes sense for a qemu-dm process)
In fb_disconnect this results in a change from simply mmap over the
existing mapping (with an implicit munmap) to expliclty unmapping with
xenforeignmemory_unmap and then mapping the required anonymous memory
in the same hole. I don't think this is a problem since any other
thread which was racily touching this region would already be running
the risk of hitting the mapping halfway through the call. If this is
thought to be a problem then we could consider adding an extra API to
the libxenforeignmemory interface to replace a foreign mapping with
anonymous shared memory, but I'd prefer not to.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2016-01-15 16:23:41 +03:00
|
|
|
|
2016-01-15 16:23:42 +03:00
|
|
|
#else /* CONFIG_XEN_CTRL_INTERFACE_VERSION >= 471 */
|
|
|
|
|
|
|
|
#include <xenevtchn.h>
|
|
|
|
#include <xengnttab.h>
|
|
|
|
#include <xenforeignmemory.h>
|
|
|
|
|
2009-04-22 19:19:15 +04:00
|
|
|
#endif
|
|
|
|
|
2012-05-17 14:33:09 +04:00
|
|
|
void destroy_hvm_domain(bool reboot);
|
2010-09-06 23:07:14 +04:00
|
|
|
|
2012-06-21 19:40:09 +04:00
|
|
|
/* shutdown/destroy current domain because of an error */
|
|
|
|
void xen_shutdown_fatal_error(const char *fmt, ...) GCC_FMT_ATTR(1, 2);
|
|
|
|
|
2014-10-20 23:49:12 +04:00
|
|
|
#ifdef HVM_PARAM_VMPORT_REGS_PFN
|
2016-02-10 14:07:03 +03:00
|
|
|
static inline int xen_get_vmport_regs_pfn(xc_interface *xc, domid_t dom,
|
2015-01-23 15:09:47 +03:00
|
|
|
xen_pfn_t *vmport_regs_pfn)
|
2014-10-20 23:49:12 +04:00
|
|
|
{
|
2015-01-23 15:09:47 +03:00
|
|
|
int rc;
|
|
|
|
uint64_t value;
|
|
|
|
rc = xc_hvm_param_get(xc, dom, HVM_PARAM_VMPORT_REGS_PFN, &value);
|
|
|
|
if (rc >= 0) {
|
|
|
|
*vmport_regs_pfn = (xen_pfn_t) value;
|
|
|
|
}
|
|
|
|
return rc;
|
2014-10-20 23:49:12 +04:00
|
|
|
}
|
|
|
|
#else
|
2016-02-10 14:07:03 +03:00
|
|
|
static inline int xen_get_vmport_regs_pfn(xc_interface *xc, domid_t dom,
|
2015-01-23 15:09:47 +03:00
|
|
|
xen_pfn_t *vmport_regs_pfn)
|
2014-10-20 23:49:12 +04:00
|
|
|
{
|
|
|
|
return -ENOSYS;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2015-07-24 12:38:28 +03:00
|
|
|
/* Xen before 4.6 */
|
|
|
|
#if CONFIG_XEN_CTRL_INTERFACE_VERSION < 460
|
|
|
|
|
|
|
|
#ifndef HVM_IOREQSRV_BUFIOREQ_ATOMIC
|
|
|
|
#define HVM_IOREQSRV_BUFIOREQ_ATOMIC 2
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2015-01-20 14:06:19 +03:00
|
|
|
/* Xen before 4.5 */
|
|
|
|
#if CONFIG_XEN_CTRL_INTERFACE_VERSION < 450
|
|
|
|
|
|
|
|
#ifndef HVM_PARAM_BUFIOREQ_EVTCHN
|
|
|
|
#define HVM_PARAM_BUFIOREQ_EVTCHN 26
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define IOREQ_TYPE_PCI_CONFIG 2
|
|
|
|
|
2015-07-07 16:32:38 +03:00
|
|
|
typedef uint16_t ioservid_t;
|
2015-01-20 14:06:19 +03:00
|
|
|
|
2016-02-10 14:07:03 +03:00
|
|
|
static inline void xen_map_memory_section(xc_interface *xc, domid_t dom,
|
2015-01-20 14:06:19 +03:00
|
|
|
ioservid_t ioservid,
|
|
|
|
MemoryRegionSection *section)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2016-02-10 14:07:03 +03:00
|
|
|
static inline void xen_unmap_memory_section(xc_interface *xc, domid_t dom,
|
2015-01-20 14:06:19 +03:00
|
|
|
ioservid_t ioservid,
|
|
|
|
MemoryRegionSection *section)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2016-02-10 14:07:03 +03:00
|
|
|
static inline void xen_map_io_section(xc_interface *xc, domid_t dom,
|
2015-01-20 14:06:19 +03:00
|
|
|
ioservid_t ioservid,
|
|
|
|
MemoryRegionSection *section)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2016-02-10 14:07:03 +03:00
|
|
|
static inline void xen_unmap_io_section(xc_interface *xc, domid_t dom,
|
2015-01-20 14:06:19 +03:00
|
|
|
ioservid_t ioservid,
|
|
|
|
MemoryRegionSection *section)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2016-02-10 14:07:03 +03:00
|
|
|
static inline void xen_map_pcidev(xc_interface *xc, domid_t dom,
|
2015-01-20 14:06:19 +03:00
|
|
|
ioservid_t ioservid,
|
|
|
|
PCIDevice *pci_dev)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2016-02-10 14:07:03 +03:00
|
|
|
static inline void xen_unmap_pcidev(xc_interface *xc, domid_t dom,
|
2015-01-20 14:06:19 +03:00
|
|
|
ioservid_t ioservid,
|
|
|
|
PCIDevice *pci_dev)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2016-02-10 14:07:03 +03:00
|
|
|
static inline int xen_create_ioreq_server(xc_interface *xc, domid_t dom,
|
2015-01-20 14:06:19 +03:00
|
|
|
ioservid_t *ioservid)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2016-02-10 14:07:03 +03:00
|
|
|
static inline void xen_destroy_ioreq_server(xc_interface *xc, domid_t dom,
|
2015-01-20 14:06:19 +03:00
|
|
|
ioservid_t ioservid)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2016-02-10 14:07:03 +03:00
|
|
|
static inline int xen_get_ioreq_server_info(xc_interface *xc, domid_t dom,
|
2015-01-20 14:06:19 +03:00
|
|
|
ioservid_t ioservid,
|
|
|
|
xen_pfn_t *ioreq_pfn,
|
|
|
|
xen_pfn_t *bufioreq_pfn,
|
|
|
|
evtchn_port_t *bufioreq_evtchn)
|
|
|
|
{
|
|
|
|
unsigned long param;
|
|
|
|
int rc;
|
|
|
|
|
|
|
|
rc = xc_get_hvm_param(xc, dom, HVM_PARAM_IOREQ_PFN, ¶m);
|
|
|
|
if (rc < 0) {
|
|
|
|
fprintf(stderr, "failed to get HVM_PARAM_IOREQ_PFN\n");
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
*ioreq_pfn = param;
|
|
|
|
|
|
|
|
rc = xc_get_hvm_param(xc, dom, HVM_PARAM_BUFIOREQ_PFN, ¶m);
|
|
|
|
if (rc < 0) {
|
|
|
|
fprintf(stderr, "failed to get HVM_PARAM_BUFIOREQ_PFN\n");
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
*bufioreq_pfn = param;
|
|
|
|
|
|
|
|
rc = xc_get_hvm_param(xc, dom, HVM_PARAM_BUFIOREQ_EVTCHN,
|
|
|
|
¶m);
|
|
|
|
if (rc < 0) {
|
|
|
|
fprintf(stderr, "failed to get HVM_PARAM_BUFIOREQ_EVTCHN\n");
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
*bufioreq_evtchn = param;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2016-02-10 14:07:03 +03:00
|
|
|
static inline int xen_set_ioreq_server_state(xc_interface *xc, domid_t dom,
|
2015-01-20 14:06:19 +03:00
|
|
|
ioservid_t ioservid,
|
|
|
|
bool enable)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Xen 4.5 */
|
|
|
|
#else
|
|
|
|
|
2016-02-10 14:07:03 +03:00
|
|
|
static inline void xen_map_memory_section(xc_interface *xc, domid_t dom,
|
2015-01-20 14:06:19 +03:00
|
|
|
ioservid_t ioservid,
|
|
|
|
MemoryRegionSection *section)
|
|
|
|
{
|
|
|
|
hwaddr start_addr = section->offset_within_address_space;
|
|
|
|
ram_addr_t size = int128_get64(section->size);
|
|
|
|
hwaddr end_addr = start_addr + size - 1;
|
|
|
|
|
|
|
|
trace_xen_map_mmio_range(ioservid, start_addr, end_addr);
|
|
|
|
xc_hvm_map_io_range_to_ioreq_server(xc, dom, ioservid, 1,
|
|
|
|
start_addr, end_addr);
|
|
|
|
}
|
|
|
|
|
2016-02-10 14:07:03 +03:00
|
|
|
static inline void xen_unmap_memory_section(xc_interface *xc, domid_t dom,
|
2015-01-20 14:06:19 +03:00
|
|
|
ioservid_t ioservid,
|
|
|
|
MemoryRegionSection *section)
|
|
|
|
{
|
|
|
|
hwaddr start_addr = section->offset_within_address_space;
|
|
|
|
ram_addr_t size = int128_get64(section->size);
|
|
|
|
hwaddr end_addr = start_addr + size - 1;
|
|
|
|
|
|
|
|
trace_xen_unmap_mmio_range(ioservid, start_addr, end_addr);
|
|
|
|
xc_hvm_unmap_io_range_from_ioreq_server(xc, dom, ioservid, 1,
|
|
|
|
start_addr, end_addr);
|
|
|
|
}
|
|
|
|
|
2016-02-10 14:07:03 +03:00
|
|
|
static inline void xen_map_io_section(xc_interface *xc, domid_t dom,
|
2015-01-20 14:06:19 +03:00
|
|
|
ioservid_t ioservid,
|
|
|
|
MemoryRegionSection *section)
|
|
|
|
{
|
|
|
|
hwaddr start_addr = section->offset_within_address_space;
|
|
|
|
ram_addr_t size = int128_get64(section->size);
|
|
|
|
hwaddr end_addr = start_addr + size - 1;
|
|
|
|
|
|
|
|
trace_xen_map_portio_range(ioservid, start_addr, end_addr);
|
|
|
|
xc_hvm_map_io_range_to_ioreq_server(xc, dom, ioservid, 0,
|
|
|
|
start_addr, end_addr);
|
|
|
|
}
|
|
|
|
|
2016-02-10 14:07:03 +03:00
|
|
|
static inline void xen_unmap_io_section(xc_interface *xc, domid_t dom,
|
2015-01-20 14:06:19 +03:00
|
|
|
ioservid_t ioservid,
|
|
|
|
MemoryRegionSection *section)
|
|
|
|
{
|
|
|
|
hwaddr start_addr = section->offset_within_address_space;
|
|
|
|
ram_addr_t size = int128_get64(section->size);
|
|
|
|
hwaddr end_addr = start_addr + size - 1;
|
|
|
|
|
|
|
|
trace_xen_unmap_portio_range(ioservid, start_addr, end_addr);
|
|
|
|
xc_hvm_unmap_io_range_from_ioreq_server(xc, dom, ioservid, 0,
|
|
|
|
start_addr, end_addr);
|
|
|
|
}
|
|
|
|
|
2016-02-10 14:07:03 +03:00
|
|
|
static inline void xen_map_pcidev(xc_interface *xc, domid_t dom,
|
2015-01-20 14:06:19 +03:00
|
|
|
ioservid_t ioservid,
|
|
|
|
PCIDevice *pci_dev)
|
|
|
|
{
|
|
|
|
trace_xen_map_pcidev(ioservid, pci_bus_num(pci_dev->bus),
|
|
|
|
PCI_SLOT(pci_dev->devfn), PCI_FUNC(pci_dev->devfn));
|
|
|
|
xc_hvm_map_pcidev_to_ioreq_server(xc, dom, ioservid,
|
|
|
|
0, pci_bus_num(pci_dev->bus),
|
|
|
|
PCI_SLOT(pci_dev->devfn),
|
|
|
|
PCI_FUNC(pci_dev->devfn));
|
|
|
|
}
|
|
|
|
|
2016-02-10 14:07:03 +03:00
|
|
|
static inline void xen_unmap_pcidev(xc_interface *xc, domid_t dom,
|
2015-01-20 14:06:19 +03:00
|
|
|
ioservid_t ioservid,
|
|
|
|
PCIDevice *pci_dev)
|
|
|
|
{
|
|
|
|
trace_xen_unmap_pcidev(ioservid, pci_bus_num(pci_dev->bus),
|
|
|
|
PCI_SLOT(pci_dev->devfn), PCI_FUNC(pci_dev->devfn));
|
|
|
|
xc_hvm_unmap_pcidev_from_ioreq_server(xc, dom, ioservid,
|
|
|
|
0, pci_bus_num(pci_dev->bus),
|
|
|
|
PCI_SLOT(pci_dev->devfn),
|
|
|
|
PCI_FUNC(pci_dev->devfn));
|
|
|
|
}
|
|
|
|
|
2016-02-10 14:07:03 +03:00
|
|
|
static inline int xen_create_ioreq_server(xc_interface *xc, domid_t dom,
|
2015-01-20 14:06:19 +03:00
|
|
|
ioservid_t *ioservid)
|
|
|
|
{
|
2015-07-24 12:38:28 +03:00
|
|
|
int rc = xc_hvm_create_ioreq_server(xc, dom, HVM_IOREQSRV_BUFIOREQ_ATOMIC,
|
|
|
|
ioservid);
|
2015-01-20 14:06:19 +03:00
|
|
|
|
|
|
|
if (rc == 0) {
|
|
|
|
trace_xen_ioreq_server_create(*ioservid);
|
|
|
|
}
|
|
|
|
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
2016-02-10 14:07:03 +03:00
|
|
|
static inline void xen_destroy_ioreq_server(xc_interface *xc, domid_t dom,
|
2015-01-20 14:06:19 +03:00
|
|
|
ioservid_t ioservid)
|
|
|
|
{
|
|
|
|
trace_xen_ioreq_server_destroy(ioservid);
|
|
|
|
xc_hvm_destroy_ioreq_server(xc, dom, ioservid);
|
|
|
|
}
|
|
|
|
|
2016-02-10 14:07:03 +03:00
|
|
|
static inline int xen_get_ioreq_server_info(xc_interface *xc, domid_t dom,
|
2015-01-20 14:06:19 +03:00
|
|
|
ioservid_t ioservid,
|
|
|
|
xen_pfn_t *ioreq_pfn,
|
|
|
|
xen_pfn_t *bufioreq_pfn,
|
|
|
|
evtchn_port_t *bufioreq_evtchn)
|
|
|
|
{
|
|
|
|
return xc_hvm_get_ioreq_server_info(xc, dom, ioservid,
|
|
|
|
ioreq_pfn, bufioreq_pfn,
|
|
|
|
bufioreq_evtchn);
|
|
|
|
}
|
|
|
|
|
2016-02-10 14:07:03 +03:00
|
|
|
static inline int xen_set_ioreq_server_state(xc_interface *xc, domid_t dom,
|
2015-01-20 14:06:19 +03:00
|
|
|
ioservid_t ioservid,
|
|
|
|
bool enable)
|
|
|
|
{
|
|
|
|
trace_xen_ioreq_server_state(ioservid, enable);
|
|
|
|
return xc_hvm_set_ioreq_server_state(xc, dom, ioservid, enable);
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2015-06-29 19:51:05 +03:00
|
|
|
#if CONFIG_XEN_CTRL_INTERFACE_VERSION < 460
|
2016-02-10 14:07:03 +03:00
|
|
|
static inline int xen_xc_domain_add_to_physmap(xc_interface *xch, uint32_t domid,
|
2015-06-29 19:51:05 +03:00
|
|
|
unsigned int space,
|
|
|
|
unsigned long idx,
|
|
|
|
xen_pfn_t gpfn)
|
|
|
|
{
|
|
|
|
return xc_domain_add_to_physmap(xch, domid, space, idx, gpfn);
|
|
|
|
}
|
|
|
|
#else
|
2016-02-10 14:07:03 +03:00
|
|
|
static inline int xen_xc_domain_add_to_physmap(xc_interface *xch, uint32_t domid,
|
2015-06-29 19:51:05 +03:00
|
|
|
unsigned int space,
|
|
|
|
unsigned long idx,
|
|
|
|
xen_pfn_t gpfn)
|
|
|
|
{
|
|
|
|
/* In Xen 4.6 rc is -1 and errno contains the error value. */
|
|
|
|
int rc = xc_domain_add_to_physmap(xch, domid, space, idx, gpfn);
|
|
|
|
if (rc == -1)
|
|
|
|
return errno;
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2016-01-15 16:23:44 +03:00
|
|
|
#ifdef CONFIG_XEN_PV_DOMAIN_BUILD
|
2015-11-13 20:38:06 +03:00
|
|
|
#if CONFIG_XEN_CTRL_INTERFACE_VERSION < 470
|
2016-02-10 14:07:03 +03:00
|
|
|
static inline int xen_domain_create(xc_interface *xc, uint32_t ssidref,
|
2015-11-13 20:38:06 +03:00
|
|
|
xen_domain_handle_t handle, uint32_t flags,
|
|
|
|
uint32_t *pdomid)
|
|
|
|
{
|
|
|
|
return xc_domain_create(xc, ssidref, handle, flags, pdomid);
|
|
|
|
}
|
|
|
|
#else
|
2016-02-10 14:07:03 +03:00
|
|
|
static inline int xen_domain_create(xc_interface *xc, uint32_t ssidref,
|
2015-11-13 20:38:06 +03:00
|
|
|
xen_domain_handle_t handle, uint32_t flags,
|
|
|
|
uint32_t *pdomid)
|
|
|
|
{
|
|
|
|
return xc_domain_create(xc, ssidref, handle, flags, pdomid, NULL);
|
|
|
|
}
|
|
|
|
#endif
|
2016-01-15 16:23:44 +03:00
|
|
|
#endif
|
2015-11-13 20:38:06 +03:00
|
|
|
|
2009-04-22 19:19:15 +04:00
|
|
|
#endif /* QEMU_HW_XEN_COMMON_H */
|