From: Ross Lagerwall <ross.lagerwall@citrix.com>
To: xen-devel@lists.xen.org
Cc: Ross Lagerwall <ross.lagerwall@citrix.com>,
Ian Jackson <ian.jackson@eu.citrix.com>,
Wei Liu <wei.liu2@citrix.com>
Subject: [PATCH v4 4/6] tools: libxendevicemodel: Provide xendevicemodel_relocate_memory
Date: Tue, 23 Jan 2018 15:22:44 +0000 [thread overview]
Message-ID: <20180123152246.22031-5-ross.lagerwall@citrix.com> (raw)
In-Reply-To: <20180123152246.22031-1-ross.lagerwall@citrix.com>
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>
---
Changed in v4:
* Rename add_to_physmap to relocate_memory to match hypervisor
interface.
Changed in v3:
* Match width of size with updated hypervisor interface.
* Match description with the one for the hypervisor interface.
Changed in v2:
* Make it operate on a range.
tools/libs/devicemodel/Makefile | 2 +-
tools/libs/devicemodel/core.c | 20 ++++++++++++++++++++
tools/libs/devicemodel/include/xendevicemodel.h | 14 ++++++++++++++
tools/libs/devicemodel/libxendevicemodel.map | 5 +++++
4 files changed, 40 insertions(+), 1 deletion(-)
diff --git a/tools/libs/devicemodel/Makefile b/tools/libs/devicemodel/Makefile
index 342371a..5b2df7a 100644
--- a/tools/libs/devicemodel/Makefile
+++ b/tools/libs/devicemodel/Makefile
@@ -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
diff --git a/tools/libs/devicemodel/core.c b/tools/libs/devicemodel/core.c
index 355b7de..4ae15e1 100644
--- a/tools/libs/devicemodel/core.c
+++ b/tools/libs/devicemodel/core.c
@@ -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);
diff --git a/tools/libs/devicemodel/include/xendevicemodel.h b/tools/libs/devicemodel/include/xendevicemodel.h
index dda0bc7..e5e047e 100644
--- a/tools/libs/devicemodel/include/xendevicemodel.h
+++ b/tools/libs/devicemodel/include/xendevicemodel.h
@@ -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.
diff --git a/tools/libs/devicemodel/libxendevicemodel.map b/tools/libs/devicemodel/libxendevicemodel.map
index cefd32b..4c967b3 100644
--- a/tools/libs/devicemodel/libxendevicemodel.map
+++ b/tools/libs/devicemodel/libxendevicemodel.map
@@ -27,3 +27,8 @@ VERS_1.1 {
global:
xendevicemodel_shutdown;
} VERS_1.0;
+
+VERS_1.2 {
+ global:
+ xendevicemodel_relocate_memory;
+} VERS_1.1;
--
2.9.5
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
next prev parent reply other threads:[~2018-01-23 15:22 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-23 15:22 [PATCH v4 0/6] Add dmops to allow use of VGA with restricted QEMU Ross Lagerwall
2018-01-23 15:22 ` [PATCH v4 1/6] xen/mm: Make xenmem_add_to_physmap global Ross Lagerwall
2018-01-23 15:49 ` Wei Liu
2018-01-23 15:22 ` [PATCH v4 2/6] x86/hvm: Provide XEN_DMOP_relocate_memory Ross Lagerwall
2018-01-24 8:09 ` Jan Beulich
2018-01-24 9:20 ` Paul Durrant
2018-01-23 15:22 ` [PATCH v4 3/6] x86/hvm: Provide XEN_DMOP_pin_memory_cacheattr Ross Lagerwall
2018-01-23 15:22 ` Ross Lagerwall [this message]
2018-01-23 15:22 ` [PATCH v4 5/6] tools: libxendevicemodel: Provide xendevicemodel_pin_memory_cacheattr Ross Lagerwall
2018-01-23 15:22 ` [PATCH v4 6/6] x86/domctl: Remove XEN_DOMCTL_pin_mem_cacheattr Ross Lagerwall
2018-01-23 15:44 ` Wei Liu
2018-01-23 15:47 ` Ross Lagerwall
2018-01-23 15:49 ` Wei Liu
2018-01-23 17:16 ` Jan Beulich
2018-01-23 17:49 ` Wei Liu
2018-01-24 8:00 ` Jan Beulich
2018-03-05 14:40 ` [PATCH v4 0/6] Add dmops to allow use of VGA with restricted QEMU Anthony PERARD
2018-03-05 15:13 ` Ross Lagerwall
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180123152246.22031-5-ross.lagerwall@citrix.com \
--to=ross.lagerwall@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).