From patchwork Thu Jul 28 14:20:20 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 72966 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp880767qga; Thu, 28 Jul 2016 07:25:06 -0700 (PDT) X-Received: by 10.36.14.68 with SMTP id 65mr2779293ite.99.1469715906787; Thu, 28 Jul 2016 07:25:06 -0700 (PDT) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id h132si13320024ita.44.2016.07.28.07.25.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 Jul 2016 07:25:06 -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 1bSmB7-0007UG-Ic; Thu, 28 Jul 2016 14:20:49 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bSmB6-0007SU-J9 for xen-devel@lists.xen.org; Thu, 28 Jul 2016 14:20:48 +0000 Received: from [85.158.137.68] by server-12.bemta-3.messagelabs.com id EB/34-09160-FB41A975; Thu, 28 Jul 2016 14:20:47 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrOLMWRWlGSWpSXmKPExsVysyfVTXe/yKx wgyn7+C2WfFzM4sDocXT3b6YAxijWzLyk/IoE1ozuuxEFr6Qqfvc+Z21gbBbqYuTiEBLYxCix YMMSJgjnNKPEv70v2LsYOTnYBDQl7nz+xARiiwhIS1z7fJkRpIhZoJ1RYm1/LzNIQlggXeJP/ xY2EJtFQFVi08vdjCA2r4CLxK6Vs1lAbAkBOYmTxyazgticQPF7bd/BbCEBZ4nTd7ezT2DkXs DIsIpRozi1qCy1SNfQVC+pKDM9oyQ3MTNH19DAWC83tbg4MT01JzGpWC85P3cTI9DDDECwg3H Nds9DjJIcTEqivGGhM8OF+JLyUyozEosz4otKc1KLDzHKcHAoSfC6Cc8KFxIsSk1PrUjLzAGG GkxagoNHSYQ3EiTNW1yQmFucmQ6ROsWoKCXOmwuSEABJZJTmwbXBwvsSo6yUMC8j0CFCPAWpR bmZJajyrxjFORiVhHk3gkzhycwrgZv+CmgxE9Di4tgZIItLEhFSUg2MvFPFAycs/LMxojuc/2 HAR3W9LUr/JI+tefSjTHYW2+Y4B/ErzDobvqvuCMlcMevUHLnXFs0XT/Df+pTPFHpVlCv+4lb nGdp3hbaEbe9N/BwSwH5QSObzpjYrdTYzrg3nOh/LeSycwaD1UHrZ2oV13oouHvZTGu7W/bny hNd3cqzkYS7uab1nlViKMxINtZiLihMBkwrZD2oCAAA= X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-11.tower-31.messagelabs.com!1469715635!26646407!9 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 46138 invoked from network); 28 Jul 2016 14:20:46 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-11.tower-31.messagelabs.com with SMTP; 28 Jul 2016 14:20:46 -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 BCB18BF3; Thu, 28 Jul 2016 07:22:03 -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 8CB303F21A; Thu, 28 Jul 2016 07:20:45 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Thu, 28 Jul 2016 15:20:20 +0100 Message-Id: <1469715620-4670-16-git-send-email-julien.grall@arm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1469715620-4670-1-git-send-email-julien.grall@arm.com> References: <1469715620-4670-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] [PATCH v2 15/15] xen/arm: p2m: Pass the p2m in parameter rather the domain when it is possible 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" Some p2m functions do not care about the domain except to get the associate p2m. Signed-off-by: Julien Grall Reviewed-by: Stefano Stabellini --- Changes in v2: - Add Stefano's reviewed-by --- xen/arch/arm/p2m.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c index 97a3a2b..40a0b80 100644 --- a/xen/arch/arm/p2m.c +++ b/xen/arch/arm/p2m.c @@ -415,10 +415,9 @@ static inline void p2m_remove_pte(lpae_t *p, bool_t flush_cache) * * level_shift is the number of bits at the level we want to create. */ -static int p2m_create_table(struct domain *d, lpae_t *entry, +static int p2m_create_table(struct p2m_domain *p2m, lpae_t *entry, int level_shift, bool_t flush_cache) { - struct p2m_domain *p2m = &d->arch.p2m; struct page_info *page; lpae_t *p; lpae_t pte; @@ -652,18 +651,17 @@ static const paddr_t level_masks[] = static const paddr_t level_shifts[] = { ZEROETH_SHIFT, FIRST_SHIFT, SECOND_SHIFT, THIRD_SHIFT }; -static int p2m_shatter_page(struct domain *d, +static int p2m_shatter_page(struct p2m_domain *p2m, lpae_t *entry, unsigned int level, bool_t flush_cache) { const paddr_t level_shift = level_shifts[level]; - int rc = p2m_create_table(d, entry, + int rc = p2m_create_table(p2m, entry, level_shift - PAGE_SHIFT, flush_cache); if ( !rc ) { - struct p2m_domain *p2m = &d->arch.p2m; p2m->stats.shattered[level]++; p2m->stats.mappings[level]--; p2m->stats.mappings[level+1] += LPAE_ENTRIES; @@ -756,7 +754,7 @@ static int apply_one_level(struct domain *d, /* Not present -> create table entry and descend */ if ( !p2m_valid(orig_pte) ) { - rc = p2m_create_table(d, entry, 0, flush_cache); + rc = p2m_create_table(p2m, entry, 0, flush_cache); if ( rc < 0 ) return rc; return P2M_ONE_DESCEND; @@ -766,7 +764,7 @@ static int apply_one_level(struct domain *d, if ( p2m_mapping(orig_pte) ) { *flush = true; - rc = p2m_shatter_page(d, entry, level, flush_cache); + rc = p2m_shatter_page(p2m, entry, level, flush_cache); if ( rc < 0 ) return rc; } /* else: an existing table mapping -> descend */ @@ -803,7 +801,7 @@ static int apply_one_level(struct domain *d, * and descend. */ *flush = true; - rc = p2m_shatter_page(d, entry, level, flush_cache); + rc = p2m_shatter_page(p2m, entry, level, flush_cache); if ( rc < 0 ) return rc; @@ -888,7 +886,7 @@ static int apply_one_level(struct domain *d, /* Shatter large pages as we descend */ if ( p2m_mapping(orig_pte) ) { - rc = p2m_shatter_page(d, entry, level, flush_cache); + rc = p2m_shatter_page(p2m, entry, level, flush_cache); if ( rc < 0 ) return rc; } /* else: an existing table mapping -> descend */