From patchwork Mon Jul 16 17:27:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 142074 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp2677615ljj; Mon, 16 Jul 2018 10:29:35 -0700 (PDT) X-Google-Smtp-Source: AAOMgpepYm7zoCnlMsSYKqRxYUZVzxojQmDIhmBjDSQwzmjzNeVzhLszpXP+Dfwjkf6fg9Iv5Jk7 X-Received: by 2002:a6b:7a05:: with SMTP id h5-v6mr26121911iom.238.1531762175864; Mon, 16 Jul 2018 10:29:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531762175; cv=none; d=google.com; s=arc-20160816; b=IGokLtUGLLQ83S6N+7zP2q8KnYH6f89beqgxJiU/NcyNIT5VU/Ric7hihb+rKnYoGA vi73r4XoEMk4//3qFWHzOQMkEBxEt1iAl5rUs+EKD9+VVnlYogQxS8f08N8Nx9sCbuXj l4V1me+E3SBz5TKkPpGVe5+CS2gRrYZxZ0MpGKYsnblqE6j4ORghdh/sDKSzHmn+XKG3 Wg7k45us+dvQWOUh8cvPzVtYxpykYT0jA7306OpY47LQdHBl0rGbt4VQz2iz3MF0emMz R07UiEwg6FwzcGnAQqCKY44TUwCJjRuBBf4ZbTFjRCdf38ZKy6dMAt6iSWQbpYuXPUuf X98w== 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:cc :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:references:in-reply-to:message-id:date:to:from :arc-authentication-results; bh=HfHOj1wVOCuL4k6ZdCkorgxPB0D6nPvWL1eY22znD+g=; b=c8nBUJVzziAlDPg/6+Qgi8nGl10KQ1ZW9d5/D7xS2/Hb97j5E1TxmGbxIFheHPCetU 6p2PGpEanOibPM52rUszPKml+NbZ3SvGJvkAIyIQ6DWEd0unQQOPcYgaOSqQvXAoDOzs /c/AHoTG4tib0Ha5alu+dnNpDBoDf0q0xPjtxZo/p4X9r5BQGE4jyu1jaKyUlhJzqDcY a/oAXvpW7Ji/dZV4QTd5DS68uB545vcHzDnN3Wek9hAXx/QCPjL+yHD0sWcRfZTtSndB zmfbEgwK47gfAhaNZG30end39aOcDOwH1UHxtc003He8fqpwLhkkuy4+Enw8N4Bhrj48 qMHA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id s47-v6si9335465ite.123.2018.07.16.10.29.35 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Jul 2018 10:29:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ff7HX-0006V9-JE; Mon, 16 Jul 2018 17:27:31 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ff7HV-0006Sj-Fn for xen-devel@lists.xenproject.org; Mon, 16 Jul 2018 17:27:29 +0000 X-Inumbo-ID: 8926adef-891d-11e8-a6a9-d7ebe60f679a Received: from foss.arm.com (unknown [217.140.101.70]) by us1-amaz-eas1.inumbo.com (Halon) with ESMTP id 8926adef-891d-11e8-a6a9-d7ebe60f679a; Mon, 16 Jul 2018 17:27:38 +0000 (UTC) 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 BC7907A9; Mon, 16 Jul 2018 10:27:28 -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 01AEA3F5B1; Mon, 16 Jul 2018 10:27:27 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Mon, 16 Jul 2018 18:27:06 +0100 Message-Id: <20180716172712.20294-10-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180716172712.20294-1-julien.grall@arm.com> References: <20180716172712.20294-1-julien.grall@arm.com> Subject: [Xen-devel] [PATCH 09/15] xen/arm: guest_walk: Use lpae_is_mapping to simplify the code X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Julien Grall , sstabellini@kernel.org MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" !lpae_is_page(pte, level) && !lpae_is_superpage(pte, level) is equivalent to !lpae_is_mapping(pte, level). At the same time drop lpae_is_page(pte, level) that is now unused. Signed-off-by: Julien Grall Reviewed-by: Stefano Stabellini --- xen/arch/arm/guest_walk.c | 2 +- xen/include/asm-arm/lpae.h | 5 ----- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/xen/arch/arm/guest_walk.c b/xen/arch/arm/guest_walk.c index a7c7e05603..e3e21bdad3 100644 --- a/xen/arch/arm/guest_walk.c +++ b/xen/arch/arm/guest_walk.c @@ -566,7 +566,7 @@ static int guest_walk_ld(const struct vcpu *v, * PTE is invalid or holds a reserved entry (PTE<1:0> == x0)) or if the PTE * maps a memory block at level 3 (PTE<1:0> == 01). */ - if ( !lpae_is_page(pte, level) && !lpae_is_superpage(pte, level) ) + if ( !lpae_is_mapping(pte, level) ) return -EFAULT; /* Make sure that the lower bits of the PTE's base address are zero. */ diff --git a/xen/include/asm-arm/lpae.h b/xen/include/asm-arm/lpae.h index 1d86020d07..15595cd35c 100644 --- a/xen/include/asm-arm/lpae.h +++ b/xen/include/asm-arm/lpae.h @@ -153,11 +153,6 @@ static inline bool lpae_is_superpage(lpae_t pte, unsigned int level) return (level < 3) && lpae_is_mapping(pte, level); } -static inline bool lpae_is_page(lpae_t pte, unsigned int level) -{ - return (level == 3) && lpae_is_valid(pte) && pte.walk.table; -} - /* * AArch64 supports pages with different sizes (4K, 16K, and 64K). To enable * page table walks for various configurations, the following helpers enable