From mboxrd@z Thu Jan 1 00:00:00 1970 From: Konrad Rzeszutek Wilk Subject: Re: [v8][PATCH 05/17] tools/libxc: introduce hypercall for xc_reserved_device_memory_map Date: Tue, 2 Dec 2014 14:50:17 -0500 Message-ID: <20141202195017.GE357@laptop.dumpdata.com> References: <1417425875-9634-1-git-send-email-tiejun.chen@intel.com> <1417425875-9634-6-git-send-email-tiejun.chen@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <1417425875-9634-6-git-send-email-tiejun.chen@intel.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Tiejun Chen Cc: kevin.tian@intel.com, wei.liu2@citrix.com, ian.campbell@citrix.com, stefano.stabellini@eu.citrix.com, tim@xen.org, ian.jackson@eu.citrix.com, xen-devel@lists.xen.org, jbeulich@suse.com, yang.z.zhang@intel.com List-Id: xen-devel@lists.xenproject.org On Mon, Dec 01, 2014 at 05:24:23PM +0800, Tiejun Chen wrote: > We will introduce that hypercall xc_reserved_device_memory_map > approach to libxc. > > Signed-off-by: Tiejun Chen > --- > tools/libxc/include/xenctrl.h | 5 +++++ > tools/libxc/xc_domain.c | 30 ++++++++++++++++++++++++++++++ > 2 files changed, 35 insertions(+) > > diff --git a/tools/libxc/include/xenctrl.h b/tools/libxc/include/xenctrl.h > index 84012fe..a3aeac3 100644 > --- a/tools/libxc/include/xenctrl.h > +++ b/tools/libxc/include/xenctrl.h > @@ -1294,6 +1294,11 @@ 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, > + uint32_t dom, > + struct xen_reserved_device_memory entries[], > + uint32_t *max_entries); > #endif > int xc_domain_set_time_offset(xc_interface *xch, > uint32_t domid, > diff --git a/tools/libxc/xc_domain.c b/tools/libxc/xc_domain.c > index 7fd43e9..09fd988 100644 > --- a/tools/libxc/xc_domain.c > +++ b/tools/libxc/xc_domain.c > @@ -679,6 +679,36 @@ int xc_domain_set_memory_map(xc_interface *xch, > > return rc; > } > + > +int xc_reserved_device_memory_map(xc_interface *xch, > + uint32_t domid, > + struct xen_reserved_device_memory entries[], > + uint32_t *max_entries) > +{ > + int rc; > + struct xen_reserved_device_memory_map xrdmmap = { > + .domid = domid, > + .nr_entries = *max_entries > + }; > + DECLARE_HYPERCALL_BOUNCE(entries, > + sizeof(struct xen_reserved_device_memory) * > + *max_entries, XC_HYPERCALL_BUFFER_BOUNCE_OUT); > + > + if ( xc_hypercall_bounce_pre(xch, entries) ) > + return -1; > + > + set_xen_guest_handle(xrdmmap.buffer, entries); > + > + rc = do_memory_op(xch, XENMEM_reserved_device_memory_map, > + &xrdmmap, sizeof(xrdmmap)); > + > + xc_hypercall_bounce_post(xch, entries); > + > + *max_entries = xrdmmap.nr_entries; > + I would bake the -EAGAIN support in here to loop here. See how the xc_domain_destroy does it. > + return rc ? rc : xrdmmap.nr_entries; > +} > + > int xc_get_machine_memory_map(xc_interface *xch, > struct e820entry entries[], > uint32_t max_entries) > -- > 1.9.1 >