From patchwork Mon Jun 19 16:57:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 105892 Delivered-To: patch@linaro.org Received: by 10.182.29.35 with SMTP id g3csp942434obh; Mon, 19 Jun 2017 09:59:55 -0700 (PDT) X-Received: by 10.36.124.143 with SMTP id a137mr22982105itd.30.1497891595812; Mon, 19 Jun 2017 09:59:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1497891595; cv=none; d=google.com; s=arc-20160816; b=HsT8Uj0N4F4J33iEMY40ozl3fz2R96VLHekEBPWCwwkE+HXh24OCNb7GVjaldUnMwD PxXk8Twju0jEkTuMQCSx3Pv4mXYSK9ba3NPVMASIWud6JN1lBEK1mXGFGZfWSBMtIaj0 ISYuQkqMlYouxCkOrDNIaJheGkhAlkb8LeuUM8f1FBZhwxGKeY39s4FV+WHkaMfOci7U fWqrB1W6poYTZTzOuQlvYveKgum+7yG5GrqYMkUoI6oMsz4X7BjxOBAmFK3x8C7N2Nge b7fQYDAR9zFuVXErtUd0RakfLD7P6MM4e64e7tQioi0BcEI7uK9NOG07ud5zT54H3y+v RuTQ== 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=fDR6HTDUMoUYNJtf3U1RtVHnxLWrUAC8VLGSG79f2bg=; b=SvnHtngsxR3QbVw8bTfOAqYdTATj11J1cQhyQIYNa2qYJ0HcowR6wMyiLxSqruS2V3 GHZh2I1NBHLYu8hohGfbd9baDPLGKPIdLO59AwYdSLJPMqQcY5dRaPAD3RfTUT6UbQgd P8Bxb4+pPRhpp5l7aanU1t52UKzel6AV9k5t81mCrS9zqT8jq0upD76TbniXZWKRwgXB 9zX2Tknp+U57cSWVdh/MBvW6FKI8FEv5heVHR9Z67qOsv5JaDmapZjRVjvskC1UQmD/f QNoX7PCIX9/Ao+qs3X83FtC5AYRfkcgZTNO3ZRmIcoipCaey1x/GZjvhdvc9i7NBNsu8 ZZYA== 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 y99si12020156ioe.224.2017.06.19.09.59.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Jun 2017 09:59:55 -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 1dN00H-0003wX-Dy; Mon, 19 Jun 2017 16:58:17 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dN00G-0003sP-69 for xen-devel@lists.xen.org; Mon, 19 Jun 2017 16:58:16 +0000 Received: from [85.158.137.68] by server-3.bemta-3.messagelabs.com id ED/CE-01985-7A208495; Mon, 19 Jun 2017 16:58:15 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrCLMWRWlGSWpSXmKPExsVysyfVTXcZk0e kweGD1hZLPi5mcWD0OLr7N1MAYxRrZl5SfkUCa8b/BS2sBU8FK861PmFqYHzI18XIxSEksJlR ondpFzuEc5pRoqfzL3MXIycHm4CmxJ3Pn5hAbBEBaYlrny8zdjFycDALREn8n8YJEhYWcJV43 NvKBBJmEVCV2PdeHsTkFbCSOHIjBaRCQkBeYlfbRVYQmxMo/H3+NUYQW0jAUuL4k1tsExi5Fz AyrGLUKE4tKkst0jUy1ksqykzPKMlNzMzRNTQw1stNLS5OTE/NSUwq1kvOz93ECPRtPQMD4w7 Gvr1+hxglOZiURHln/XePFOJLyk+pzEgszogvKs1JLT7EKMPBoSTBu4nRI1JIsCg1PbUiLTMH GGQwaQkOHiURXjtgoAnxFhck5hZnpkOkTjEqSonzngTpEwBJZJTmwbXBAvsSo6yUMC8jAwODE E9BalFuZgmq/CtGcQ5GJWHepyBTeDLzSuCmvwJazAS0mPmMC8jikkSElFQDI7vUziMZLT+eOD UcDbm0cef8MveylebzLM142B/ve7m3wG0154ztfbWGm1c0JjXNl31cNneThO/qD8amP+o8Jrn ucc9p7Juxn/GVg7MG0+wza/ySFq9832EjtELxH2tmotzX/cJMh05Znfj4wcbJseAhr1qeh6nh 9Mb0jWallucXejN17BLhUGIpzkg01GIuKk4EADQ/N7RnAgAA X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-12.tower-31.messagelabs.com!1497891494!89562475!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 31063 invoked from network); 19 Jun 2017 16:58:14 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-12.tower-31.messagelabs.com with SMTP; 19 Jun 2017 16:58:14 -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 367231610; Mon, 19 Jun 2017 09:58:14 -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 6073F3F41F; Mon, 19 Jun 2017 09:58:13 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Mon, 19 Jun 2017 17:57:50 +0100 Message-Id: <20170619165753.25049-14-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170619165753.25049-1-julien.grall@arm.com> References: <20170619165753.25049-1-julien.grall@arm.com> Cc: proskurin@sec.in.tum.de, Julien Grall , sstabellini@kernel.org Subject: [Xen-devel] [PATCH v2 13/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 --- Cc: proskurin@sec.in.tum.de Changes in v2: - Patch added --- 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 1136d837fb..f9145f052f 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__ */ /*