From patchwork Tue Dec 17 16:27:54 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 22603 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f69.google.com (mail-oa0-f69.google.com [209.85.219.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 4261323FC6 for ; Tue, 17 Dec 2013 16:28:36 +0000 (UTC) Received: by mail-oa0-f69.google.com with SMTP id h16sf23768002oag.4 for ; Tue, 17 Dec 2013 08:28:35 -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=A04+7cENgi3px+PGEYtS9WwRYbVcXCrIs7Jz+L9u9j8=; b=D/jxZhpx+cXy5Dbmbef+KUW4b7AxlvSNUjHhGDOKDlmgaFxbKgkaFhyoywvwo7qGsl MXCN0zWjYfiK0bLb25z9h8pA+9bBX6ODHccuYzLzLkWvWbYMX0pKSBvT6/SVLllKYxXT EAx00v1Oh+N3B1Zy0imi4Al/CBhtdr5u5BJfRhCUNNRslcpfvitr4cBcd8N5WRDeJCbY 8WShxbIhFbNMwalWPLlaydn7xcD83KGsMEEVhPxIpBHkYu3oo5nzTzkpYvGvMNUui3GW Dd5JubOSAXvDRftaPslnE7O6xlBQHdwU9hVo9+3Yw8JfsC2T0WoFRF/HHC2BzNTmRoHG r+xg== X-Gm-Message-State: ALoCoQkyjvzpUS1ZDey4qbagli6+HLMRVAyNAlrcrrGV3Qn7MaGdJnKfrTeLAwzjJS6O3/Ojq4lt X-Received: by 10.43.112.138 with SMTP id es10mr900601icc.33.1387297715813; Tue, 17 Dec 2013 08:28:35 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.4.65 with SMTP id i1ls2560045qei.72.gmail; Tue, 17 Dec 2013 08:28:35 -0800 (PST) X-Received: by 10.58.50.194 with SMTP id e2mr998389veo.54.1387297715722; Tue, 17 Dec 2013 08:28:35 -0800 (PST) Received: from mail-vc0-f178.google.com (mail-vc0-f178.google.com [209.85.220.178]) by mx.google.com with ESMTPS id xw5si5052003vec.8.2013.12.17.08.28.35 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 17 Dec 2013 08:28:35 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.178 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.178; Received: by mail-vc0-f178.google.com with SMTP id lh4so4375252vcb.9 for ; Tue, 17 Dec 2013 08:28:35 -0800 (PST) X-Received: by 10.220.97.69 with SMTP id k5mr4647974vcn.45.1387297715649; Tue, 17 Dec 2013 08:28:35 -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 u4csp79581vcz; Tue, 17 Dec 2013 08:28:35 -0800 (PST) X-Received: by 10.14.182.199 with SMTP id o47mr23861565eem.7.1387297714050; Tue, 17 Dec 2013 08:28:34 -0800 (PST) Received: from mail-ea0-f174.google.com (mail-ea0-f174.google.com [209.85.215.174]) by mx.google.com with ESMTPS id s42si5149070eew.77.2013.12.17.08.28.33 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 17 Dec 2013 08:28:34 -0800 (PST) Received-SPF: neutral (google.com: 209.85.215.174 is neither permitted nor denied by best guess record for domain of julien.grall@linaro.org) client-ip=209.85.215.174; Received: by mail-ea0-f174.google.com with SMTP id b10so2998345eae.33 for ; Tue, 17 Dec 2013 08:28:33 -0800 (PST) X-Received: by 10.15.54.72 with SMTP id s48mr23662299eew.3.1387297713621; Tue, 17 Dec 2013 08:28:33 -0800 (PST) Received: from belegaer.uk.xensource.com. ([185.25.64.249]) by mx.google.com with ESMTPSA id e3sm54411471eeg.11.2013.12.17.08.28.29 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 17 Dec 2013 08:28:30 -0800 (PST) From: Julien Grall To: xen-devel@lists.xenproject.org Cc: patches@linaro.org, ian.campbell@citrix.com, ian.jackson@eu.citrix.com, Julien Grall Subject: [PATCH v6 06/10] xen/arm: Retrieve p2m type in get_page_from_gfn Date: Tue, 17 Dec 2013 16:27:54 +0000 Message-Id: <1387297678-17762-7-git-send-email-julien.grall@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1387297678-17762-1-git-send-email-julien.grall@linaro.org> References: <1387297678-17762-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.220.178 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) )