From patchwork Thu Sep 15 11:28:32 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 76296 Delivered-To: patch@linaro.org Received: by 10.140.106.72 with SMTP id d66csp2389741qgf; Thu, 15 Sep 2016 04:36:23 -0700 (PDT) X-Received: by 10.107.30.11 with SMTP id e11mr15468294ioe.57.1473939035688; Thu, 15 Sep 2016 04:30:35 -0700 (PDT) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id n4si5458594ioo.158.2016.09.15.04.30.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Sep 2016 04:30:35 -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 1bkUqt-0004wC-0b; Thu, 15 Sep 2016 11:29:11 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bkUqs-0004sm-1K for xen-devel@lists.xen.org; Thu, 15 Sep 2016 11:29:10 +0000 Received: from [85.158.137.68] by server-6.bemta-3.messagelabs.com id 6D/43-28813-5068AD75; Thu, 15 Sep 2016 11:29:09 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrILMWRWlGSWpSXmKPExsVysyfVTZel7Va 4wYVZShZLPi5mcWD0OLr7N1MAYxRrZl5SfkUCa8ahyVMYC26xVRxY8pu1gfEQaxcjF4eQwCZG ic8H/0M5pxkl+jYtZuxi5ORgE9CUuPP5ExOILSIgLXHt82VGkCJmgXZGibX9vcwgCWGBdIlLM +6wg9gsAqoSJz+vAIpzcPAKuEpsOi4DEpYQkJM4eWwyK0iYEyi85LkoSFhIwEXi2ImdbBMYuR cwMqxiVC9OLSpLLdK10EsqykzPKMlNzMzRNTQw1stNLS5OTE/NSUwq1kvOz93ECPQuAxDsYLz Q7nyIUZKDSUmU1y3tVrgQX1J+SmVGYnFGfFFpTmrxIUYZDg4lCd59LUA5waLU9NSKtMwcYJjB pCU4eJREeH+ApHmLCxJzizPTIVKnGHU5Fvy4vZZJiCUvPy9VSpzXA6RIAKQoozQPbgQs5C8xy koJ8zICHSXEU5BalJtZgir/ilGcg1FJmLcLZApPZl4J3KZXQEcwAR2xZc11kCNKEhFSUg2MJm v09revftBV1jDbXvTLy42uz9euXdF55c4itawFJxRYVx2Zs0tcY3vUAyV36ZX199mP8Normv5 Zt3jlUtYSrZgm9T6lSX7SFoZeOksCC4MOCf6vz1z0x9Vix4KGVSYptY8Ur275lCEibjd/943j spZlcxP+Wuw+l3c4bc769pcLz3UmqfNpK7EUZyQaajEXFScCALeypzR0AgAA X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-3.tower-31.messagelabs.com!1473938948!60893506!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 16128 invoked from network); 15 Sep 2016 11:29:08 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-3.tower-31.messagelabs.com with SMTP; 15 Sep 2016 11:29:08 -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 C12AA80D; Thu, 15 Sep 2016 04:29:07 -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 C1DC63F251; Thu, 15 Sep 2016 04:29:06 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Thu, 15 Sep 2016 12:28:32 +0100 Message-Id: <1473938919-31976-17-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 16/23] xen/arm: p2m: Introduce a helper to check if an entry is a superpage 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" Use the level and the entry to know whether an entry is a superpage. A superpage can only happen below level 3. Signed-off-by: Julien Grall Reviewed-by: Stefano Stabellini --- Changes in v2: - Use bool instead of bool_t - Add Stefano's reviewed-by --- xen/arch/arm/p2m.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c index 9f0f896..3ca2e90 100644 --- a/xen/arch/arm/p2m.c +++ b/xen/arch/arm/p2m.c @@ -57,6 +57,11 @@ static inline bool_t p2m_mapping(lpae_t pte) return p2m_valid(pte) && !pte.p2m.table; } +static inline bool p2m_is_superpage(lpae_t pte, unsigned int level) +{ + return (level < 3) && p2m_mapping(pte); +} + static inline void p2m_write_lock(struct p2m_domain *p2m) { write_lock(&p2m->lock);