From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stefano Stabellini Subject: Re: [PATCH] xen/arm: Correctly implement domain_page_map_to_mfn Date: Wed, 5 Feb 2014 16:27:01 +0000 Message-ID: References: <1391609794-505-1-git-send-email-julien.grall@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WB5Kg-0005m0-2B for xen-devel@lists.xenproject.org; Wed, 05 Feb 2014 16:28:14 +0000 In-Reply-To: <1391609794-505-1-git-send-email-julien.grall@linaro.org> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Julien Grall Cc: ian.campbell@citrix.com, patches@linaro.org, tim@xen.org, George Dunlap , stefano.stabellini@citrix.com, xen-devel@lists.xenproject.org List-Id: xen-devel@lists.xenproject.org On Wed, 5 Feb 2014, Julien Grall wrote: > The function domain_page_map_to_mfn can be used to translate a virtual > address mapped by both map_domain_page and map_domain_page_global. > The former is using vmap to map the mfn, therefore domain_page_map_to_mfn > will always fail because the address is not in DOMHEAP range. > > Check if the address is in vmap range and use __pa to translate it. > > This patch fix guest shutdown when the event fifo is used. > > Signed-off-by: Julien Grall > Cc: George Dunlap It looks good to me. Acked-by: Stefano Stabellini > --- > This is a bug fix for Xen 4.4. Without this patch, it's impossible to > use Linux 3.14 (and higher) as guest with the event fifo driver. > --- > xen/arch/arm/mm.c | 10 +++++++--- > 1 file changed, 7 insertions(+), 3 deletions(-) > > diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c > index 127cce0..bdca68a 100644 > --- a/xen/arch/arm/mm.c > +++ b/xen/arch/arm/mm.c > @@ -325,11 +325,15 @@ void unmap_domain_page(const void *va) > local_irq_restore(flags); > } > > -unsigned long domain_page_map_to_mfn(const void *va) > +unsigned long domain_page_map_to_mfn(const void *ptr) > { > + unsigned long va = (unsigned long)ptr; > lpae_t *map = this_cpu(xen_dommap); > - int slot = ((unsigned long) va - DOMHEAP_VIRT_START) >> SECOND_SHIFT; > - unsigned long offset = ((unsigned long)va>>THIRD_SHIFT) & LPAE_ENTRY_MASK; > + int slot = (va - DOMHEAP_VIRT_START) >> SECOND_SHIFT; > + unsigned long offset = (va>>THIRD_SHIFT) & LPAE_ENTRY_MASK; > + > + if ( va >= VMAP_VIRT_START && va < VMAP_VIRT_END ) > + return virt_to_mfn(va); > > ASSERT(slot >= 0 && slot < DOMHEAP_ENTRIES); > ASSERT(map[slot].pt.avail != 0); > -- > 1.7.10.4 >