From patchwork Thu Jul 28 14:51:30 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 9251315 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 006806077C for ; Thu, 28 Jul 2016 14:54:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E6511279E0 for ; Thu, 28 Jul 2016 14:54:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DAF8E27D0C; Thu, 28 Jul 2016 14:54:26 +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 8AC79279E0 for ; Thu, 28 Jul 2016 14:54:26 +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 1bSmfM-0002u0-Mr; Thu, 28 Jul 2016 14:52:04 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bSmfL-0002nx-AW for xen-devel@lists.xen.org; Thu, 28 Jul 2016 14:52:03 +0000 Received: from [85.158.139.211] by server-4.bemta-5.messagelabs.com id 76/D1-12285-31C1A975; Thu, 28 Jul 2016 14:52:03 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrKLMWRWlGSWpSXmKPExsVysyfVTVdIZla 4wcbbWhZLPi5mcWD0OLr7N1MAYxRrZl5SfkUCa8av3rnsBZMEKlb+yG9gvMrdxcjFISSwiVHi 353FrBDOaUaJ/VOamLsYOTnYBDQl7nz+xARiiwhIS1z7fJkRpIhZoJ1RYm1/L1iRsIClxOQXe 9hAbBYBVYm9u1aBNfAKOEs8O93EAmJLCMhJnDw2GWgDBwengIvE624hkLAQUMn0mUsZJzByL2 BkWMWoXpxaVJZapGusl1SUmZ5RkpuYmaNraGCql5taXJyYnpqTmFSsl5yfu4kR6F0GINjBuPe f0yFGSQ4mJVHesNCZ4UJ8SfkplRmJxRnxRaU5qcWHGGU4OJQkeG9JzQoXEixKTU+tSMvMAYYZ TFqCg0dJhPchSJq3uCAxtzgzHSJ1ilFRSpy3BiQhAJLIKM2Da4OF9iVGWSlhXkagQ4R4ClKLc jNLUOVfMYpzMCoJ8+4AmcKTmVcCN/0V0GImoMXFsTNAFpckIqSkGhiTmvXyq8uvHuIRuvig9+ v61cHckWVBLaJqaQLfbsTmPa2/uGr9+6rewLenjgZz79hxPHXyXQH9uxtn10XvyFFZ8uL9i4q LUocPTY9m2Kmj7Crlcr09bZPKnqLVO+uNuE/0Fon18h1tXNr/bLvHccXHDo80+jf6/02Lyd9l 8nCDgurziTGzg2yVWIozEg21mIuKEwHGtFQWaAIAAA== X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-4.tower-206.messagelabs.com!1469717522!51893949!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 21243 invoked from network); 28 Jul 2016 14:52:02 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-4.tower-206.messagelabs.com with SMTP; 28 Jul 2016 14:52:02 -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 19A3EBB1; Thu, 28 Jul 2016 07:53:19 -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 D9EBF3F21A; Thu, 28 Jul 2016 07:52:00 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Thu, 28 Jul 2016 15:51:30 +0100 Message-Id: <1469717505-8026-8-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: proskurin@sec.in.tum.de, Julien Grall , sstabellini@kernel.org, steve.capper@arm.com, wei.chen@linaro.org Subject: [Xen-devel] [RFC 07/22] xen/arm: p2m: Rework p2m_put_l3_page 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 Modify the prototype to directly pass the mfn and the type in parameters. This will be useful later when we do not have the entry in hand. Signed-off-by: Julien Grall Reviewed-by: Stefano Stabellini --- xen/arch/arm/p2m.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c index aecdd1e..6b29cf0 100644 --- a/xen/arch/arm/p2m.c +++ b/xen/arch/arm/p2m.c @@ -584,10 +584,8 @@ enum p2m_operation { * TODO: Handle superpages, for now we only take special references for leaf * pages (specifically foreign ones, which can't be super mapped today). */ -static void p2m_put_l3_page(const lpae_t pte) +static void p2m_put_l3_page(mfn_t mfn, p2m_type_t type) { - ASSERT(p2m_valid(pte)); - /* * TODO: Handle other p2m types * @@ -595,12 +593,10 @@ static void p2m_put_l3_page(const lpae_t pte) * flush the TLBs if the page is reallocated before the end of * this loop. */ - if ( p2m_is_foreign(pte.p2m.type) ) + if ( p2m_is_foreign(type) ) { - unsigned long mfn = pte.p2m.base; - - ASSERT(mfn_valid(mfn)); - put_page(mfn_to_page(mfn)); + ASSERT(mfn_valid(mfn_x(mfn))); + put_page(mfn_to_page(mfn_x(mfn))); } } @@ -734,7 +730,8 @@ static int apply_one_level(struct domain *d, */ BUG_ON(level < 3 && p2m_table(orig_pte)); if ( level == 3 ) - p2m_put_l3_page(orig_pte); + p2m_put_l3_page(_mfn(orig_pte.p2m.base), + orig_pte.p2m.type); } else /* New mapping */ p2m->stats.mappings[level]++; @@ -834,7 +831,7 @@ static int apply_one_level(struct domain *d, p2m->stats.mappings[level]--; if ( level == 3 ) - p2m_put_l3_page(orig_pte); + p2m_put_l3_page(_mfn(orig_pte.p2m.base), orig_pte.p2m.type); /* * This is still a single pte write, no matter the level, so no need to