From patchwork Mon Dec 16 17:37:28 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 22535 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pa0-f70.google.com (mail-pa0-f70.google.com [209.85.220.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 9D91223FC6 for ; Mon, 16 Dec 2013 17:37:48 +0000 (UTC) Received: by mail-pa0-f70.google.com with SMTP id fa1sf11218254pad.9 for ; Mon, 16 Dec 2013 09:37:47 -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=sdwuglbb5y1wufO6lvFviH4E8pCXkI4JmBoHEUyUSRQ=; b=N/HfwzJKKnXAN2PV3VHhre+qVjE+3bZOR/ckXb0hcv/LuYh/ehCheLE93yOBUm1/5K oQKBKQH+cZrUG4QqBCbgGgoE7/Fj3lgyGs9cSPH9zq0co85jCUsL8/7t3xgMXOk5RhbJ JidRaA7q+xBBbAfRu7clVs8iDXd7GZ/hh8AHIK+XrlFcjpUOBNA94wm2HxrH0iDdXIr8 G0B3LRar6o5eLiEG0c5HzbHtvK55rNygNB4xgTvuxFnyO0GQXZWP33iPXIZNgDDnR9pg iEYdOJ+m/IhukiY4/salGRp9jD38QW2HPyWGSR5zQ90BUs2/hWEebLqcSR0bIow4yc8+ 7YiQ== X-Gm-Message-State: ALoCoQkSu5DPIKgD1Kr0z8olA6uCmbjsIfTLdvfdt3/Z5rR7vCdiKrXyc7LJ1pOik5ce4uiQFFaM X-Received: by 10.66.144.41 with SMTP id sj9mr10767458pab.23.1387215467755; Mon, 16 Dec 2013 09:37:47 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.82.49 with SMTP id f17ls2236115qey.54.gmail; Mon, 16 Dec 2013 09:37:47 -0800 (PST) X-Received: by 10.220.169.203 with SMTP id a11mr4377998vcz.26.1387215467630; Mon, 16 Dec 2013 09:37:47 -0800 (PST) Received: from mail-ve0-f179.google.com (mail-ve0-f179.google.com [209.85.128.179]) by mx.google.com with ESMTPS id o3si4167119ves.10.2013.12.16.09.37.47 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 16 Dec 2013 09:37:47 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.179 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.179; Received: by mail-ve0-f179.google.com with SMTP id jw12so3525033veb.38 for ; Mon, 16 Dec 2013 09:37:47 -0800 (PST) X-Received: by 10.52.162.168 with SMTP id yb8mr7426069vdb.8.1387215467538; Mon, 16 Dec 2013 09:37:47 -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 u4csp6122vcz; Mon, 16 Dec 2013 09:37:47 -0800 (PST) X-Received: by 10.14.101.4 with SMTP id a4mr18136748eeg.28.1387215466538; Mon, 16 Dec 2013 09:37:46 -0800 (PST) Received: from mail-ee0-f42.google.com (mail-ee0-f42.google.com [74.125.83.42]) by mx.google.com with ESMTPS id p46si1644842eem.126.2013.12.16.09.37.46 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 16 Dec 2013 09:37:46 -0800 (PST) Received-SPF: neutral (google.com: 74.125.83.42 is neither permitted nor denied by best guess record for domain of julien.grall@linaro.org) client-ip=74.125.83.42; Received: by mail-ee0-f42.google.com with SMTP id e53so2386702eek.29 for ; Mon, 16 Dec 2013 09:37:46 -0800 (PST) X-Received: by 10.14.182.199 with SMTP id o47mr18082745eem.7.1387215466008; Mon, 16 Dec 2013 09:37:46 -0800 (PST) Received: from belegaer.uk.xensource.com. ([185.25.64.249]) by mx.google.com with ESMTPSA id e3sm44674680eeg.11.2013.12.16.09.37.44 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 16 Dec 2013 09:37:45 -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 v5 06/10] xen/arm: Retrieve p2m type in get_page_from_gfn Date: Mon, 16 Dec 2013 17:37:28 +0000 Message-Id: <1387215452-10951-7-git-send-email-julien.grall@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1387215452-10951-1-git-send-email-julien.grall@linaro.org> References: <1387215452-10951-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.128.179 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 Acked-by: Ian Campbell --- 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 | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/xen/include/asm-arm/p2m.h b/xen/include/asm-arm/p2m.h index 9d0d1e7..0eb07a8 100644 --- a/xen/include/asm-arm/p2m.h +++ b/xen/include/asm-arm/p2m.h @@ -109,11 +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; - ASSERT(t == NULL); + 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) )