|
Daniel P. Berrange |
1e96c6 |
From c4fa82c4d243730daccdf5b6668fb8e559460a76 Mon Sep 17 00:00:00 2001
|
|
Daniel P. Berrange |
1e96c6 |
From: Paul Durrant <paul.durrant@citrix.com>
|
|
Daniel P. Berrange |
1e96c6 |
Date: Tue, 7 Mar 2017 10:55:34 +0000
|
|
Daniel P. Berrange |
1e96c6 |
Subject: [PATCH 5/6] xen: use libxendevicemodel when available
|
|
Daniel P. Berrange |
1e96c6 |
|
|
Daniel P. Berrange |
1e96c6 |
This patch modifies the wrapper functions in xen_common.h to use the
|
|
Daniel P. Berrange |
1e96c6 |
new xendevicemodel interface if it is available along with compatibility
|
|
Daniel P. Berrange |
1e96c6 |
code to use the old libxenctrl interface if it is not.
|
|
Daniel P. Berrange |
1e96c6 |
|
|
Daniel P. Berrange |
1e96c6 |
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
|
|
Daniel P. Berrange |
1e96c6 |
Signed-off-by: Stefano Stabellini <sstabellini@kernel.org>
|
|
Daniel P. Berrange |
1e96c6 |
Reviewed-by: Anthony Perard <anthony.perard@citrix.com>
|
|
Daniel P. Berrange |
1e96c6 |
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
|
|
Daniel P. Berrange |
1e96c6 |
(cherry picked from commit d655f34e6d6a68f64e885fa85295e0c7a31ce846)
|
|
Daniel P. Berrange |
1e96c6 |
---
|
|
Daniel P. Berrange |
1e96c6 |
include/hw/xen/xen_common.h | 203 +++++++++++++++++++++++++++++++++++++-------
|
|
Daniel P. Berrange |
1e96c6 |
xen-common.c | 8 ++
|
|
Daniel P. Berrange |
1e96c6 |
2 files changed, 178 insertions(+), 33 deletions(-)
|
|
Daniel P. Berrange |
1e96c6 |
|
|
Daniel P. Berrange |
1e96c6 |
diff --git a/include/hw/xen/xen_common.h b/include/hw/xen/xen_common.h
|
|
Daniel P. Berrange |
1e96c6 |
index 31cf25f846..b1f5f53e35 100644
|
|
Daniel P. Berrange |
1e96c6 |
--- a/include/hw/xen/xen_common.h
|
|
Daniel P. Berrange |
1e96c6 |
+++ b/include/hw/xen/xen_common.h
|
|
Daniel P. Berrange |
1e96c6 |
@@ -26,48 +26,184 @@ extern xc_interface *xen_xc;
|
|
Daniel P. Berrange |
1e96c6 |
* We don't support Xen prior to 4.2.0.
|
|
Daniel P. Berrange |
1e96c6 |
*/
|
|
Daniel P. Berrange |
1e96c6 |
|
|
Daniel P. Berrange |
1e96c6 |
+#if CONFIG_XEN_CTRL_INTERFACE_VERSION < 490
|
|
Daniel P. Berrange |
1e96c6 |
+
|
|
Daniel P. Berrange |
1e96c6 |
+typedef xc_interface xendevicemodel_handle;
|
|
Daniel P. Berrange |
1e96c6 |
+
|
|
Daniel P. Berrange |
1e96c6 |
+static inline xendevicemodel_handle *xendevicemodel_open(
|
|
Daniel P. Berrange |
1e96c6 |
+ struct xentoollog_logger *logger, unsigned int open_flags)
|
|
Daniel P. Berrange |
1e96c6 |
+{
|
|
Daniel P. Berrange |
1e96c6 |
+ return xen_xc;
|
|
Daniel P. Berrange |
1e96c6 |
+}
|
|
Daniel P. Berrange |
1e96c6 |
+
|
|
Daniel P. Berrange |
1e96c6 |
+#if CONFIG_XEN_CTRL_INTERFACE_VERSION >= 450
|
|
Daniel P. Berrange |
1e96c6 |
+
|
|
Daniel P. Berrange |
1e96c6 |
+static inline int xendevicemodel_create_ioreq_server(
|
|
Daniel P. Berrange |
1e96c6 |
+ xendevicemodel_handle *dmod, domid_t domid, int handle_bufioreq,
|
|
Daniel P. Berrange |
1e96c6 |
+ ioservid_t *id)
|
|
Daniel P. Berrange |
1e96c6 |
+{
|
|
Daniel P. Berrange |
1e96c6 |
+ return xc_hvm_create_ioreq_server(dmod, domid, handle_bufioreq,
|
|
Daniel P. Berrange |
1e96c6 |
+ id);
|
|
Daniel P. Berrange |
1e96c6 |
+}
|
|
Daniel P. Berrange |
1e96c6 |
+
|
|
Daniel P. Berrange |
1e96c6 |
+static inline int xendevicemodel_get_ioreq_server_info(
|
|
Daniel P. Berrange |
1e96c6 |
+ xendevicemodel_handle *dmod, domid_t domid, ioservid_t id,
|
|
Daniel P. Berrange |
1e96c6 |
+ xen_pfn_t *ioreq_pfn, xen_pfn_t *bufioreq_pfn,
|
|
Daniel P. Berrange |
1e96c6 |
+ evtchn_port_t *bufioreq_port)
|
|
Daniel P. Berrange |
1e96c6 |
+{
|
|
Daniel P. Berrange |
1e96c6 |
+ return xc_hvm_get_ioreq_server_info(dmod, domid, id, ioreq_pfn,
|
|
Daniel P. Berrange |
1e96c6 |
+ bufioreq_pfn, bufioreq_port);
|
|
Daniel P. Berrange |
1e96c6 |
+}
|
|
Daniel P. Berrange |
1e96c6 |
+
|
|
Daniel P. Berrange |
1e96c6 |
+static inline int xendevicemodel_map_io_range_to_ioreq_server(
|
|
Daniel P. Berrange |
1e96c6 |
+ xendevicemodel_handle *dmod, domid_t domid, ioservid_t id, int is_mmio,
|
|
Daniel P. Berrange |
1e96c6 |
+ uint64_t start, uint64_t end)
|
|
Daniel P. Berrange |
1e96c6 |
+{
|
|
Daniel P. Berrange |
1e96c6 |
+ return xc_hvm_map_io_range_to_ioreq_server(dmod, domid, id, is_mmio,
|
|
Daniel P. Berrange |
1e96c6 |
+ start, end);
|
|
Daniel P. Berrange |
1e96c6 |
+}
|
|
Daniel P. Berrange |
1e96c6 |
+
|
|
Daniel P. Berrange |
1e96c6 |
+static inline int xendevicemodel_unmap_io_range_from_ioreq_server(
|
|
Daniel P. Berrange |
1e96c6 |
+ xendevicemodel_handle *dmod, domid_t domid, ioservid_t id, int is_mmio,
|
|
Daniel P. Berrange |
1e96c6 |
+ uint64_t start, uint64_t end)
|
|
Daniel P. Berrange |
1e96c6 |
+{
|
|
Daniel P. Berrange |
1e96c6 |
+ return xc_hvm_unmap_io_range_from_ioreq_server(dmod, domid, id, is_mmio,
|
|
Daniel P. Berrange |
1e96c6 |
+ start, end);
|
|
Daniel P. Berrange |
1e96c6 |
+}
|
|
Daniel P. Berrange |
1e96c6 |
+
|
|
Daniel P. Berrange |
1e96c6 |
+static inline int xendevicemodel_map_pcidev_to_ioreq_server(
|
|
Daniel P. Berrange |
1e96c6 |
+ xendevicemodel_handle *dmod, domid_t domid, ioservid_t id,
|
|
Daniel P. Berrange |
1e96c6 |
+ uint16_t segment, uint8_t bus, uint8_t device, uint8_t function)
|
|
Daniel P. Berrange |
1e96c6 |
+{
|
|
Daniel P. Berrange |
1e96c6 |
+ return xc_hvm_map_pcidev_to_ioreq_server(dmod, domid, id, segment,
|
|
Daniel P. Berrange |
1e96c6 |
+ bus, device, function);
|
|
Daniel P. Berrange |
1e96c6 |
+}
|
|
Daniel P. Berrange |
1e96c6 |
+
|
|
Daniel P. Berrange |
1e96c6 |
+static inline int xendevicemodel_unmap_pcidev_from_ioreq_server(
|
|
Daniel P. Berrange |
1e96c6 |
+ xendevicemodel_handle *dmod, domid_t domid, ioservid_t id,
|
|
Daniel P. Berrange |
1e96c6 |
+ uint16_t segment, uint8_t bus, uint8_t device, uint8_t function)
|
|
Daniel P. Berrange |
1e96c6 |
+{
|
|
Daniel P. Berrange |
1e96c6 |
+ return xc_hvm_unmap_pcidev_from_ioreq_server(dmod, domid, id, segment,
|
|
Daniel P. Berrange |
1e96c6 |
+ bus, device, function);
|
|
Daniel P. Berrange |
1e96c6 |
+}
|
|
Daniel P. Berrange |
1e96c6 |
+
|
|
Daniel P. Berrange |
1e96c6 |
+static inline int xendevicemodel_destroy_ioreq_server(
|
|
Daniel P. Berrange |
1e96c6 |
+ xendevicemodel_handle *dmod, domid_t domid, ioservid_t id)
|
|
Daniel P. Berrange |
1e96c6 |
+{
|
|
Daniel P. Berrange |
1e96c6 |
+ return xc_hvm_destroy_ioreq_server(dmod, domid, id);
|
|
Daniel P. Berrange |
1e96c6 |
+}
|
|
Daniel P. Berrange |
1e96c6 |
+
|
|
Daniel P. Berrange |
1e96c6 |
+static inline int xendevicemodel_set_ioreq_server_state(
|
|
Daniel P. Berrange |
1e96c6 |
+ xendevicemodel_handle *dmod, domid_t domid, ioservid_t id, int enabled)
|
|
Daniel P. Berrange |
1e96c6 |
+{
|
|
Daniel P. Berrange |
1e96c6 |
+ return xc_hvm_set_ioreq_server_state(dmod, domid, id, enabled);
|
|
Daniel P. Berrange |
1e96c6 |
+}
|
|
Daniel P. Berrange |
1e96c6 |
+
|
|
Daniel P. Berrange |
1e96c6 |
+#endif /* CONFIG_XEN_CTRL_INTERFACE_VERSION >= 450 */
|
|
Daniel P. Berrange |
1e96c6 |
+
|
|
Daniel P. Berrange |
1e96c6 |
+static inline int xendevicemodel_set_pci_intx_level(
|
|
Daniel P. Berrange |
1e96c6 |
+ xendevicemodel_handle *dmod, domid_t domid, uint16_t segment,
|
|
Daniel P. Berrange |
1e96c6 |
+ uint8_t bus, uint8_t device, uint8_t intx, unsigned int level)
|
|
Daniel P. Berrange |
1e96c6 |
+{
|
|
Daniel P. Berrange |
1e96c6 |
+ return xc_hvm_set_pci_intx_level(dmod, domid, segment, bus, device,
|
|
Daniel P. Berrange |
1e96c6 |
+ intx, level);
|
|
Daniel P. Berrange |
1e96c6 |
+}
|
|
Daniel P. Berrange |
1e96c6 |
+
|
|
Daniel P. Berrange |
1e96c6 |
+static inline int xendevicemodel_set_isa_irq_level(
|
|
Daniel P. Berrange |
1e96c6 |
+ xendevicemodel_handle *dmod, domid_t domid, uint8_t irq,
|
|
Daniel P. Berrange |
1e96c6 |
+ unsigned int level)
|
|
Daniel P. Berrange |
1e96c6 |
+{
|
|
Daniel P. Berrange |
1e96c6 |
+ return xc_hvm_set_isa_irq_level(dmod, domid, irq, level);
|
|
Daniel P. Berrange |
1e96c6 |
+}
|
|
Daniel P. Berrange |
1e96c6 |
+
|
|
Daniel P. Berrange |
1e96c6 |
+static inline int xendevicemodel_set_pci_link_route(
|
|
Daniel P. Berrange |
1e96c6 |
+ xendevicemodel_handle *dmod, domid_t domid, uint8_t link, uint8_t irq)
|
|
Daniel P. Berrange |
1e96c6 |
+{
|
|
Daniel P. Berrange |
1e96c6 |
+ return xc_hvm_set_pci_link_route(dmod, domid, link, irq);
|
|
Daniel P. Berrange |
1e96c6 |
+}
|
|
Daniel P. Berrange |
1e96c6 |
+
|
|
Daniel P. Berrange |
1e96c6 |
+static inline int xendevicemodel_inject_msi(
|
|
Daniel P. Berrange |
1e96c6 |
+ xendevicemodel_handle *dmod, domid_t domid, uint64_t msi_addr,
|
|
Daniel P. Berrange |
1e96c6 |
+ uint32_t msi_data)
|
|
Daniel P. Berrange |
1e96c6 |
+{
|
|
Daniel P. Berrange |
1e96c6 |
+ return xc_hvm_inject_msi(dmod, domid, msi_addr, msi_data);
|
|
Daniel P. Berrange |
1e96c6 |
+}
|
|
Daniel P. Berrange |
1e96c6 |
+
|
|
Daniel P. Berrange |
1e96c6 |
+static inline int xendevicemodel_track_dirty_vram(
|
|
Daniel P. Berrange |
1e96c6 |
+ xendevicemodel_handle *dmod, domid_t domid, uint64_t first_pfn,
|
|
Daniel P. Berrange |
1e96c6 |
+ uint32_t nr, unsigned long *dirty_bitmap)
|
|
Daniel P. Berrange |
1e96c6 |
+{
|
|
Daniel P. Berrange |
1e96c6 |
+ return xc_hvm_track_dirty_vram(dmod, domid, first_pfn, nr,
|
|
Daniel P. Berrange |
1e96c6 |
+ dirty_bitmap);
|
|
Daniel P. Berrange |
1e96c6 |
+}
|
|
Daniel P. Berrange |
1e96c6 |
+
|
|
Daniel P. Berrange |
1e96c6 |
+static inline int xendevicemodel_modified_memory(
|
|
Daniel P. Berrange |
1e96c6 |
+ xendevicemodel_handle *dmod, domid_t domid, uint64_t first_pfn,
|
|
Daniel P. Berrange |
1e96c6 |
+ uint32_t nr)
|
|
Daniel P. Berrange |
1e96c6 |
+{
|
|
Daniel P. Berrange |
1e96c6 |
+ return xc_hvm_modified_memory(dmod, domid, first_pfn, nr);
|
|
Daniel P. Berrange |
1e96c6 |
+}
|
|
Daniel P. Berrange |
1e96c6 |
+
|
|
Daniel P. Berrange |
1e96c6 |
+static inline int xendevicemodel_set_mem_type(
|
|
Daniel P. Berrange |
1e96c6 |
+ xendevicemodel_handle *dmod, domid_t domid, hvmmem_type_t mem_type,
|
|
Daniel P. Berrange |
1e96c6 |
+ uint64_t first_pfn, uint32_t nr)
|
|
Daniel P. Berrange |
1e96c6 |
+{
|
|
Daniel P. Berrange |
1e96c6 |
+ return xc_hvm_set_mem_type(dmod, domid, mem_type, first_pfn, nr);
|
|
Daniel P. Berrange |
1e96c6 |
+}
|
|
Daniel P. Berrange |
1e96c6 |
+
|
|
Daniel P. Berrange |
1e96c6 |
+#else /* CONFIG_XEN_CTRL_INTERFACE_VERSION >= 490 */
|
|
Daniel P. Berrange |
1e96c6 |
+
|
|
Daniel P. Berrange |
1e96c6 |
+#undef XC_WANT_COMPAT_DEVICEMODEL_API
|
|
Daniel P. Berrange |
1e96c6 |
+#include <xendevicemodel.h>
|
|
Daniel P. Berrange |
1e96c6 |
+
|
|
Daniel P. Berrange |
1e96c6 |
+#endif
|
|
Daniel P. Berrange |
1e96c6 |
+
|
|
Daniel P. Berrange |
1e96c6 |
+extern xendevicemodel_handle *xen_dmod;
|
|
Daniel P. Berrange |
1e96c6 |
+
|
|
Daniel P. Berrange |
1e96c6 |
static inline int xen_set_mem_type(domid_t domid, hvmmem_type_t type,
|
|
Daniel P. Berrange |
1e96c6 |
uint64_t first_pfn, uint32_t nr)
|
|
Daniel P. Berrange |
1e96c6 |
{
|
|
Daniel P. Berrange |
1e96c6 |
- return xc_hvm_set_mem_type(xen_xc, domid, type, first_pfn, nr);
|
|
Daniel P. Berrange |
1e96c6 |
+ return xendevicemodel_set_mem_type(xen_dmod, domid, type, first_pfn,
|
|
Daniel P. Berrange |
1e96c6 |
+ nr);
|
|
Daniel P. Berrange |
1e96c6 |
}
|
|
Daniel P. Berrange |
1e96c6 |
|
|
Daniel P. Berrange |
1e96c6 |
static inline int xen_set_pci_intx_level(domid_t domid, uint16_t segment,
|
|
Daniel P. Berrange |
1e96c6 |
uint8_t bus, uint8_t device,
|
|
Daniel P. Berrange |
1e96c6 |
uint8_t intx, unsigned int level)
|
|
Daniel P. Berrange |
1e96c6 |
{
|
|
Daniel P. Berrange |
1e96c6 |
- return xc_hvm_set_pci_intx_level(xen_xc, domid, segment, bus, device,
|
|
Daniel P. Berrange |
1e96c6 |
- intx, level);
|
|
Daniel P. Berrange |
1e96c6 |
+ return xendevicemodel_set_pci_intx_level(xen_dmod, domid, segment, bus,
|
|
Daniel P. Berrange |
1e96c6 |
+ device, intx, level);
|
|
Daniel P. Berrange |
1e96c6 |
}
|
|
Daniel P. Berrange |
1e96c6 |
|
|
Daniel P. Berrange |
1e96c6 |
static inline int xen_set_pci_link_route(domid_t domid, uint8_t link,
|
|
Daniel P. Berrange |
1e96c6 |
uint8_t irq)
|
|
Daniel P. Berrange |
1e96c6 |
{
|
|
Daniel P. Berrange |
1e96c6 |
- return xc_hvm_set_pci_link_route(xen_xc, domid, link, irq);
|
|
Daniel P. Berrange |
1e96c6 |
+ return xendevicemodel_set_pci_link_route(xen_dmod, domid, link, irq);
|
|
Daniel P. Berrange |
1e96c6 |
}
|
|
Daniel P. Berrange |
1e96c6 |
|
|
Daniel P. Berrange |
1e96c6 |
static inline int xen_inject_msi(domid_t domid, uint64_t msi_addr,
|
|
Daniel P. Berrange |
1e96c6 |
uint32_t msi_data)
|
|
Daniel P. Berrange |
1e96c6 |
{
|
|
Daniel P. Berrange |
1e96c6 |
- return xc_hvm_inject_msi(xen_xc, domid, msi_addr, msi_data);
|
|
Daniel P. Berrange |
1e96c6 |
+ return xendevicemodel_inject_msi(xen_dmod, domid, msi_addr, msi_data);
|
|
Daniel P. Berrange |
1e96c6 |
}
|
|
Daniel P. Berrange |
1e96c6 |
|
|
Daniel P. Berrange |
1e96c6 |
static inline int xen_set_isa_irq_level(domid_t domid, uint8_t irq,
|
|
Daniel P. Berrange |
1e96c6 |
unsigned int level)
|
|
Daniel P. Berrange |
1e96c6 |
{
|
|
Daniel P. Berrange |
1e96c6 |
- return xc_hvm_set_isa_irq_level(xen_xc, domid, irq, level);
|
|
Daniel P. Berrange |
1e96c6 |
+ return xendevicemodel_set_isa_irq_level(xen_dmod, domid, irq, level);
|
|
Daniel P. Berrange |
1e96c6 |
}
|
|
Daniel P. Berrange |
1e96c6 |
|
|
Daniel P. Berrange |
1e96c6 |
static inline int xen_track_dirty_vram(domid_t domid, uint64_t first_pfn,
|
|
Daniel P. Berrange |
1e96c6 |
uint32_t nr, unsigned long *bitmap)
|
|
Daniel P. Berrange |
1e96c6 |
{
|
|
Daniel P. Berrange |
1e96c6 |
- return xc_hvm_track_dirty_vram(xen_xc, domid, first_pfn, nr, bitmap);
|
|
Daniel P. Berrange |
1e96c6 |
+ return xendevicemodel_track_dirty_vram(xen_dmod, domid, first_pfn, nr,
|
|
Daniel P. Berrange |
1e96c6 |
+ bitmap);
|
|
Daniel P. Berrange |
1e96c6 |
}
|
|
Daniel P. Berrange |
1e96c6 |
|
|
Daniel P. Berrange |
1e96c6 |
static inline int xen_modified_memory(domid_t domid, uint64_t first_pfn,
|
|
Daniel P. Berrange |
1e96c6 |
uint32_t nr)
|
|
Daniel P. Berrange |
1e96c6 |
{
|
|
Daniel P. Berrange |
1e96c6 |
- return xc_hvm_modified_memory(xen_xc, domid, first_pfn, nr);
|
|
Daniel P. Berrange |
1e96c6 |
+ return xendevicemodel_modified_memory(xen_dmod, domid, first_pfn, nr);
|
|
Daniel P. Berrange |
1e96c6 |
}
|
|
Daniel P. Berrange |
1e96c6 |
|
|
Daniel P. Berrange |
1e96c6 |
/* Xen 4.2 through 4.6 */
|
|
Daniel P. Berrange |
1e96c6 |
@@ -97,6 +233,7 @@ typedef xc_gnttab xengnttab_handle;
|
|
Daniel P. Berrange |
1e96c6 |
xc_gnttab_map_domain_grant_refs(h, c, d, r, p)
|
|
Daniel P. Berrange |
1e96c6 |
|
|
Daniel P. Berrange |
1e96c6 |
#define xenforeignmemory_open(l, f) xen_xc
|
|
Daniel P. Berrange |
1e96c6 |
+#define xenforeignmemory_close(h)
|
|
Daniel P. Berrange |
1e96c6 |
|
|
Daniel P. Berrange |
1e96c6 |
static inline void *xenforeignmemory_map(xc_interface *h, uint32_t dom,
|
|
Daniel P. Berrange |
1e96c6 |
int prot, size_t pages,
|
|
Daniel P. Berrange |
1e96c6 |
@@ -285,8 +422,8 @@ static inline void xen_map_memory_section(domid_t dom,
|
|
Daniel P. Berrange |
1e96c6 |
}
|
|
Daniel P. Berrange |
1e96c6 |
|
|
Daniel P. Berrange |
1e96c6 |
trace_xen_map_mmio_range(ioservid, start_addr, end_addr);
|
|
Daniel P. Berrange |
1e96c6 |
- xc_hvm_map_io_range_to_ioreq_server(xen_xc, dom, ioservid, 1,
|
|
Daniel P. Berrange |
1e96c6 |
- start_addr, end_addr);
|
|
Daniel P. Berrange |
1e96c6 |
+ xendevicemodel_map_io_range_to_ioreq_server(xen_dmod, dom, ioservid, 1,
|
|
Daniel P. Berrange |
1e96c6 |
+ start_addr, end_addr);
|
|
Daniel P. Berrange |
1e96c6 |
}
|
|
Daniel P. Berrange |
1e96c6 |
|
|
Daniel P. Berrange |
1e96c6 |
static inline void xen_unmap_memory_section(domid_t dom,
|
|
Daniel P. Berrange |
1e96c6 |
@@ -302,8 +439,8 @@ static inline void xen_unmap_memory_section(domid_t dom,
|
|
Daniel P. Berrange |
1e96c6 |
}
|
|
Daniel P. Berrange |
1e96c6 |
|
|
Daniel P. Berrange |
1e96c6 |
trace_xen_unmap_mmio_range(ioservid, start_addr, end_addr);
|
|
Daniel P. Berrange |
1e96c6 |
- xc_hvm_unmap_io_range_from_ioreq_server(xen_xc, dom, ioservid,
|
|
Daniel P. Berrange |
1e96c6 |
- 1, start_addr, end_addr);
|
|
Daniel P. Berrange |
1e96c6 |
+ xendevicemodel_unmap_io_range_from_ioreq_server(xen_dmod, dom, ioservid,
|
|
Daniel P. Berrange |
1e96c6 |
+ 1, start_addr, end_addr);
|
|
Daniel P. Berrange |
1e96c6 |
}
|
|
Daniel P. Berrange |
1e96c6 |
|
|
Daniel P. Berrange |
1e96c6 |
static inline void xen_map_io_section(domid_t dom,
|
|
Daniel P. Berrange |
1e96c6 |
@@ -319,8 +456,8 @@ static inline void xen_map_io_section(domid_t dom,
|
|
Daniel P. Berrange |
1e96c6 |
}
|
|
Daniel P. Berrange |
1e96c6 |
|
|
Daniel P. Berrange |
1e96c6 |
trace_xen_map_portio_range(ioservid, start_addr, end_addr);
|
|
Daniel P. Berrange |
1e96c6 |
- xc_hvm_map_io_range_to_ioreq_server(xen_xc, dom, ioservid, 0,
|
|
Daniel P. Berrange |
1e96c6 |
- start_addr, end_addr);
|
|
Daniel P. Berrange |
1e96c6 |
+ xendevicemodel_map_io_range_to_ioreq_server(xen_dmod, dom, ioservid, 0,
|
|
Daniel P. Berrange |
1e96c6 |
+ start_addr, end_addr);
|
|
Daniel P. Berrange |
1e96c6 |
}
|
|
Daniel P. Berrange |
1e96c6 |
|
|
Daniel P. Berrange |
1e96c6 |
static inline void xen_unmap_io_section(domid_t dom,
|
|
Daniel P. Berrange |
1e96c6 |
@@ -336,8 +473,8 @@ static inline void xen_unmap_io_section(domid_t dom,
|
|
Daniel P. Berrange |
1e96c6 |
}
|
|
Daniel P. Berrange |
1e96c6 |
|
|
Daniel P. Berrange |
1e96c6 |
trace_xen_unmap_portio_range(ioservid, start_addr, end_addr);
|
|
Daniel P. Berrange |
1e96c6 |
- xc_hvm_unmap_io_range_from_ioreq_server(xen_xc, dom, ioservid,
|
|
Daniel P. Berrange |
1e96c6 |
- 0, start_addr, end_addr);
|
|
Daniel P. Berrange |
1e96c6 |
+ xendevicemodel_unmap_io_range_from_ioreq_server(xen_dmod, dom, ioservid,
|
|
Daniel P. Berrange |
1e96c6 |
+ 0, start_addr, end_addr);
|
|
Daniel P. Berrange |
1e96c6 |
}
|
|
Daniel P. Berrange |
1e96c6 |
|
|
Daniel P. Berrange |
1e96c6 |
static inline void xen_map_pcidev(domid_t dom,
|
|
Daniel P. Berrange |
1e96c6 |
@@ -350,10 +487,10 @@ static inline void xen_map_pcidev(domid_t dom,
|
|
Daniel P. Berrange |
1e96c6 |
|
|
Daniel P. Berrange |
1e96c6 |
trace_xen_map_pcidev(ioservid, pci_bus_num(pci_dev->bus),
|
|
Daniel P. Berrange |
1e96c6 |
PCI_SLOT(pci_dev->devfn), PCI_FUNC(pci_dev->devfn));
|
|
Daniel P. Berrange |
1e96c6 |
- xc_hvm_map_pcidev_to_ioreq_server(xen_xc, dom, ioservid, 0,
|
|
Daniel P. Berrange |
1e96c6 |
- pci_bus_num(pci_dev->bus),
|
|
Daniel P. Berrange |
1e96c6 |
- PCI_SLOT(pci_dev->devfn),
|
|
Daniel P. Berrange |
1e96c6 |
- PCI_FUNC(pci_dev->devfn));
|
|
Daniel P. Berrange |
1e96c6 |
+ xendevicemodel_map_pcidev_to_ioreq_server(xen_dmod, dom, ioservid, 0,
|
|
Daniel P. Berrange |
1e96c6 |
+ pci_bus_num(pci_dev->bus),
|
|
Daniel P. Berrange |
1e96c6 |
+ PCI_SLOT(pci_dev->devfn),
|
|
Daniel P. Berrange |
1e96c6 |
+ PCI_FUNC(pci_dev->devfn));
|
|
Daniel P. Berrange |
1e96c6 |
}
|
|
Daniel P. Berrange |
1e96c6 |
|
|
Daniel P. Berrange |
1e96c6 |
static inline void xen_unmap_pcidev(domid_t dom,
|
|
Daniel P. Berrange |
1e96c6 |
@@ -366,18 +503,18 @@ static inline void xen_unmap_pcidev(domid_t dom,
|
|
Daniel P. Berrange |
1e96c6 |
|
|
Daniel P. Berrange |
1e96c6 |
trace_xen_unmap_pcidev(ioservid, pci_bus_num(pci_dev->bus),
|
|
Daniel P. Berrange |
1e96c6 |
PCI_SLOT(pci_dev->devfn), PCI_FUNC(pci_dev->devfn));
|
|
Daniel P. Berrange |
1e96c6 |
- xc_hvm_unmap_pcidev_from_ioreq_server(xen_xc, dom, ioservid, 0,
|
|
Daniel P. Berrange |
1e96c6 |
- pci_bus_num(pci_dev->bus),
|
|
Daniel P. Berrange |
1e96c6 |
- PCI_SLOT(pci_dev->devfn),
|
|
Daniel P. Berrange |
1e96c6 |
- PCI_FUNC(pci_dev->devfn));
|
|
Daniel P. Berrange |
1e96c6 |
+ xendevicemodel_unmap_pcidev_from_ioreq_server(xen_dmod, dom, ioservid, 0,
|
|
Daniel P. Berrange |
1e96c6 |
+ pci_bus_num(pci_dev->bus),
|
|
Daniel P. Berrange |
1e96c6 |
+ PCI_SLOT(pci_dev->devfn),
|
|
Daniel P. Berrange |
1e96c6 |
+ PCI_FUNC(pci_dev->devfn));
|
|
Daniel P. Berrange |
1e96c6 |
}
|
|
Daniel P. Berrange |
1e96c6 |
|
|
Daniel P. Berrange |
1e96c6 |
static inline void xen_create_ioreq_server(domid_t dom,
|
|
Daniel P. Berrange |
1e96c6 |
ioservid_t *ioservid)
|
|
Daniel P. Berrange |
1e96c6 |
{
|
|
Daniel P. Berrange |
1e96c6 |
- int rc = xc_hvm_create_ioreq_server(xen_xc, dom,
|
|
Daniel P. Berrange |
1e96c6 |
- HVM_IOREQSRV_BUFIOREQ_ATOMIC,
|
|
Daniel P. Berrange |
1e96c6 |
- ioservid);
|
|
Daniel P. Berrange |
1e96c6 |
+ int rc = xendevicemodel_create_ioreq_server(xen_dmod, dom,
|
|
Daniel P. Berrange |
1e96c6 |
+ HVM_IOREQSRV_BUFIOREQ_ATOMIC,
|
|
Daniel P. Berrange |
1e96c6 |
+ ioservid);
|
|
Daniel P. Berrange |
1e96c6 |
|
|
Daniel P. Berrange |
1e96c6 |
if (rc == 0) {
|
|
Daniel P. Berrange |
1e96c6 |
trace_xen_ioreq_server_create(*ioservid);
|
|
Daniel P. Berrange |
1e96c6 |
@@ -397,7 +534,7 @@ static inline void xen_destroy_ioreq_server(domid_t dom,
|
|
Daniel P. Berrange |
1e96c6 |
}
|
|
Daniel P. Berrange |
1e96c6 |
|
|
Daniel P. Berrange |
1e96c6 |
trace_xen_ioreq_server_destroy(ioservid);
|
|
Daniel P. Berrange |
1e96c6 |
- xc_hvm_destroy_ioreq_server(xen_xc, dom, ioservid);
|
|
Daniel P. Berrange |
1e96c6 |
+ xendevicemodel_destroy_ioreq_server(xen_dmod, dom, ioservid);
|
|
Daniel P. Berrange |
1e96c6 |
}
|
|
Daniel P. Berrange |
1e96c6 |
|
|
Daniel P. Berrange |
1e96c6 |
static inline int xen_get_ioreq_server_info(domid_t dom,
|
|
Daniel P. Berrange |
1e96c6 |
@@ -412,9 +549,9 @@ static inline int xen_get_ioreq_server_info(domid_t dom,
|
|
Daniel P. Berrange |
1e96c6 |
bufioreq_evtchn);
|
|
Daniel P. Berrange |
1e96c6 |
}
|
|
Daniel P. Berrange |
1e96c6 |
|
|
Daniel P. Berrange |
1e96c6 |
- return xc_hvm_get_ioreq_server_info(xen_xc, dom, ioservid,
|
|
Daniel P. Berrange |
1e96c6 |
- ioreq_pfn, bufioreq_pfn,
|
|
Daniel P. Berrange |
1e96c6 |
- bufioreq_evtchn);
|
|
Daniel P. Berrange |
1e96c6 |
+ return xendevicemodel_get_ioreq_server_info(xen_dmod, dom, ioservid,
|
|
Daniel P. Berrange |
1e96c6 |
+ ioreq_pfn, bufioreq_pfn,
|
|
Daniel P. Berrange |
1e96c6 |
+ bufioreq_evtchn);
|
|
Daniel P. Berrange |
1e96c6 |
}
|
|
Daniel P. Berrange |
1e96c6 |
|
|
Daniel P. Berrange |
1e96c6 |
static inline int xen_set_ioreq_server_state(domid_t dom,
|
|
Daniel P. Berrange |
1e96c6 |
@@ -426,8 +563,8 @@ static inline int xen_set_ioreq_server_state(domid_t dom,
|
|
Daniel P. Berrange |
1e96c6 |
}
|
|
Daniel P. Berrange |
1e96c6 |
|
|
Daniel P. Berrange |
1e96c6 |
trace_xen_ioreq_server_state(ioservid, enable);
|
|
Daniel P. Berrange |
1e96c6 |
- return xc_hvm_set_ioreq_server_state(xen_xc, dom, ioservid,
|
|
Daniel P. Berrange |
1e96c6 |
- enable);
|
|
Daniel P. Berrange |
1e96c6 |
+ return xendevicemodel_set_ioreq_server_state(xen_dmod, dom, ioservid,
|
|
Daniel P. Berrange |
1e96c6 |
+ enable);
|
|
Daniel P. Berrange |
1e96c6 |
}
|
|
Daniel P. Berrange |
1e96c6 |
|
|
Daniel P. Berrange |
1e96c6 |
#endif
|
|
Daniel P. Berrange |
1e96c6 |
diff --git a/xen-common.c b/xen-common.c
|
|
Daniel P. Berrange |
1e96c6 |
index 703e7a5861..ae76150e8a 100644
|
|
Daniel P. Berrange |
1e96c6 |
--- a/xen-common.c
|
|
Daniel P. Berrange |
1e96c6 |
+++ b/xen-common.c
|
|
Daniel P. Berrange |
1e96c6 |
@@ -27,6 +27,7 @@
|
|
Daniel P. Berrange |
1e96c6 |
|
|
Daniel P. Berrange |
1e96c6 |
xc_interface *xen_xc;
|
|
Daniel P. Berrange |
1e96c6 |
xenforeignmemory_handle *xen_fmem;
|
|
Daniel P. Berrange |
1e96c6 |
+xendevicemodel_handle *xen_dmod;
|
|
Daniel P. Berrange |
1e96c6 |
|
|
Daniel P. Berrange |
1e96c6 |
static int store_dev_info(int domid, Chardev *cs, const char *string)
|
|
Daniel P. Berrange |
1e96c6 |
{
|
|
Daniel P. Berrange |
1e96c6 |
@@ -128,6 +129,13 @@ static int xen_init(MachineState *ms)
|
|
Daniel P. Berrange |
1e96c6 |
xc_interface_close(xen_xc);
|
|
Daniel P. Berrange |
1e96c6 |
return -1;
|
|
Daniel P. Berrange |
1e96c6 |
}
|
|
Daniel P. Berrange |
1e96c6 |
+ xen_dmod = xendevicemodel_open(0, 0);
|
|
Daniel P. Berrange |
1e96c6 |
+ if (xen_dmod == NULL) {
|
|
Daniel P. Berrange |
1e96c6 |
+ xen_pv_printf(NULL, 0, "can't open xen devicemodel interface\n");
|
|
Daniel P. Berrange |
1e96c6 |
+ xenforeignmemory_close(xen_fmem);
|
|
Daniel P. Berrange |
1e96c6 |
+ xc_interface_close(xen_xc);
|
|
Daniel P. Berrange |
1e96c6 |
+ return -1;
|
|
Daniel P. Berrange |
1e96c6 |
+ }
|
|
Daniel P. Berrange |
1e96c6 |
qemu_add_vm_change_state_handler(xen_change_state_handler, NULL);
|
|
Daniel P. Berrange |
1e96c6 |
|
|
Daniel P. Berrange |
1e96c6 |
global_state_set_optional();
|
|
Daniel P. Berrange |
1e96c6 |
--
|
|
Daniel P. Berrange |
1e96c6 |
2.13.0
|
|
Daniel P. Berrange |
1e96c6 |
|