From: Zhongze Liu <blackskygg@gmail.com>
To: xen-devel@lists.xenproject.org
Cc: Wei Liu <wei.liu2@citrix.com>,
Stefano Stabellini <sstabellini@kernel.org>,
Ian Jackson <ian.jackson@eu.citrix.com>,
Zhongze Liu <blackskygg@gmail.com>
Subject: [PATCH] libxc: add xc_domain_add_to_physmap_batch to wrap XENMEM_add_to_physmap_batch
Date: Fri, 16 Jun 2017 12:55:30 +0800 [thread overview]
Message-ID: <20170616045530.21079-1-blackskygg@gmail.com> (raw)
currently there is no wrapper for XENMEM_add_to_physmap_batch in libxc.
add a wrapper to do that.
Signed-off-by: Zhongze Liu <blackskygg@gmail.com>
---
Cc: Ian Jackson <ian.jackson@eu.citrix.com>,
Cc: Wei Liu <wei.liu2@citrix.com>,
Cc: Stefano Stabellini <sstabellini@kernel.org>
---
tools/libxc/include/xenctrl.h | 9 +++++++++
tools/libxc/xc_domain.c | 44 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 53 insertions(+)
diff --git a/tools/libxc/include/xenctrl.h b/tools/libxc/include/xenctrl.h
index 1629f412dd..4ea520b188 100644
--- a/tools/libxc/include/xenctrl.h
+++ b/tools/libxc/include/xenctrl.h
@@ -1372,6 +1372,15 @@ int xc_domain_add_to_physmap(xc_interface *xch,
unsigned long idx,
xen_pfn_t gpfn);
+int xc_domain_add_to_physmap_batch(xc_interface *xch,
+ uint32_t domid,
+ uint32_t foreign_domid,
+ unsigned int space,
+ uint16_t size,
+ xen_ulong_t *idxs,
+ xen_pfn_t *gfpns,
+ int *errs);
+
int xc_domain_populate_physmap(xc_interface *xch,
uint32_t domid,
unsigned long nr_extents,
diff --git a/tools/libxc/xc_domain.c b/tools/libxc/xc_domain.c
index 5d192ea0e4..0d34754821 100644
--- a/tools/libxc/xc_domain.c
+++ b/tools/libxc/xc_domain.c
@@ -1032,6 +1032,50 @@ int xc_domain_add_to_physmap(xc_interface *xch,
return do_memory_op(xch, XENMEM_add_to_physmap, &xatp, sizeof(xatp));
}
+int xc_domain_add_to_physmap_batch(xc_interface *xch,
+ uint32_t domid,
+ uint32_t foreign_domid,
+ unsigned int space,
+ uint16_t size,
+ xen_ulong_t *idxs,
+ xen_pfn_t *gpfns,
+ int *errs)
+{
+ int rc;
+ DECLARE_HYPERCALL_BOUNCE(idxs, size * sizeof(*idxs), XC_HYPERCALL_BUFFER_BOUNCE_IN);
+ DECLARE_HYPERCALL_BOUNCE(gpfns, size * sizeof(*gpfns), XC_HYPERCALL_BUFFER_BOUNCE_IN);
+ DECLARE_HYPERCALL_BOUNCE(errs, size * sizeof(*errs), XC_HYPERCALL_BUFFER_BOUNCE_OUT);
+
+ struct xen_add_to_physmap_batch xatp_batch = {
+ .domid = domid,
+ .space = space,
+ .size = size,
+ .u = {.foreign_domid = foreign_domid}
+ };
+
+ if ( xc_hypercall_bounce_pre(xch, idxs) ||
+ xc_hypercall_bounce_pre(xch, gpfns) ||
+ xc_hypercall_bounce_pre(xch, errs) )
+ {
+ PERROR("Could not bounce memory for XENMEM_add_to_physmap_batch");
+ goto out;
+ }
+
+ set_xen_guest_handle(xatp_batch.idxs, idxs);
+ set_xen_guest_handle(xatp_batch.gpfns, gpfns);
+ set_xen_guest_handle(xatp_batch.errs, errs);
+
+ rc = do_memory_op(xch, XENMEM_add_to_physmap_batch,
+ &xatp_batch, sizeof(xatp_batch));
+
+out:
+ xc_hypercall_bounce_post(xch, idxs);
+ xc_hypercall_bounce_post(xch, gpfns);
+ xc_hypercall_bounce_post(xch, errs);
+
+ return rc;
+}
+
int xc_domain_claim_pages(xc_interface *xch,
uint32_t domid,
unsigned long nr_pages)
--
2.13.1
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next reply other threads:[~2017-06-16 4:57 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-16 4:55 Zhongze Liu [this message]
2017-06-16 8:45 ` [PATCH] libxc: add xc_domain_add_to_physmap_batch to wrap XENMEM_add_to_physmap_batch Jan Beulich
2017-06-16 9:36 ` Zhongze Liu
2017-06-16 9:44 ` Zhongze Liu
2017-06-16 10:07 ` Zhongze Liu
2017-06-16 10:33 ` Jan Beulich
2017-06-19 11:12 ` Wei Liu
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=20170616045530.21079-1-blackskygg@gmail.com \
--to=blackskygg@gmail.com \
--cc=ian.jackson@eu.citrix.com \
--cc=sstabellini@kernel.org \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xenproject.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.