From mboxrd@z Thu Jan 1 00:00:00 1970 From: Julien Grall Subject: Re: [PATCH v7 07/10] xen/common: move the memory_mapping DOMCTL hypercall to common code Date: Sat, 10 May 2014 10:03:17 +0100 Message-ID: <536DEB55.3020706@linaro.org> References: <1399305254-3695-1-git-send-email-avanzini.arianna@gmail.com> <1399305254-3695-8-git-send-email-avanzini.arianna@gmail.com> <536913C0.3090206@linaro.org> <536D7EC5.1090807@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <536D7EC5.1090807@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 , xen-devel@lists.xen.org Cc: julien.grall@citrix.com, paolo.valente@unimore.it, keir@xen.org, stefano.stabellini@eu.citrix.com, tim@xen.org, dario.faggioli@citrix.com, Ian.Jackson@eu.citrix.com, Ian.Campbell@eu.citrix.com, etrudeau@broadcom.com, JBeulich@suse.com, andrew.cooper3@citrix.com, viktor.kleinik@globallogic.com List-Id: xen-devel@lists.xenproject.org Hi Arianna, On 10/05/14 02:20, Arianna Avanzini wrote: > On 05/06/2014 06:54 PM, Julien Grall wrote: >> Hi Arianna, >> >> On 05/05/2014 04:54 PM, Arianna Avanzini wrote: >>> + ret = iomem_permit_access(d, mfn, mfn_end); >>> + if ( !ret ) >>> + { >>> + ret = map_mmio_regions(d, gfn, nr_mfns, _mfn(mfn)); >> >> The code of map_mmio_regions differs between x86 on ARM. >> >> On the former architecture, if Xen fails to map a page, it will unmap >> all the previous page. It's not the case on ARM. >> > > The map_mmio_regions() implementation for x86 (factored out from the > x86-specific code in patch 0006) includes also unmapping the pages in the case > of an error (even if I just realized that I made a mistake there by still using > the end gfn instead of the number of gfns). The ARM implementation is still the > original one, calling apply_p2m_changes(). For hypercall like memory_mapping DOMCTL, failing to map the whole region doesn't necessary mean the domain will be destroyed right after. So it's not possible to have the region partially mapped in the guest. I think you should call unmap in map_mmio_regions if Xen fails to map the whole region. Regards, -- Julien Grall