From: Ross Lagerwall Date: Thu, 25 Jan 2018 11:26:23 +0000 (+0100) Subject: libxendevicemodel: provide xendevicemodel_relocate_memory X-Git-Tag: archive/raspbian/4.11.1-1+rpi1~1^2~66^2~700 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=704538a4741173f4d339650700be681b85722785;p=xen.git libxendevicemodel: provide xendevicemodel_relocate_memory Signed-off-by: Ross Lagerwall Acked-by: Ian Jackson Reviewed-by: Paul Durrant --- diff --git a/tools/libs/devicemodel/Makefile b/tools/libs/devicemodel/Makefile index 342371a04d..5b2df7a18e 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 355b7dec18..4ae15e14e4 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 dda0bc7695..e5e047ee58 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 cefd32bd8b..4c967b3159 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;