dcavalca / rpms / qemu

Forked from rpms/qemu a year ago
Clone

Blame 0001-xen-make-use-of-xen_xc-implicit-in-xen_common.h-inli.patch

Daniel P. Berrange 1e96c6
From a3dfd0460492f404228335278c2a4b2afd95c2f4 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:30 +0000
Daniel P. Berrange 1e96c6
Subject: [PATCH 1/6] xen: make use of xen_xc implicit in xen_common.h inlines
Daniel P. Berrange 1e96c6
Daniel P. Berrange 1e96c6
Doing this will make the transition to using the new libxendevicemodel
Daniel P. Berrange 1e96c6
interface less intrusive on the callers of these functions, since using
Daniel P. Berrange 1e96c6
the new library will require a change of handle.
Daniel P. Berrange 1e96c6
Daniel P. Berrange 1e96c6
NOTE: The patch also moves the 'externs' for xen_xc and xen_fmem from
Daniel P. Berrange 1e96c6
      xen_backend.h to xen_common.h, and the declarations from
Daniel P. Berrange 1e96c6
      xen_backend.c to xen-common.c, which is where they belong.
Daniel P. Berrange 1e96c6
Daniel P. Berrange 1e96c6
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
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 260cabed718c4d3137553a4a98de268b0fb166b7)
Daniel P. Berrange 1e96c6
---
Daniel P. Berrange 1e96c6
 hw/xen/xen_backend.c         |  2 -
Daniel P. Berrange 1e96c6
 include/hw/xen/xen_backend.h |  2 -
Daniel P. Berrange 1e96c6
 include/hw/xen/xen_common.h  | 90 +++++++++++++++++++++++---------------------
Daniel P. Berrange 1e96c6
 xen-common.c                 |  3 ++
Daniel P. Berrange 1e96c6
 xen-hvm.c                    | 20 +++++-----
Daniel P. Berrange 1e96c6
 5 files changed, 60 insertions(+), 57 deletions(-)
Daniel P. Berrange 1e96c6
Daniel P. Berrange 1e96c6
diff --git a/hw/xen/xen_backend.c b/hw/xen/xen_backend.c
Daniel P. Berrange 1e96c6
index 6c21c37d68..d34c49e152 100644
Daniel P. Berrange 1e96c6
--- a/hw/xen/xen_backend.c
Daniel P. Berrange 1e96c6
+++ b/hw/xen/xen_backend.c
Daniel P. Berrange 1e96c6
@@ -43,8 +43,6 @@ BusState *xen_sysbus;
Daniel P. Berrange 1e96c6
 /* ------------------------------------------------------------- */
Daniel P. Berrange 1e96c6
 
Daniel P. Berrange 1e96c6
 /* public */
Daniel P. Berrange 1e96c6
-xc_interface *xen_xc = NULL;
Daniel P. Berrange 1e96c6
-xenforeignmemory_handle *xen_fmem = NULL;
Daniel P. Berrange 1e96c6
 struct xs_handle *xenstore = NULL;
Daniel P. Berrange 1e96c6
 const char *xen_protocol;
Daniel P. Berrange 1e96c6
 
Daniel P. Berrange 1e96c6
diff --git a/include/hw/xen/xen_backend.h b/include/hw/xen/xen_backend.h
Daniel P. Berrange 1e96c6
index 4f4799a610..30811a1e5d 100644
Daniel P. Berrange 1e96c6
--- a/include/hw/xen/xen_backend.h
Daniel P. Berrange 1e96c6
+++ b/include/hw/xen/xen_backend.h
Daniel P. Berrange 1e96c6
@@ -14,8 +14,6 @@
Daniel P. Berrange 1e96c6
     OBJECT_CHECK(XenDevice, (obj), TYPE_XENBACKEND)
Daniel P. Berrange 1e96c6
 
Daniel P. Berrange 1e96c6
 /* variables */
Daniel P. Berrange 1e96c6
-extern xc_interface *xen_xc;
Daniel P. Berrange 1e96c6
-extern xenforeignmemory_handle *xen_fmem;
Daniel P. Berrange 1e96c6
 extern struct xs_handle *xenstore;
Daniel P. Berrange 1e96c6
 extern const char *xen_protocol;
Daniel P. Berrange 1e96c6
 extern DeviceState *xen_sysdev;
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 dce76ee162..1e08b98617 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
@@ -20,6 +20,8 @@
Daniel P. Berrange 1e96c6
 #include "qemu/queue.h"
Daniel P. Berrange 1e96c6
 #include "hw/xen/trace.h"
Daniel P. Berrange 1e96c6
 
Daniel P. Berrange 1e96c6
+extern xc_interface *xen_xc;
Daniel P. Berrange 1e96c6
+
Daniel P. Berrange 1e96c6
 /*
Daniel P. Berrange 1e96c6
  * We don't support Xen prior to 4.2.0.
Daniel P. Berrange 1e96c6
  */
Daniel P. Berrange 1e96c6
@@ -73,6 +75,8 @@ static inline void *xenforeignmemory_map(xc_interface *h, uint32_t dom,
Daniel P. Berrange 1e96c6
 
Daniel P. Berrange 1e96c6
 #endif
Daniel P. Berrange 1e96c6
 
Daniel P. Berrange 1e96c6
+extern xenforeignmemory_handle *xen_fmem;
Daniel P. Berrange 1e96c6
+
Daniel P. Berrange 1e96c6
 void destroy_hvm_domain(bool reboot);
Daniel P. Berrange 1e96c6
 
Daniel P. Berrange 1e96c6
 /* shutdown/destroy current domain because of an error */
Daniel P. Berrange 1e96c6
@@ -107,8 +111,7 @@ static inline int xen_get_vmport_regs_pfn(xc_interface *xc, domid_t dom,
Daniel P. Berrange 1e96c6
 
Daniel P. Berrange 1e96c6
 #endif
Daniel P. Berrange 1e96c6
 
Daniel P. Berrange 1e96c6
-static inline int xen_get_default_ioreq_server_info(xc_interface *xc,
Daniel P. Berrange 1e96c6
-                                                    domid_t dom,
Daniel P. Berrange 1e96c6
+static inline int xen_get_default_ioreq_server_info(domid_t dom,
Daniel P. Berrange 1e96c6
                                                     xen_pfn_t *ioreq_pfn,
Daniel P. Berrange 1e96c6
                                                     xen_pfn_t *bufioreq_pfn,
Daniel P. Berrange 1e96c6
                                                     evtchn_port_t
Daniel P. Berrange 1e96c6
@@ -117,7 +120,7 @@ static inline int xen_get_default_ioreq_server_info(xc_interface *xc,
Daniel P. Berrange 1e96c6
     unsigned long param;
Daniel P. Berrange 1e96c6
     int rc;
Daniel P. Berrange 1e96c6
 
Daniel P. Berrange 1e96c6
-    rc = xc_get_hvm_param(xc, dom, HVM_PARAM_IOREQ_PFN, ¶m;;
Daniel P. Berrange 1e96c6
+    rc = xc_get_hvm_param(xen_xc, dom, HVM_PARAM_IOREQ_PFN, ¶m;;
Daniel P. Berrange 1e96c6
     if (rc < 0) {
Daniel P. Berrange 1e96c6
         fprintf(stderr, "failed to get HVM_PARAM_IOREQ_PFN\n");
Daniel P. Berrange 1e96c6
         return -1;
Daniel P. Berrange 1e96c6
@@ -125,7 +128,7 @@ static inline int xen_get_default_ioreq_server_info(xc_interface *xc,
Daniel P. Berrange 1e96c6
 
Daniel P. Berrange 1e96c6
     *ioreq_pfn = param;
Daniel P. Berrange 1e96c6
 
Daniel P. Berrange 1e96c6
-    rc = xc_get_hvm_param(xc, dom, HVM_PARAM_BUFIOREQ_PFN, ¶m;;
Daniel P. Berrange 1e96c6
+    rc = xc_get_hvm_param(xen_xc, dom, HVM_PARAM_BUFIOREQ_PFN, ¶m;;
Daniel P. Berrange 1e96c6
     if (rc < 0) {
Daniel P. Berrange 1e96c6
         fprintf(stderr, "failed to get HVM_PARAM_BUFIOREQ_PFN\n");
Daniel P. Berrange 1e96c6
         return -1;
Daniel P. Berrange 1e96c6
@@ -133,7 +136,7 @@ static inline int xen_get_default_ioreq_server_info(xc_interface *xc,
Daniel P. Berrange 1e96c6
 
Daniel P. Berrange 1e96c6
     *bufioreq_pfn = param;
Daniel P. Berrange 1e96c6
 
Daniel P. Berrange 1e96c6
-    rc = xc_get_hvm_param(xc, dom, HVM_PARAM_BUFIOREQ_EVTCHN,
Daniel P. Berrange 1e96c6
+    rc = xc_get_hvm_param(xen_xc, dom, HVM_PARAM_BUFIOREQ_EVTCHN,
Daniel P. Berrange 1e96c6
                           ¶m;;
Daniel P. Berrange 1e96c6
     if (rc < 0) {
Daniel P. Berrange 1e96c6
         fprintf(stderr, "failed to get HVM_PARAM_BUFIOREQ_EVTCHN\n");
Daniel P. Berrange 1e96c6
@@ -156,63 +159,64 @@ static inline int xen_get_default_ioreq_server_info(xc_interface *xc,
Daniel P. Berrange 1e96c6
 
Daniel P. Berrange 1e96c6
 typedef uint16_t ioservid_t;
Daniel P. Berrange 1e96c6
 
Daniel P. Berrange 1e96c6
-static inline void xen_map_memory_section(xc_interface *xc, domid_t dom,
Daniel P. Berrange 1e96c6
+static inline void xen_map_memory_section(domid_t dom,
Daniel P. Berrange 1e96c6
                                           ioservid_t ioservid,
Daniel P. Berrange 1e96c6
                                           MemoryRegionSection *section)
Daniel P. Berrange 1e96c6
 {
Daniel P. Berrange 1e96c6
 }
Daniel P. Berrange 1e96c6
 
Daniel P. Berrange 1e96c6
-static inline void xen_unmap_memory_section(xc_interface *xc, domid_t dom,
Daniel P. Berrange 1e96c6
+static inline void xen_unmap_memory_section(domid_t dom,
Daniel P. Berrange 1e96c6
                                             ioservid_t ioservid,
Daniel P. Berrange 1e96c6
                                             MemoryRegionSection *section)
Daniel P. Berrange 1e96c6
 {
Daniel P. Berrange 1e96c6
 }
Daniel P. Berrange 1e96c6
 
Daniel P. Berrange 1e96c6
-static inline void xen_map_io_section(xc_interface *xc, domid_t dom,
Daniel P. Berrange 1e96c6
+static inline void xen_map_io_section(domid_t dom,
Daniel P. Berrange 1e96c6
                                       ioservid_t ioservid,
Daniel P. Berrange 1e96c6
                                       MemoryRegionSection *section)
Daniel P. Berrange 1e96c6
 {
Daniel P. Berrange 1e96c6
 }
Daniel P. Berrange 1e96c6
 
Daniel P. Berrange 1e96c6
-static inline void xen_unmap_io_section(xc_interface *xc, domid_t dom,
Daniel P. Berrange 1e96c6
+static inline void xen_unmap_io_section(domid_t dom,
Daniel P. Berrange 1e96c6
                                         ioservid_t ioservid,
Daniel P. Berrange 1e96c6
                                         MemoryRegionSection *section)
Daniel P. Berrange 1e96c6
 {
Daniel P. Berrange 1e96c6
 }
Daniel P. Berrange 1e96c6
 
Daniel P. Berrange 1e96c6
-static inline void xen_map_pcidev(xc_interface *xc, domid_t dom,
Daniel P. Berrange 1e96c6
+static inline void xen_map_pcidev(domid_t dom,
Daniel P. Berrange 1e96c6
                                   ioservid_t ioservid,
Daniel P. Berrange 1e96c6
                                   PCIDevice *pci_dev)
Daniel P. Berrange 1e96c6
 {
Daniel P. Berrange 1e96c6
 }
Daniel P. Berrange 1e96c6
 
Daniel P. Berrange 1e96c6
-static inline void xen_unmap_pcidev(xc_interface *xc, domid_t dom,
Daniel P. Berrange 1e96c6
+static inline void xen_unmap_pcidev(domid_t dom,
Daniel P. Berrange 1e96c6
                                     ioservid_t ioservid,
Daniel P. Berrange 1e96c6
                                     PCIDevice *pci_dev)
Daniel P. Berrange 1e96c6
 {
Daniel P. Berrange 1e96c6
 }
Daniel P. Berrange 1e96c6
 
Daniel P. Berrange 1e96c6
-static inline void xen_create_ioreq_server(xc_interface *xc, domid_t dom,
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
 }
Daniel P. Berrange 1e96c6
 
Daniel P. Berrange 1e96c6
-static inline void xen_destroy_ioreq_server(xc_interface *xc, domid_t dom,
Daniel P. Berrange 1e96c6
+static inline void xen_destroy_ioreq_server(domid_t dom,
Daniel P. Berrange 1e96c6
                                             ioservid_t ioservid)
Daniel P. Berrange 1e96c6
 {
Daniel P. Berrange 1e96c6
 }
Daniel P. Berrange 1e96c6
 
Daniel P. Berrange 1e96c6
-static inline int xen_get_ioreq_server_info(xc_interface *xc, domid_t dom,
Daniel P. Berrange 1e96c6
+static inline int xen_get_ioreq_server_info(domid_t dom,
Daniel P. Berrange 1e96c6
                                             ioservid_t ioservid,
Daniel P. Berrange 1e96c6
                                             xen_pfn_t *ioreq_pfn,
Daniel P. Berrange 1e96c6
                                             xen_pfn_t *bufioreq_pfn,
Daniel P. Berrange 1e96c6
                                             evtchn_port_t *bufioreq_evtchn)
Daniel P. Berrange 1e96c6
 {
Daniel P. Berrange 1e96c6
-    return xen_get_default_ioreq_server_info(xc, dom, ioreq_pfn, bufioreq_pfn,
Daniel P. Berrange 1e96c6
+    return xen_get_default_ioreq_server_info(dom, ioreq_pfn,
Daniel P. Berrange 1e96c6
+                                             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(xc_interface *xc, domid_t dom,
Daniel P. Berrange 1e96c6
+static inline int xen_set_ioreq_server_state(domid_t dom,
Daniel P. Berrange 1e96c6
                                              ioservid_t ioservid,
Daniel P. Berrange 1e96c6
                                              bool enable)
Daniel P. Berrange 1e96c6
 {
Daniel P. Berrange 1e96c6
@@ -224,7 +228,7 @@ static inline int xen_set_ioreq_server_state(xc_interface *xc, domid_t dom,
Daniel P. Berrange 1e96c6
 
Daniel P. Berrange 1e96c6
 static bool use_default_ioreq_server;
Daniel P. Berrange 1e96c6
 
Daniel P. Berrange 1e96c6
-static inline void xen_map_memory_section(xc_interface *xc, domid_t dom,
Daniel P. Berrange 1e96c6
+static inline void xen_map_memory_section(domid_t dom,
Daniel P. Berrange 1e96c6
                                           ioservid_t ioservid,
Daniel P. Berrange 1e96c6
                                           MemoryRegionSection *section)
Daniel P. Berrange 1e96c6
 {
Daniel P. Berrange 1e96c6
@@ -237,11 +241,11 @@ static inline void xen_map_memory_section(xc_interface *xc, 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(xc, dom, ioservid, 1,
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
 }
Daniel P. Berrange 1e96c6
 
Daniel P. Berrange 1e96c6
-static inline void xen_unmap_memory_section(xc_interface *xc, domid_t dom,
Daniel P. Berrange 1e96c6
+static inline void xen_unmap_memory_section(domid_t dom,
Daniel P. Berrange 1e96c6
                                             ioservid_t ioservid,
Daniel P. Berrange 1e96c6
                                             MemoryRegionSection *section)
Daniel P. Berrange 1e96c6
 {
Daniel P. Berrange 1e96c6
@@ -253,13 +257,12 @@ static inline void xen_unmap_memory_section(xc_interface *xc, domid_t dom,
Daniel P. Berrange 1e96c6
         return;
Daniel P. Berrange 1e96c6
     }
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(xc, dom, ioservid, 1,
Daniel P. Berrange 1e96c6
-                                            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
 }
Daniel P. Berrange 1e96c6
 
Daniel P. Berrange 1e96c6
-static inline void xen_map_io_section(xc_interface *xc, domid_t dom,
Daniel P. Berrange 1e96c6
+static inline void xen_map_io_section(domid_t dom,
Daniel P. Berrange 1e96c6
                                       ioservid_t ioservid,
Daniel P. Berrange 1e96c6
                                       MemoryRegionSection *section)
Daniel P. Berrange 1e96c6
 {
Daniel P. Berrange 1e96c6
@@ -271,13 +274,12 @@ static inline void xen_map_io_section(xc_interface *xc, domid_t dom,
Daniel P. Berrange 1e96c6
         return;
Daniel P. Berrange 1e96c6
     }
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(xc, dom, ioservid, 0,
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
 }
Daniel P. Berrange 1e96c6
 
Daniel P. Berrange 1e96c6
-static inline void xen_unmap_io_section(xc_interface *xc, domid_t dom,
Daniel P. Berrange 1e96c6
+static inline void xen_unmap_io_section(domid_t dom,
Daniel P. Berrange 1e96c6
                                         ioservid_t ioservid,
Daniel P. Berrange 1e96c6
                                         MemoryRegionSection *section)
Daniel P. Berrange 1e96c6
 {
Daniel P. Berrange 1e96c6
@@ -290,11 +292,11 @@ static inline void xen_unmap_io_section(xc_interface *xc, 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(xc, dom, ioservid, 0,
Daniel P. Berrange 1e96c6
-                                            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
 }
Daniel P. Berrange 1e96c6
 
Daniel P. Berrange 1e96c6
-static inline void xen_map_pcidev(xc_interface *xc, domid_t dom,
Daniel P. Berrange 1e96c6
+static inline void xen_map_pcidev(domid_t dom,
Daniel P. Berrange 1e96c6
                                   ioservid_t ioservid,
Daniel P. Berrange 1e96c6
                                   PCIDevice *pci_dev)
Daniel P. Berrange 1e96c6
 {
Daniel P. Berrange 1e96c6
@@ -304,13 +306,13 @@ static inline void xen_map_pcidev(xc_interface *xc, 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(xc, dom, ioservid,
Daniel P. Berrange 1e96c6
-                                      0, pci_bus_num(pci_dev->bus),
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
 }
Daniel P. Berrange 1e96c6
 
Daniel P. Berrange 1e96c6
-static inline void xen_unmap_pcidev(xc_interface *xc, domid_t dom,
Daniel P. Berrange 1e96c6
+static inline void xen_unmap_pcidev(domid_t dom,
Daniel P. Berrange 1e96c6
                                     ioservid_t ioservid,
Daniel P. Berrange 1e96c6
                                     PCIDevice *pci_dev)
Daniel P. Berrange 1e96c6
 {
Daniel P. Berrange 1e96c6
@@ -320,16 +322,17 @@ static inline void xen_unmap_pcidev(xc_interface *xc, 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(xc, dom, ioservid,
Daniel P. Berrange 1e96c6
-                                          0, pci_bus_num(pci_dev->bus),
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
 }
Daniel P. Berrange 1e96c6
 
Daniel P. Berrange 1e96c6
-static inline void xen_create_ioreq_server(xc_interface *xc, domid_t dom,
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(xc, dom, HVM_IOREQSRV_BUFIOREQ_ATOMIC,
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
 
Daniel P. Berrange 1e96c6
     if (rc == 0) {
Daniel P. Berrange 1e96c6
@@ -342,7 +345,7 @@ static inline void xen_create_ioreq_server(xc_interface *xc, domid_t dom,
Daniel P. Berrange 1e96c6
     trace_xen_default_ioreq_server();
Daniel P. Berrange 1e96c6
 }
Daniel P. Berrange 1e96c6
 
Daniel P. Berrange 1e96c6
-static inline void xen_destroy_ioreq_server(xc_interface *xc, domid_t dom,
Daniel P. Berrange 1e96c6
+static inline void xen_destroy_ioreq_server(domid_t dom,
Daniel P. Berrange 1e96c6
                                             ioservid_t ioservid)
Daniel P. Berrange 1e96c6
 {
Daniel P. Berrange 1e96c6
     if (use_default_ioreq_server) {
Daniel P. Berrange 1e96c6
@@ -350,27 +353,27 @@ static inline void xen_destroy_ioreq_server(xc_interface *xc, 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(xc, dom, ioservid);
Daniel P. Berrange 1e96c6
+    xc_hvm_destroy_ioreq_server(xen_xc, dom, ioservid);
Daniel P. Berrange 1e96c6
 }
Daniel P. Berrange 1e96c6
 
Daniel P. Berrange 1e96c6
-static inline int xen_get_ioreq_server_info(xc_interface *xc, domid_t dom,
Daniel P. Berrange 1e96c6
+static inline int xen_get_ioreq_server_info(domid_t dom,
Daniel P. Berrange 1e96c6
                                             ioservid_t ioservid,
Daniel P. Berrange 1e96c6
                                             xen_pfn_t *ioreq_pfn,
Daniel P. Berrange 1e96c6
                                             xen_pfn_t *bufioreq_pfn,
Daniel P. Berrange 1e96c6
                                             evtchn_port_t *bufioreq_evtchn)
Daniel P. Berrange 1e96c6
 {
Daniel P. Berrange 1e96c6
     if (use_default_ioreq_server) {
Daniel P. Berrange 1e96c6
-        return xen_get_default_ioreq_server_info(xc, dom, ioreq_pfn,
Daniel P. Berrange 1e96c6
+        return xen_get_default_ioreq_server_info(dom, ioreq_pfn,
Daniel P. Berrange 1e96c6
                                                  bufioreq_pfn,
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(xc, dom, ioservid,
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
 }
Daniel P. Berrange 1e96c6
 
Daniel P. Berrange 1e96c6
-static inline int xen_set_ioreq_server_state(xc_interface *xc, domid_t dom,
Daniel P. Berrange 1e96c6
+static inline int xen_set_ioreq_server_state(domid_t dom,
Daniel P. Berrange 1e96c6
                                              ioservid_t ioservid,
Daniel P. Berrange 1e96c6
                                              bool enable)
Daniel P. Berrange 1e96c6
 {
Daniel P. Berrange 1e96c6
@@ -379,7 +382,8 @@ static inline int xen_set_ioreq_server_state(xc_interface *xc, 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(xc, dom, 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
 }
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 fd2c92847e..703e7a5861 100644
Daniel P. Berrange 1e96c6
--- a/xen-common.c
Daniel P. Berrange 1e96c6
+++ b/xen-common.c
Daniel P. Berrange 1e96c6
@@ -25,6 +25,9 @@
Daniel P. Berrange 1e96c6
     do { } while (0)
Daniel P. Berrange 1e96c6
 #endif
Daniel P. Berrange 1e96c6
 
Daniel P. Berrange 1e96c6
+xc_interface *xen_xc;
Daniel P. Berrange 1e96c6
+xenforeignmemory_handle *xen_fmem;
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
     struct xs_handle *xs = NULL;
Daniel P. Berrange 1e96c6
diff --git a/xen-hvm.c b/xen-hvm.c
Daniel P. Berrange 1e96c6
index 5043beb98f..dbb8c66dd3 100644
Daniel P. Berrange 1e96c6
--- a/xen-hvm.c
Daniel P. Berrange 1e96c6
+++ b/xen-hvm.c
Daniel P. Berrange 1e96c6
@@ -454,10 +454,10 @@ static void xen_set_memory(struct MemoryListener *listener,
Daniel P. Berrange 1e96c6
         return;
Daniel P. Berrange 1e96c6
     } else {
Daniel P. Berrange 1e96c6
         if (add) {
Daniel P. Berrange 1e96c6
-            xen_map_memory_section(xen_xc, xen_domid, state->ioservid,
Daniel P. Berrange 1e96c6
+            xen_map_memory_section(xen_domid, state->ioservid,
Daniel P. Berrange 1e96c6
                                    section);
Daniel P. Berrange 1e96c6
         } else {
Daniel P. Berrange 1e96c6
-            xen_unmap_memory_section(xen_xc, xen_domid, state->ioservid,
Daniel P. Berrange 1e96c6
+            xen_unmap_memory_section(xen_domid, state->ioservid,
Daniel P. Berrange 1e96c6
                                      section);
Daniel P. Berrange 1e96c6
         }
Daniel P. Berrange 1e96c6
     }
Daniel P. Berrange 1e96c6
@@ -521,7 +521,7 @@ static void xen_io_add(MemoryListener *listener,
Daniel P. Berrange 1e96c6
 
Daniel P. Berrange 1e96c6
     memory_region_ref(mr);
Daniel P. Berrange 1e96c6
 
Daniel P. Berrange 1e96c6
-    xen_map_io_section(xen_xc, xen_domid, state->ioservid, section);
Daniel P. Berrange 1e96c6
+    xen_map_io_section(xen_domid, state->ioservid, section);
Daniel P. Berrange 1e96c6
 }
Daniel P. Berrange 1e96c6
 
Daniel P. Berrange 1e96c6
 static void xen_io_del(MemoryListener *listener,
Daniel P. Berrange 1e96c6
@@ -534,7 +534,7 @@ static void xen_io_del(MemoryListener *listener,
Daniel P. Berrange 1e96c6
         return;
Daniel P. Berrange 1e96c6
     }
Daniel P. Berrange 1e96c6
 
Daniel P. Berrange 1e96c6
-    xen_unmap_io_section(xen_xc, xen_domid, state->ioservid, section);
Daniel P. Berrange 1e96c6
+    xen_unmap_io_section(xen_domid, state->ioservid, section);
Daniel P. Berrange 1e96c6
 
Daniel P. Berrange 1e96c6
     memory_region_unref(mr);
Daniel P. Berrange 1e96c6
 }
Daniel P. Berrange 1e96c6
@@ -547,7 +547,7 @@ static void xen_device_realize(DeviceListener *listener,
Daniel P. Berrange 1e96c6
     if (object_dynamic_cast(OBJECT(dev), TYPE_PCI_DEVICE)) {
Daniel P. Berrange 1e96c6
         PCIDevice *pci_dev = PCI_DEVICE(dev);
Daniel P. Berrange 1e96c6
 
Daniel P. Berrange 1e96c6
-        xen_map_pcidev(xen_xc, xen_domid, state->ioservid, pci_dev);
Daniel P. Berrange 1e96c6
+        xen_map_pcidev(xen_domid, state->ioservid, pci_dev);
Daniel P. Berrange 1e96c6
     }
Daniel P. Berrange 1e96c6
 }
Daniel P. Berrange 1e96c6
 
Daniel P. Berrange 1e96c6
@@ -559,7 +559,7 @@ static void xen_device_unrealize(DeviceListener *listener,
Daniel P. Berrange 1e96c6
     if (object_dynamic_cast(OBJECT(dev), TYPE_PCI_DEVICE)) {
Daniel P. Berrange 1e96c6
         PCIDevice *pci_dev = PCI_DEVICE(dev);
Daniel P. Berrange 1e96c6
 
Daniel P. Berrange 1e96c6
-        xen_unmap_pcidev(xen_xc, xen_domid, state->ioservid, pci_dev);
Daniel P. Berrange 1e96c6
+        xen_unmap_pcidev(xen_domid, state->ioservid, pci_dev);
Daniel P. Berrange 1e96c6
     }
Daniel P. Berrange 1e96c6
 }
Daniel P. Berrange 1e96c6
 
Daniel P. Berrange 1e96c6
@@ -1139,7 +1139,7 @@ static void xen_hvm_change_state_handler(void *opaque, int running,
Daniel P. Berrange 1e96c6
         xen_main_loop_prepare(state);
Daniel P. Berrange 1e96c6
     }
Daniel P. Berrange 1e96c6
 
Daniel P. Berrange 1e96c6
-    xen_set_ioreq_server_state(xen_xc, xen_domid,
Daniel P. Berrange 1e96c6
+    xen_set_ioreq_server_state(xen_domid,
Daniel P. Berrange 1e96c6
                                state->ioservid,
Daniel P. Berrange 1e96c6
                                (rstate == RUN_STATE_RUNNING));
Daniel P. Berrange 1e96c6
 }
Daniel P. Berrange 1e96c6
@@ -1227,7 +1227,7 @@ void xen_hvm_init(PCMachineState *pcms, MemoryRegion **ram_memory)
Daniel P. Berrange 1e96c6
         goto err;
Daniel P. Berrange 1e96c6
     }
Daniel P. Berrange 1e96c6
 
Daniel P. Berrange 1e96c6
-    xen_create_ioreq_server(xen_xc, xen_domid, &state->ioservid);
Daniel P. Berrange 1e96c6
+    xen_create_ioreq_server(xen_domid, &state->ioservid);
Daniel P. Berrange 1e96c6
 
Daniel P. Berrange 1e96c6
     state->exit.notify = xen_exit_notifier;
Daniel P. Berrange 1e96c6
     qemu_add_exit_notifier(&state->exit);
Daniel P. Berrange 1e96c6
@@ -1238,7 +1238,7 @@ void xen_hvm_init(PCMachineState *pcms, MemoryRegion **ram_memory)
Daniel P. Berrange 1e96c6
     state->wakeup.notify = xen_wakeup_notifier;
Daniel P. Berrange 1e96c6
     qemu_register_wakeup_notifier(&state->wakeup);
Daniel P. Berrange 1e96c6
 
Daniel P. Berrange 1e96c6
-    rc = xen_get_ioreq_server_info(xen_xc, xen_domid, state->ioservid,
Daniel P. Berrange 1e96c6
+    rc = xen_get_ioreq_server_info(xen_domid, state->ioservid,
Daniel P. Berrange 1e96c6
                                    &ioreq_pfn, &bufioreq_pfn,
Daniel P. Berrange 1e96c6
                                    &bufioreq_evtchn);
Daniel P. Berrange 1e96c6
     if (rc < 0) {
Daniel P. Berrange 1e96c6
@@ -1288,7 +1288,7 @@ void xen_hvm_init(PCMachineState *pcms, MemoryRegion **ram_memory)
Daniel P. Berrange 1e96c6
     /* Note: cpus is empty at this point in init */
Daniel P. Berrange 1e96c6
     state->cpu_by_vcpu_id = g_malloc0(max_cpus * sizeof(CPUState *));
Daniel P. Berrange 1e96c6
 
Daniel P. Berrange 1e96c6
-    rc = xen_set_ioreq_server_state(xen_xc, xen_domid, state->ioservid, true);
Daniel P. Berrange 1e96c6
+    rc = xen_set_ioreq_server_state(xen_domid, state->ioservid, true);
Daniel P. Berrange 1e96c6
     if (rc < 0) {
Daniel P. Berrange 1e96c6
         error_report("failed to enable ioreq server info: error %d handle=%p",
Daniel P. Berrange 1e96c6
                      errno, xen_xc);
Daniel P. Berrange 1e96c6
-- 
Daniel P. Berrange 1e96c6
2.13.0
Daniel P. Berrange 1e96c6