From patchwork Thu Jul 28 14:51:36 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 72992 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp895101qga; Thu, 28 Jul 2016 07:55:20 -0700 (PDT) X-Received: by 10.107.175.132 with SMTP id p4mr38438028ioo.23.1469717718143; Thu, 28 Jul 2016 07:55:18 -0700 (PDT) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id w66si33636075ith.65.2016.07.28.07.55.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 Jul 2016 07:55:18 -0700 (PDT) Received-SPF: neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) client-ip=192.237.175.120; Authentication-Results: mx.google.com; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bSmfj-0003YV-LN; Thu, 28 Jul 2016 14:52:27 +0000 Received: from mail6.bemta6.messagelabs.com ([85.158.143.247]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bSmfj-0003Wk-5s for xen-devel@lists.xen.org; Thu, 28 Jul 2016 14:52:27 +0000 Received: from [85.158.143.35] by server-4.bemta-6.messagelabs.com id A5/DF-07858-A2C1A975; Thu, 28 Jul 2016 14:52:26 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrMLMWRWlGSWpSXmKPExsVysyfVTVdLZla 4wTVWiyUfF7M4MHoc3f2bKYAxijUzLym/IoE140HjRuaCf4IVa/9xNDD+5u1i5OIQEtjEKHG9 /xkbhHOaUWLzvlssXYycHGwCmhJ3Pn9iArFFBKQlrn2+zAhSxCxwl1Fi5rd/7F2MHBzCAuES/ 9bpgdSwCKhKnDrQwAxi8wq4SNx5cAWsV0JATuLkscmsIOWcQPHX3UIgYSEBZ4npM5cyTmDkXs DIsIpRvTi1qCy1SNdcL6koMz2jJDcxM0fX0MBMLze1uDgxPTUnMalYLzk/dxMj0LMMQLCDceZ l/0OMkhxMSqK8YaEzw4X4kvJTKjMSizPii0pzUosPMcpwcChJ8PpLzwoXEixKTU+tSMvMAYYY TFqCg0dJhFcOJM1bXJCYW5yZDpE6xagoJc7LC5IQAElklObBtcHC+hKjrJQwLyPQIUI8BalFu ZklqPKvGMU5GJWEeZlBpvBk5pXATX8FtJgJaHFx7AyQxSWJCCmpBsbKNTZKRYLHv/O+f3T1xk 8Gpcbbsj6LX+76NL8+NX7B5j3+ii4MMmlRBx24SjydoiK+ft/LKc3EqNt9go+rjW3DqUXPw++ LeTYf+ehpKrie8fUEozNB5T/fONtOn6t5ZNvm9T0LDNlbhByT/6bNdjXLyH6SeFOqS7ywRC7I aNrDqbE2c6KOciuxFGckGmoxFxUnAgCwHPJYZgIAAA== X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-7.tower-21.messagelabs.com!1469717545!26167611!1 X-Originating-IP: [217.140.101.70] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.77; banners=-,-,- X-VirusChecked: Checked Received: (qmail 7754 invoked from network); 28 Jul 2016 14:52:25 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-7.tower-21.messagelabs.com with SMTP; 28 Jul 2016 14:52:25 -0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 6410FBF1; Thu, 28 Jul 2016 07:53:27 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.218.32]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id DB1503F21A; Thu, 28 Jul 2016 07:52:08 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Thu, 28 Jul 2016 15:51:36 +0100 Message-Id: <1469717505-8026-14-git-send-email-julien.grall@arm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1469717505-8026-1-git-send-email-julien.grall@arm.com> References: <1469717505-8026-1-git-send-email-julien.grall@arm.com> Cc: sstabellini@kernel.org, Razvan Cojocaru , steve.capper@arm.com, proskurin@sec.in.tum.de, Julien Grall , Tamas K Lengyel , wei.chen@linaro.org Subject: [Xen-devel] [RFC 13/22] xen/arm: p2m: Replace all usage of __p2m_lookup with p2m_get_entry X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" __p2m_lookup is just a wrapper to p2m_get_entry. Signed-off-by: Julien Grall Cc: Razvan Cojocaru Cc: Tamas K Lengyel --- It might be possible to rework the memaccess code to take advantage of all the parameters. I will defer this to the memaccess folks. --- xen/arch/arm/p2m.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c index 8676b9d..9a9c85c 100644 --- a/xen/arch/arm/p2m.c +++ b/xen/arch/arm/p2m.c @@ -398,24 +398,13 @@ out: return mfn; } -/* - * Lookup the MFN corresponding to a domain's GFN. - * - * There are no processor functions to do a stage 2 only lookup therefore we - * do a a software walk. - */ -static mfn_t __p2m_lookup(struct domain *d, gfn_t gfn, p2m_type_t *t) -{ - return p2m_get_entry(&d->arch.p2m, gfn, t, NULL, NULL); -} - mfn_t p2m_lookup(struct domain *d, gfn_t gfn, p2m_type_t *t) { mfn_t ret; struct p2m_domain *p2m = &d->arch.p2m; p2m_read_lock(p2m); - ret = __p2m_lookup(d, gfn, t); + ret = p2m_get_entry(p2m, gfn, t, NULL, NULL); p2m_read_unlock(p2m); return ret; @@ -679,7 +668,7 @@ static int __p2m_get_mem_access(struct domain *d, gfn_t gfn, * No setting was found in the Radix tree. Check if the * entry exists in the page-tables. */ - mfn_t mfn = __p2m_lookup(d, gfn, NULL); + mfn_t mfn = p2m_get_entry(p2m, gfn, NULL, NULL, NULL); if ( mfn_eq(mfn, INVALID_MFN) ) return -ESRCH; @@ -1595,6 +1584,7 @@ p2m_mem_access_check_and_get_page(vaddr_t gva, unsigned long flag) xenmem_access_t xma; p2m_type_t t; struct page_info *page = NULL; + struct p2m_domain *p2m = ¤t->domain->arch.p2m; rc = gva_to_ipa(gva, &ipa, flag); if ( rc < 0 ) @@ -1655,7 +1645,7 @@ p2m_mem_access_check_and_get_page(vaddr_t gva, unsigned long flag) * We had a mem_access permission limiting the access, but the page type * could also be limiting, so we need to check that as well. */ - mfn = __p2m_lookup(current->domain, gfn, &t); + mfn = p2m_get_entry(p2m, gfn, &t, NULL, NULL); if ( mfn_eq(mfn, INVALID_MFN) ) goto err;