From patchwork Mon Jul 16 17:27:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 142072 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp2677568ljj; Mon, 16 Jul 2018 10:29:32 -0700 (PDT) X-Google-Smtp-Source: AAOMgpe3sOqybWXErys/G7srKS4TN9AuDRXwFTBUR0/jbD+CzIOVWrEjGaBatR2TieDj45o8StuS X-Received: by 2002:a24:360b:: with SMTP id l11-v6mr14198455itl.42.1531762172499; Mon, 16 Jul 2018 10:29:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531762172; cv=none; d=google.com; s=arc-20160816; b=RGEAs8MRjAdZEpBm78YrhUcy4CGUGzDtX95LDiqHyxgIo6I0YPzCYQlYtjg10aiqNX Sw3QLCRB/CypuK6f0vMRiEfzhwrQgytZDiWUHiSkGLcW9+R9jpfwhCF3TVqiVVNj24v+ fBDRHOuvWCCjG8HEsZXcQ8ONqRE2SUoJDlKPBeGFYX8RkwEG2ETTV+ojA9Lww6ZRUozz 4Sp9senF7lFnoEMkjwBxM3Dw9qE++jJNssP4jLeSwM8Piwl/t0TRW9vSb8iNBiuLYJrE /y8CUlFN3wyCR+U9nT7KZiZQVPs+pXtyzU3I+eTGLX2Mz7UdWOsOiZnAsE9m86G+8MEj 8SXA== 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=6bd/G95ckLOR40vWWOowT97PPtAESkPztTv/SpFtgNg=; b=y/Bjz0WXDwuinVWcW2p8SClFw3N9JRV3icxYB/NNAnSmD5VxhUzCy4yzkwkyBLKufI Herl2VyQlWA6bBSsxsIW8ilSrDLkUAyk3ZUs/a6hjFe/UQ2Y52TRXHE72jGEmdiSDIh8 dY2gK5V+7qtD6xPxIjfmde0A26sPABk9hjzMAC03b2iwNbZmL6kQZby4XE8I3/x7zHRA JX71tVyfcKd6BEssn62/+GjvRSIm/AZC30mMg9Tgr8X+hek52JNex/mcjrwlpyUyoNW8 bWrTa1FEzn/1ydE6QCJ/YKNbBm2oTZF3sks4N3aXHtr+9hWXMZsZIdPrlhNS33ZCw3n5 SA6Q== 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 x2-v6si22278888iof.146.2018.07.16.10.29.32 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Jul 2018 10:29:32 -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 1ff7HV-0006T0-Tr; Mon, 16 Jul 2018 17:27:29 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ff7HU-0006Rv-9z for xen-devel@lists.xenproject.org; Mon, 16 Jul 2018 17:27:28 +0000 X-Inumbo-ID: 87eff18d-891d-11e8-a6a9-d7ebe60f679a Received: from foss.arm.com (unknown [217.140.101.70]) by us1-amaz-eas1.inumbo.com (Halon) with ESMTP id 87eff18d-891d-11e8-a6a9-d7ebe60f679a; Mon, 16 Jul 2018 17:27:36 +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 B33101650; Mon, 16 Jul 2018 10:27:26 -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 ECA603F5B1; Mon, 16 Jul 2018 10:27:25 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Mon, 16 Jul 2018 18:27:04 +0100 Message-Id: <20180716172712.20294-8-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 07/15] xen/arm: Rework lpae_table 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" Currently, lpae_table can only work on entry from any level other than 3. Make it work with any level by extending the prototype to pass the level. At the same time, rename the function to lpae_is_mapping so naming stay consistent accross all lpae_* helpers. Signed-off-by: Julien Grall Reviewed-by: Stefano Stabellini --- xen/arch/arm/mm.c | 2 +- xen/include/asm-arm/lpae.h | 9 ++------- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c index d234c46e41..b7f2dabd05 100644 --- a/xen/arch/arm/mm.c +++ b/xen/arch/arm/mm.c @@ -996,7 +996,7 @@ static int create_xen_entries(enum xenmap_operation op, for(; addr < addr_end; addr += PAGE_SIZE, mfn = mfn_add(mfn, 1)) { entry = &xen_second[second_linear_offset(addr)]; - if ( !lpae_table(*entry) ) + if ( !lpae_is_table(*entry, 2) ) { rc = create_xen_table(entry); if ( rc < 0 ) { diff --git a/xen/include/asm-arm/lpae.h b/xen/include/asm-arm/lpae.h index 4cf188ff82..c803569c2d 100644 --- a/xen/include/asm-arm/lpae.h +++ b/xen/include/asm-arm/lpae.h @@ -133,14 +133,9 @@ static inline bool lpae_valid(lpae_t pte) return pte.walk.valid; } -/* - * This one 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 lpae_table(lpae_t pte) +static inline bool lpae_is_table(lpae_t pte, unsigned int level) { - return lpae_valid(pte) && pte.walk.table; + return (level < 3) && lpae_valid(pte) && pte.walk.table; } static inline bool lpae_is_mapping(lpae_t pte, unsigned int level)