From patchwork Wed Feb 5 14:16:34 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 24174 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vb0-f70.google.com (mail-vb0-f70.google.com [209.85.212.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 123F4202B2 for ; Wed, 5 Feb 2014 14:16:44 +0000 (UTC) Received: by mail-vb0-f70.google.com with SMTP id w17sf816091vbj.5 for ; Wed, 05 Feb 2014 06:16:44 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=1/dedXnaGuXPd8DPfQltG4MMxsI70bEVHavzTXnY5Gw=; b=GI3Kgad0KVOPO849InRXAcplZ+Ma2W9qZ0RHfjS9MzWAB1hxrT+8xG+bDIZMdIEpWQ ei2vpLfgiv5gPUsGp1OQIpFTXVE2kSDNQ9eFFV7ru2VhVBo9MvUQT7Ufv7ampnLAYDyC WN/QhbX5vfI3XPKXKtYIRhulObfchL3QDqB+YmQaBjFdOAM0inoJioabAkAOE9/i0K4T P5InN1dHMMRa2VZhM3ufkWIxP0UY1NNF7v6wGWoPM49Z6oJd7KXTlLg65lUKf2JQCnDg kVidsbnREwkiXC+tx5bPzlVV/ZWwfK1dmgNNbC0xFIzdEu+NTWQo3DIcuiy3UIVxZOAb UqBQ== X-Gm-Message-State: ALoCoQnBJA9/h8XItbYokOob99YA13tsi0qOKwJi4E1PXmROzxbDw0UuTbBAnHQVFGV+jyNUkonw X-Received: by 10.58.47.99 with SMTP id c3mr2513419ven.41.1391609804110; Wed, 05 Feb 2014 06:16:44 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.22.106 with SMTP id 97ls183374qgm.29.gmail; Wed, 05 Feb 2014 06:16:44 -0800 (PST) X-Received: by 10.58.66.137 with SMTP id f9mr1196891vet.11.1391609804040; Wed, 05 Feb 2014 06:16:44 -0800 (PST) Received: from mail-vc0-f177.google.com (mail-vc0-f177.google.com [209.85.220.177]) by mx.google.com with ESMTPS id qi7si4544158veb.148.2014.02.05.06.16.44 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 05 Feb 2014 06:16:44 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.177 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.177; Received: by mail-vc0-f177.google.com with SMTP id if11so315313vcb.8 for ; Wed, 05 Feb 2014 06:16:44 -0800 (PST) X-Received: by 10.58.85.133 with SMTP id h5mr1246506vez.4.1391609803957; Wed, 05 Feb 2014 06:16:43 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp48412vcz; Wed, 5 Feb 2014 06:16:43 -0800 (PST) X-Received: by 10.194.92.7 with SMTP id ci7mr1541873wjb.58.1391609802840; Wed, 05 Feb 2014 06:16:42 -0800 (PST) Received: from mail-ea0-f182.google.com (mail-ea0-f182.google.com [209.85.215.182]) by mx.google.com with ESMTPS id 43si50055746eeh.115.2014.02.05.06.16.42 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 05 Feb 2014 06:16:42 -0800 (PST) Received-SPF: neutral (google.com: 209.85.215.182 is neither permitted nor denied by best guess record for domain of julien.grall@linaro.org) client-ip=209.85.215.182; Received: by mail-ea0-f182.google.com with SMTP id r15so258788ead.41 for ; Wed, 05 Feb 2014 06:16:41 -0800 (PST) X-Received: by 10.15.21.2 with SMTP id c2mr2177716eeu.77.1391609801903; Wed, 05 Feb 2014 06:16:41 -0800 (PST) Received: from belegaer.uk.xensource.com. ([185.25.64.249]) by mx.google.com with ESMTPSA id g1sm102062950eet.6.2014.02.05.06.16.40 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Feb 2014 06:16:41 -0800 (PST) From: Julien Grall To: xen-devel@lists.xenproject.org Cc: patches@linaro.org, ian.campbell@citrix.com, tim@xen.org, stefano.stabellini@citrix.com, Julien Grall , George Dunlap Subject: [PATCH] xen/arm: Correctly implement domain_page_map_to_mfn Date: Wed, 5 Feb 2014 14:16:34 +0000 Message-Id: <1391609794-505-1-git-send-email-julien.grall@linaro.org> X-Mailer: git-send-email 1.7.10.4 X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: julien.grall@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.177 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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 Acked-by: Stefano Stabellini Acked-by: Ian Campbell --- 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);