From patchwork Thu Sep 15 11:28:29 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 9333207 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 018DC6077F for ; Thu, 15 Sep 2016 11:31:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E4AB0295C6 for ; Thu, 15 Sep 2016 11:31:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D91CB295D5; Thu, 15 Sep 2016 11:31:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 58584295C6 for ; Thu, 15 Sep 2016 11:31:02 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bkUqp-0004oe-5G; Thu, 15 Sep 2016 11:29:07 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bkUqo-0004ld-6G for xen-devel@lists.xen.org; Thu, 15 Sep 2016 11:29:06 +0000 Received: from [85.158.143.35] by server-9.bemta-6.messagelabs.com id 3F/D0-28857-1068AD75; Thu, 15 Sep 2016 11:29:05 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrOLMWRWlGSWpSXmKPExsVysyfVTZeh7Va 4wYkmXYslHxezODB6HN39mymAMYo1My8pvyKBNePk8ROsBf1CFf1tJxgbGP/ydjFycQgJbGKU WN7xlw3COc0ocWhlO3sXIycHm4CmxJ3Pn5hAbBEBaYlrny8zghQxC7QzSqzt72UGSQgLpErse zSdFcRmEVCV+Dh9HVgDr4CrxM0pf8HiEgJyEiePTQayOTg4geJLnouChIUEXCSOndjJNoGRew EjwypGjeLUorLUIl1DM72kosz0jJLcxMwcXUMDM73c1OLixPTUnMSkYr3k/NxNjEAPMwDBDsb 7GwMOMUpyMCmJ8rql3QoX4kvKT6nMSCzOiC8qzUktPsQow8GhJMFr1gqUEyxKTU+tSMvMAYYa TFqCg0dJhPdHC1Cat7ggMbc4Mx0idYpRUUqcdx9IQgAkkVGaB9cGC+9LjLJSwryMQIcI8RSkF uVmlqDKv2IU52BUEuZlBdnOk5lXAjf9FdBiJqDFW9ZcB1lckoiQkmpgLLlw5uUJnoAN6V08u1 6fkI0VqLVXqPlx+v3iS6IaDd3nmd0U1H+WWC/6b/kgqvL6yfMSR1nS3wff9fu3yrRdWOXlb72 EotnHjzHu0zgY13bS0eXHg+3POLNnnnw6VcVI2lD25dTXi2bsDRX7eFFiS0mJ9cnTASFZ1+ee isrj3r/5pe50T7O3+UosxRmJhlrMRcWJAOzncoVqAgAA X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-14.tower-21.messagelabs.com!1473938944!28049013!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.84; banners=-,-,- X-VirusChecked: Checked Received: (qmail 26503 invoked from network); 15 Sep 2016 11:29:04 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-14.tower-21.messagelabs.com with SMTP; 15 Sep 2016 11:29:04 -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 0BD87804; Thu, 15 Sep 2016 04:29:04 -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 09F9E3F251; Thu, 15 Sep 2016 04:29:02 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Thu, 15 Sep 2016 12:28:29 +0100 Message-Id: <1473938919-31976-14-git-send-email-julien.grall@arm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1473938919-31976-1-git-send-email-julien.grall@arm.com> References: <1473938919-31976-1-git-send-email-julien.grall@arm.com> Cc: proskurin@sec.in.tum.de, Julien Grall , sstabellini@kernel.org, steve.capper@arm.com, wei.chen@linaro.org Subject: [Xen-devel] [for-4.8][PATCH v2 13/23] 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" X-Virus-Scanned: ClamAV using ClamSMTP __p2m_lookup is just a wrapper to p2m_get_entry. Signed-off-by: Julien Grall Acked-by: Stefano Stabellini --- It might be possible to rework the memaccess code to take advantage of all the parameters. I will defer this to the memaccess folks. Changes in v2: - Add Stefano's acked-by --- 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 6e56b97..ddee258 100644 --- a/xen/arch/arm/p2m.c +++ b/xen/arch/arm/p2m.c @@ -402,24 +402,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; @@ -691,7 +680,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; @@ -1611,6 +1600,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 ) @@ -1671,7 +1661,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;