From patchwork Fri Jun 30 15:54:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 106734 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp2507546qge; Fri, 30 Jun 2017 08:57:11 -0700 (PDT) X-Received: by 10.107.15.93 with SMTP id x90mr17498388ioi.41.1498838231500; Fri, 30 Jun 2017 08:57:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1498838231; cv=none; d=google.com; s=arc-20160816; b=d9wDcd389atXTdruLm5FwEJphzNujyDi61f8tqBO1+aeyD6kjZYnRAMR5DC2SSYDmr OXuC9YtFsTeKLfYDJDME+3u8lKT4gVzKYxBRk/6pLyDT0hJezzZo9l47QjcIJ+9ZnjWg M6im7OrliLsig6sSG+csn+KSsCBB/bOiLItgdRIw0HLBV3Vryw336OkBQlhq4hmw51m0 v9LnezdcV3W4cCZMXJNtRIxRAcvy4+0Z6Xd480jSqqqIDACfsX1vlWglyW3pT7hDVVIK 8zhGxZXSgW62sCKRqFizHOcBSZsc4R273t6MkBVVQZgNUF0gd/WFIF25Qu86TR68LlCT r1ng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:cc:references:in-reply-to:message-id:date:to :from:arc-authentication-results; bh=CKjfP5QPcHmSBb6vHDYpL5yYn/lyeWakHRBU/SzAcC4=; b=a4ibTTTsaY4paAzX0pUDp5M9oWyAClTYvI1H7aB/HJPw9EZhTY5pnEnJzJ1BLEMN57 UYR8tsWYATxoS/2MUH82uHlbJgEeNodhS4ll3VdoltWGU70ehFGPIZeQmrDMxv0pBSO6 qmLUuguMDbqNLI9CzzZ0DN0BMZibv1sdXflRnBu06JtJqWpMLB3ltipZ4Gtl4OnbwbKr Q7iVhVElUa6cdlCFwJdQghUjL5q3tbx2Z7SxpUkb3k3tRM9bhp4HSDZKySWtCfeIkbJp dVKOcm9FIn/b7+j6RRTuvf5+wGnbb245mW8OvCZKHHimiuUy4YF87ZcTPDSFyVeWNcUp zaSw== ARC-Authentication-Results: i=1; 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 Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id z22si8830773iof.16.2017.06.30.08.57.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 30 Jun 2017 08:57:11 -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 1dQyFv-0000aC-14; Fri, 30 Jun 2017 15:54:51 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dQyFt-0000Wp-Vz for xen-devel@lists.xen.org; Fri, 30 Jun 2017 15:54:50 +0000 Received: from [85.158.137.68] by server-12.bemta-3.messagelabs.com id 3F/C7-01862-94476595; Fri, 30 Jun 2017 15:54:49 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrILMWRWlGSWpSXmKPExsVysyfVTdejJCz S4PgyI4slHxezODB6HN39mymAMYo1My8pvyKBNePe15csBdeEKg5vWsvWwLiLv4uRi0NIYDOj xObGiewQzmlGiY3Xu1m6GDk52AQ0Je58/sQEYosISEtc+3yZsYuRg4NZIEri/zROkLCwgKtEz +ONrCA2i4CqxNaJy9lBSngFrCT6poGFJQTkJXa1XQSzOYHCx/89AJsoJGAp8XrWVZYJjNwLGB lWMWoUpxaVpRbpGlnqJRVlpmeU5CZm5ugaGhjr5aYWFyemp+YkJhXrJefnbmIEereegYFxB2P TXr9DjJIcTEqivCuvhUYK8SXlp1RmJBZnxBeV5qQWH2KU4eBQkuCdVxwWKSRYlJqeWpGWmQMM M5i0BAePkgivbBBQmre4IDG3ODMdInWKUZfj1YT/35iEWPLy81KlxHlDQGYIgBRllObBjYCF/ CVGWSlhXkYGBgYhnoLUotzMElT5V4ziHIxKwrzOIFN4MvNK4Da9AjqCCegI4RkhIEeUJCKkpB oYOc59T8tS/dx1YJGUQIrsYoma+IrHS8Q/fUoqWHhLp5D9a0LZzg5JnZOi058KTbgttOzPzht JW4vDvXVf7lvAelzt/NTk26t+3r79dpoff/z3zmKtA7Hn6yWfbju+7/Lz0BmrHKeePiR/tyuh 41i0x4Plr46K6nVZPBDRPSh2rlPVP7t6I+OJECWW4oxEQy3mouJEAKLqQFp0AgAA X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-13.tower-31.messagelabs.com!1498838088!102756310!1 X-Originating-IP: [217.140.101.70] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.19; banners=-,-,- X-VirusChecked: Checked Received: (qmail 50232 invoked from network); 30 Jun 2017 15:54:48 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-13.tower-31.messagelabs.com with SMTP; 30 Jun 2017 15:54:48 -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 0C61F15BE; Fri, 30 Jun 2017 08:54:48 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.206.53]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 496733F41F; Fri, 30 Jun 2017 08:54:47 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Fri, 30 Jun 2017 16:54:27 +0100 Message-Id: <20170630155431.23824-13-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170630155431.23824-1-julien.grall@arm.com> References: <20170630155431.23824-1-julien.grall@arm.com> Cc: proskurin@sec.in.tum.de, Julien Grall , sstabellini@kernel.org Subject: [Xen-devel] [PATCH v3 12/16] xen/arm: p2m: Move lpae_* helpers in lpae.h 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" lpae_* helpers can work on any LPAE translation tables. Move them in lpae.h to allow other part of Xen to use them. Signed-off-by: Julien Grall Reviewed-by: Stefano Stabellini Reviewed-by: Sergej Proskurin --- Cc: proskurin@sec.in.tum.de Changes in v2: - Patch added Changes in v3: - Add Stefano's reviewed-by --- xen/arch/arm/p2m.c | 23 ----------------------- xen/include/asm-arm/lpae.h | 25 +++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 23 deletions(-) diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c index 381df1f237..9b7a580a87 100644 --- a/xen/arch/arm/p2m.c +++ b/xen/arch/arm/p2m.c @@ -52,29 +52,6 @@ static const paddr_t level_masks[] = static const uint8_t level_orders[] = { ZEROETH_ORDER, FIRST_ORDER, SECOND_ORDER, THIRD_ORDER }; -static inline bool_t lpae_valid(lpae_t pte) -{ - return pte.walk.valid; -} -/* - * These two can only be used on L0..L2 ptes because L3 mappings set - * the table bit and therefore these would return the opposite to what - * you would expect. - */ -static inline bool_t lpae_table(lpae_t pte) -{ - return lpae_valid(pte) && pte.walk.table; -} -static inline bool_t lpae_mapping(lpae_t pte) -{ - return lpae_valid(pte) && !pte.walk.table; -} - -static inline bool lpae_is_superpage(lpae_t pte, unsigned int level) -{ - return (level < 3) && lpae_mapping(pte); -} - static void p2m_flush_tlb(struct p2m_domain *p2m); /* Unlock the flush and do a P2M TLB flush if necessary */ diff --git a/xen/include/asm-arm/lpae.h b/xen/include/asm-arm/lpae.h index aa85cb8112..6fbf7c606c 100644 --- a/xen/include/asm-arm/lpae.h +++ b/xen/include/asm-arm/lpae.h @@ -126,6 +126,31 @@ typedef union { lpae_walk_t walk; } lpae_t; +static inline bool_t lpae_valid(lpae_t pte) +{ + return pte.walk.valid; +} + +/* + * These two can only be used on L0..L2 ptes because L3 mappings set + * the table bit and therefore these would return the opposite to what + * you would expect. + */ +static inline bool_t lpae_table(lpae_t pte) +{ + return lpae_valid(pte) && pte.walk.table; +} + +static inline bool_t lpae_mapping(lpae_t pte) +{ + return lpae_valid(pte) && !pte.walk.table; +} + +static inline bool lpae_is_superpage(lpae_t pte, unsigned int level) +{ + return (level < 3) && lpae_mapping(pte); +} + #endif /* __ASSEMBLY__ */ /*