[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [v6][PATCH 2/7] tools/libxc: introduce hypercall for xc_reserved_device_memory_map
We will introduce that hypercall xc_reserved_device_memory_map to libxc. Signed-off-by: Tiejun Chen <tiejun.chen@xxxxxxxxx> diff --git a/tools/libxc/xc_domain.c b/tools/libxc/xc_domain.c index c67ac9a..b9374d2 100644 --- a/tools/libxc/xc_domain.c +++ b/tools/libxc/xc_domain.c @@ -649,6 +649,35 @@ int xc_domain_set_memory_map(xc_interface *xch, return rc; } + +int xc_reserved_device_memory_map(xc_interface *xch, + struct xen_mem_reserved_device_memory entries[], + uint32_t *max_entries) +{ + int rc; + struct xen_mem_reserved_device_memory_map memmap = { + .nr_entries = *max_entries + }; + DECLARE_HYPERCALL_BOUNCE(entries, + sizeof(struct xen_mem_reserved_device_memory) * + *max_entries, XC_HYPERCALL_BUFFER_BOUNCE_OUT); + + if ( xc_hypercall_bounce_pre(xch, entries) ) + return -1; + + set_xen_guest_handle(memmap.buffer, entries); + + rc = do_memory_op(xch, XENMEM_reserved_device_memory_map, + &memmap, sizeof(memmap)); + + xc_hypercall_bounce_post(xch, entries); + + if ( errno == ENOBUFS ) + *max_entries = memmap.nr_entries; + + return rc ? -errno : memmap.nr_entries; +} + int xc_get_machine_memory_map(xc_interface *xch, struct e820entry entries[], uint32_t max_entries) diff --git a/tools/libxc/xenctrl.h b/tools/libxc/xenctrl.h index 1c5d0db..aa32c81 100644 --- a/tools/libxc/xenctrl.h +++ b/tools/libxc/xenctrl.h @@ -1270,6 +1270,10 @@ int xc_domain_set_memory_map(xc_interface *xch, int xc_get_machine_memory_map(xc_interface *xch, struct e820entry entries[], uint32_t max_entries); + +int xc_reserved_device_memory_map(xc_interface *xch, + struct xen_mem_reserved_device_memory entries[], + uint32_t *max_entries); #endif int xc_domain_set_time_offset(xc_interface *xch, uint32_t domid, -- 1.9.1 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |