From patchwork Tue Dec 10 14:18:18 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 22217 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ve0-f200.google.com (mail-ve0-f200.google.com [209.85.128.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 8B88D23908 for ; Tue, 10 Dec 2013 14:18:45 +0000 (UTC) Received: by mail-ve0-f200.google.com with SMTP id jw12sf10960692veb.3 for ; Tue, 10 Dec 2013 06:18:45 -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:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=Fnq5W1x5ZY65MzyPADKNgUtI1jGqH4hbszATziY+ddY=; b=EHAsgIxT1gz6vepSHhpiliO+Bkod892CQKrXMUdACy5IQCIRV93HOvSxRLbfO5bohU iwritD1En4Tx+Y196Tg1u9qJwma39kCHW1eNaw2oVnWVZ1yrzQYsG8YZHNNeOKZbDby8 uaP8xZhh3hk/vD3HgqQAVICrdLkmwwfhCclD0S9PoAAQ5OHHGSrNPIR2VJngzSQ2gA5f t2a9LkXNkJATVz54VPAXOHcKPIWbueI465H03SYTAwxEls0VNdn7+OX05aXVL5CQYLFO tE7NSNd1ZT7xDkmQ+Bsw7QMQsAAcJmW75fqgPmYqQVlbamr/SOFVLXN49w4eT1zdacF1 7PTQ== X-Gm-Message-State: ALoCoQmYvRDD/djFHM3d/lzKabGUy4sdz/zsOx7BIJEyviUd2kQUvsOm6ruCHEEcrnbc61zURoLG X-Received: by 10.236.133.82 with SMTP id p58mr12630039yhi.37.1386685125395; Tue, 10 Dec 2013 06:18:45 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.37.163 with SMTP id z3ls2620580qej.1.gmail; Tue, 10 Dec 2013 06:18:45 -0800 (PST) X-Received: by 10.220.199.5 with SMTP id eq5mr14162584vcb.16.1386685125292; Tue, 10 Dec 2013 06:18:45 -0800 (PST) Received: from mail-vb0-f47.google.com (mail-vb0-f47.google.com [209.85.212.47]) by mx.google.com with ESMTPS id td8si5170041vdc.79.2013.12.10.06.18.45 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 10 Dec 2013 06:18:45 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.47 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.47; Received: by mail-vb0-f47.google.com with SMTP id q12so566092vbe.6 for ; Tue, 10 Dec 2013 06:18:45 -0800 (PST) X-Received: by 10.58.100.244 with SMTP id fb20mr13494183veb.6.1386685125214; Tue, 10 Dec 2013 06:18:45 -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 u4csp191427vcz; Tue, 10 Dec 2013 06:18:44 -0800 (PST) X-Received: by 10.195.13.45 with SMTP id ev13mr21185152wjd.20.1386685124385; Tue, 10 Dec 2013 06:18:44 -0800 (PST) Received: from mail-we0-f172.google.com (mail-we0-f172.google.com [74.125.82.172]) by mx.google.com with ESMTPS id e10si6827912wjb.3.2013.12.10.06.18.44 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 10 Dec 2013 06:18:44 -0800 (PST) Received-SPF: neutral (google.com: 74.125.82.172 is neither permitted nor denied by best guess record for domain of julien.grall@linaro.org) client-ip=74.125.82.172; Received: by mail-we0-f172.google.com with SMTP id w62so5049077wes.31 for ; Tue, 10 Dec 2013 06:18:44 -0800 (PST) X-Received: by 10.194.122.131 with SMTP id ls3mr21633374wjb.0.1386685123953; Tue, 10 Dec 2013 06:18:43 -0800 (PST) Received: from belegaer.uk.xensource.com. ([185.25.64.249]) by mx.google.com with ESMTPSA id nb16sm5556779wic.0.2013.12.10.06.18.41 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 10 Dec 2013 06:18:42 -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 Subject: [PATCH v3 06/10] xen/arm: Retrieve p2m type in get_page_from_gfn Date: Tue, 10 Dec 2013 14:18:18 +0000 Message-Id: <1386685102-563-7-git-send-email-julien.grall@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1386685102-563-1-git-send-email-julien.grall@linaro.org> References: <1386685102-563-1-git-send-email-julien.grall@linaro.org> 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.212.47 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: , Signed-off-by: Julien Grall --- Changes in v3: - Return NULL when p2m type is invalid or mmio Changes in v2: - Use p2m_lookup as p2m_get_entry was removed --- xen/include/asm-arm/p2m.h | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/xen/include/asm-arm/p2m.h b/xen/include/asm-arm/p2m.h index 597e90a..52b33ce 100644 --- a/xen/include/asm-arm/p2m.h +++ b/xen/include/asm-arm/p2m.h @@ -109,12 +109,17 @@ static inline struct page_info *get_page_from_gfn( struct domain *d, unsigned long gfn, p2m_type_t *t, p2m_query_t q) { struct page_info *page; - unsigned long mfn = gmfn_to_mfn(d, gfn); + p2m_type_t p2mt; + paddr_t maddr = p2m_lookup(d, pfn_to_paddr(gfn), &p2mt); + unsigned long mfn = maddr >> PAGE_SHIFT; - if ( t ) - *t = p2m_invalid; + if (t) + *t = p2mt; - if (!mfn_valid(mfn)) + if ( p2mt == p2m_invalid || p2mt == p2m_mmio_direct ) + return NULL; + + if ( !mfn_valid(mfn) ) return NULL; page = mfn_to_page(mfn); if ( !get_page(page, d) )