libxc: Expose xc_reserved_device_memory_map to ARM too
authorJulien Grall <julien.grall@citrix.com>
Thu, 23 Jul 2015 16:47:09 +0000 (17:47 +0100)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Thu, 23 Jul 2015 18:20:48 +0000 (19:20 +0100)
The commit 25652f2 "tools/libxl: detect and avoid conflicts with RDM"
introduced the usage of xc_reserved_device_memory_map in the libxl
generic code. But the function is only defined for x86 which breaks the
ARM build.

The hypercall called by this helper is implemented in the generic code
and doesn't contain any x86 specific code. Therefore, it's fine to
expose the helper to ARM.

Signed-off-by: Julien Grall <julien.grall@citrix.com>
CC: Ian Jackson <ian.jackson@eu.citrix.com>
CC: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
CC: Ian Campbell <ian.campbell@citrix.com>
CC: Wei Liu <wei.liu2@citrix.com>
CC: Tiejun Chen <tiejun.chen@intel.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
tools/libxc/include/xenctrl.h
tools/libxc/xc_domain.c

index 3f2381a0409469e4b24082db1be81763369f0ea5..0a98aee6248813d6657cf83b39f558e5c42cc5d3 100644 (file)
@@ -1314,6 +1314,7 @@ int xc_domain_set_memory_map(xc_interface *xch,
 int xc_get_machine_memory_map(xc_interface *xch,
                               struct e820entry entries[],
                               uint32_t max_entries);
+#endif
 
 int xc_reserved_device_memory_map(xc_interface *xch,
                                   uint32_t flags,
@@ -1322,7 +1323,6 @@ int xc_reserved_device_memory_map(xc_interface *xch,
                                   uint8_t devfn,
                                   struct xen_reserved_device_memory entries[],
                                   uint32_t *max_entries);
-#endif
 int xc_domain_set_time_offset(xc_interface *xch,
                               uint32_t domid,
                               int32_t time_offset_seconds);
index df063148ae6c04c139dcfdf4ceaef7523d173ae6..77d852b5e2b0b639b0df43388a5910cc2676dea7 100644 (file)
@@ -685,41 +685,6 @@ int xc_domain_set_memory_map(xc_interface *xch,
     return rc;
 }
 
-int xc_reserved_device_memory_map(xc_interface *xch,
-                                  uint32_t flags,
-                                  uint16_t seg,
-                                  uint8_t bus,
-                                  uint8_t devfn,
-                                  struct xen_reserved_device_memory entries[],
-                                  uint32_t *max_entries)
-{
-    int rc;
-    struct xen_reserved_device_memory_map xrdmmap = {
-        .flags = flags,
-        .dev.pci.seg = seg,
-        .dev.pci.bus = bus,
-        .dev.pci.devfn = devfn,
-        .nr_entries = *max_entries
-    };
-    DECLARE_HYPERCALL_BOUNCE(entries,
-                             sizeof(struct xen_reserved_device_memory) *
-                             *max_entries, XC_HYPERCALL_BUFFER_BOUNCE_OUT);
-
-    if ( xc_hypercall_bounce_pre(xch, entries) )
-        return -1;
-
-    set_xen_guest_handle(xrdmmap.buffer, entries);
-
-    rc = do_memory_op(xch, XENMEM_reserved_device_memory_map,
-                      &xrdmmap, sizeof(xrdmmap));
-
-    xc_hypercall_bounce_post(xch, entries);
-
-    *max_entries = xrdmmap.nr_entries;
-
-    return rc;
-}
-
 int xc_get_machine_memory_map(xc_interface *xch,
                               struct e820entry entries[],
                               uint32_t max_entries)
@@ -766,6 +731,41 @@ int xc_domain_set_memmap_limit(xc_interface *xch,
 }
 #endif
 
+int xc_reserved_device_memory_map(xc_interface *xch,
+                                  uint32_t flags,
+                                  uint16_t seg,
+                                  uint8_t bus,
+                                  uint8_t devfn,
+                                  struct xen_reserved_device_memory entries[],
+                                  uint32_t *max_entries)
+{
+    int rc;
+    struct xen_reserved_device_memory_map xrdmmap = {
+        .flags = flags,
+        .dev.pci.seg = seg,
+        .dev.pci.bus = bus,
+        .dev.pci.devfn = devfn,
+        .nr_entries = *max_entries
+    };
+    DECLARE_HYPERCALL_BOUNCE(entries,
+                             sizeof(struct xen_reserved_device_memory) *
+                             *max_entries, XC_HYPERCALL_BUFFER_BOUNCE_OUT);
+
+    if ( xc_hypercall_bounce_pre(xch, entries) )
+        return -1;
+
+    set_xen_guest_handle(xrdmmap.buffer, entries);
+
+    rc = do_memory_op(xch, XENMEM_reserved_device_memory_map,
+                      &xrdmmap, sizeof(xrdmmap));
+
+    xc_hypercall_bounce_post(xch, entries);
+
+    *max_entries = xrdmmap.nr_entries;
+
+    return rc;
+}
+
 int xc_domain_set_time_offset(xc_interface *xch,
                               uint32_t domid,
                               int32_t time_offset_seconds)