aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libxc/xc_domain.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/libxc/xc_domain.c')
-rw-r--r--tools/libxc/xc_domain.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/tools/libxc/xc_domain.c b/tools/libxc/xc_domain.c
index 480ce91500..299c9073b7 100644
--- a/tools/libxc/xc_domain.c
+++ b/tools/libxc/xc_domain.c
@@ -775,6 +775,36 @@ int xc_domain_add_to_physmap(xc_interface *xch,
return do_memory_op(xch, XENMEM_add_to_physmap, &xatp, sizeof(xatp));
}
+int xc_domain_claim_pages(xc_interface *xch,
+ uint32_t domid,
+ unsigned long nr_pages)
+{
+ int err;
+ struct xen_memory_reservation reservation = {
+ .nr_extents = nr_pages,
+ .extent_order = 0,
+ .mem_flags = 0, /* no flags */
+ .domid = domid
+ };
+
+ set_xen_guest_handle(reservation.extent_start, HYPERCALL_BUFFER_NULL);
+
+ err = do_memory_op(xch, XENMEM_claim_pages, &reservation, sizeof(reservation));
+ /* Ignore it if the hypervisor does not support the call. */
+ if (err == -1 && errno == ENOSYS)
+ err = errno = 0;
+ return err;
+}
+unsigned long xc_domain_get_outstanding_pages(xc_interface *xch)
+{
+ long ret = do_memory_op(xch, XENMEM_get_outstanding_pages, NULL, 0);
+
+ /* Ignore it if the hypervisor does not support the call. */
+ if (ret == -1 && errno == ENOSYS)
+ ret = errno = 0;
+ return ret;
+}
+
int xc_domain_populate_physmap(xc_interface *xch,
uint32_t domid,
unsigned long nr_extents,