From: Ian Campbell Subject: Re: [PATCH v6 10/11] tools, libxl: handle the iomem parameter with the memory_mapping hcall Date: Mon, 28 Apr 2014 14:24:07 +0100 Message-ID: <1398691447.29700.94.camel@kazak.uk.xensource.com> References: <1398087904-16594-1-git-send-email-avanzini.arianna@gmail.com> <1398087904-16594-11-git-send-email-avanzini.arianna@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1398087904-16594-11-git-send-email-avanzini.arianna@gmail.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: Arianna Avanzini Cc: paolo.valente@unimore.it, keir@xen.org, stefano.stabellini@eu.citrix.com, Ian.Jackson@eu.citrix.com, dario.faggioli@citrix.com, tim@xen.org, xen-devel@lists.xen.org, julien.grall@citrix.com, etrudeau@broadcom.com, JBeulich@suse.com, viktor.kleinik@globallogic.com List-Id: xen-devel@lists.xenproject.org On Mon, 2014-04-21 at 15:45 +0200, Arianna Avanzini wrote: > Currently, the configuration-parsing code concerning the handling of the > iomem parameter only invokes the XEN_DOMCTL_iomem_permission hypercall. > This commit lets the XEN_DOMCTL_memory_mapping hypercall be invoked > after XEN_DOMCTL_iomem_permission when the iomem parameter is parsed > from a domU configuration file, so that the address range can be mapped > to the address space of the domU. The hypercall is invoked only in case > of domains using an auto-translated physmap. > > Signed-off-by: Arianna Avanzini > Cc: Dario Faggioli > Cc: Paolo Valente > Cc: Stefano Stabellini > Cc: Julien Grall > Cc: Ian Campbell > Cc: Jan Beulich > Cc: Keir Fraser > Cc: Tim Deegan > Cc: Ian Jackson > Cc: Eric Trudeau > Cc: Viktor Kleinik > > --- > > v4: > - Let the hypercall be called only in case the guest uses an > auto-translated physmap. > > v3: > - Add ifdefs to let the hypercall be called only by ARM or x86 > HVM guests, with a whitelist approach. > - Remove the NOTE comment. > > v2: > - Add a comment explaining outstanding issues. > > --- > tools/libxl/libxl_create.c | 13 +++++++++++++ > 1 file changed, 13 insertions(+) > > diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c > index 6aa630e..cdf03cd 100644 > --- a/tools/libxl/libxl_create.c > +++ b/tools/libxl/libxl_create.c > @@ -1113,6 +1113,19 @@ static void domcreate_launch_dm(libxl__egc *egc, libxl__multidev *multidev, > "failed give dom%d access to iomem range %"PRIx64"-%"PRIx64, > domid, io->start, io->start + io->number - 1); > ret = ERROR_FAIL; > + continue; > + } > + if (!libxl__arch_auto_translated_physmap(d_config)) > + continue; Maybe this could be part of xc_domain_memory_mapping and avoid the need for libxl to know about these things? > + ret = xc_domain_memory_mapping(CTX->xch, domid, > + io->gfn, io->start, > + io->number, 1); > + if (ret < 0) { > + LOGE(ERROR, > + "failed to map to dom%d iomem range %"PRIx64"-%"PRIx64 > + " to guest address %"PRIx64, > + domid, io->start, io->start + io->number - 1, io->gfn); > + ret = ERROR_FAIL; > } > } >