libxendevicemodel: provide xendevicemodel_relocate_memory
authorRoss Lagerwall <ross.lagerwall@citrix.com>
Thu, 25 Jan 2018 11:26:23 +0000 (12:26 +0100)
committerJan Beulich <jbeulich@suse.com>
Thu, 25 Jan 2018 11:26:23 +0000 (12:26 +0100)
Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Reviewed-by: Paul Durrant <paul.durrant@citrix.com>
tools/libs/devicemodel/Makefile
tools/libs/devicemodel/core.c
tools/libs/devicemodel/include/xendevicemodel.h
tools/libs/devicemodel/libxendevicemodel.map

index 342371a04de0a8fec96f2814a8e2dd5dc674d4d2..5b2df7a18e899164f5f073b4b8b66fc647b6c0d6 100644 (file)
@@ -2,7 +2,7 @@ XEN_ROOT = $(CURDIR)/../../..
 include $(XEN_ROOT)/tools/Rules.mk
 
 MAJOR    = 1
-MINOR    = 1
+MINOR    = 2
 SHLIB_LDFLAGS += -Wl,--version-script=libxendevicemodel.map
 
 CFLAGS   += -Werror -Wmissing-prototypes
index 355b7dec18a17ea3bc70980eed89f4736223656c..4ae15e14e4219da6f47c141d562efceec17802d2 100644 (file)
@@ -564,6 +564,26 @@ int xendevicemodel_shutdown(
     return xendevicemodel_op(dmod, domid, 1, &op, sizeof(op));
 }
 
+int xendevicemodel_relocate_memory(
+    xendevicemodel_handle *dmod, domid_t domid, uint32_t size, uint64_t src_gfn,
+    uint64_t dst_gfn)
+{
+    struct xen_dm_op op;
+    struct xen_dm_op_relocate_memory *data;
+
+    memset(&op, 0, sizeof(op));
+
+    op.op = XEN_DMOP_relocate_memory;
+    data = &op.u.relocate_memory;
+
+    data->size = size;
+    data->pad = 0;
+    data->src_gfn = src_gfn;
+    data->dst_gfn = dst_gfn;
+
+    return xendevicemodel_op(dmod, domid, 1, &op, sizeof(op));
+}
+
 int xendevicemodel_restrict(xendevicemodel_handle *dmod, domid_t domid)
 {
     return osdep_xendevicemodel_restrict(dmod, domid);
index dda0bc76958d86eaf57393ba3bb3fd66be25a9b2..e5e047ee58794269410ed09bd0c7e1bee7c2974b 100644 (file)
@@ -325,6 +325,20 @@ int xendevicemodel_inject_event(
 int xendevicemodel_shutdown(
     xendevicemodel_handle *dmod, domid_t domid, unsigned int reason);
 
+/*
+ * Relocate GFNs for the specified domain.
+ *
+ * @parm dmod a handle to an open devicemodel interface.
+ * @parm domid the domain id to be serviced
+ * @parm size Number of GFNs to process
+ * @parm src_gfn Starting GFN to relocate
+ * @parm dst_gfn Starting GFN where GFNs should be relocated
+ * @return 0 on success, -1 on failure.
+ */
+int xendevicemodel_relocate_memory(
+    xendevicemodel_handle *dmod, domid_t domid, uint32_t size, uint64_t src_gfn,
+    uint64_t dst_gfn);
+
 /**
  * This function restricts the use of this handle to the specified
  * domain.
index cefd32bd8becc08e86d9cbaec2f9bb38e3dffa9a..4c967b3159b23483482f16990b8e84cbaa288b25 100644 (file)
@@ -27,3 +27,8 @@ VERS_1.1 {
        global:
                xendevicemodel_shutdown;
 } VERS_1.0;
+
+VERS_1.2 {
+       global:
+               xendevicemodel_relocate_memory;
+} VERS_1.1;