Received: by 10.192.165.148 with SMTP id m20csp1897438imm; Thu, 26 Apr 2018 03:57:21 -0700 (PDT) X-Google-Smtp-Source: AIpwx49zO+uh/dTOnYYwlXpiePLnfhZ5UEneTt4/06JeeIuBcJzyGYjSKzFMXWdf7vQldBgcOt0d X-Received: by 2002:a17:902:8a81:: with SMTP id p1-v6mr34401830plo.183.1524740241401; Thu, 26 Apr 2018 03:57:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524740241; cv=none; d=google.com; s=arc-20160816; b=Ga3SacO202i+21zz9XYW4SiKwj+y7BFuKYWnh7vp+MwvCuexaz6Eo9OGbAeGFtBDsH jgi6QUPj4cw2G4jqdxFR93sVDIc/axesjysVg1B7bII5vyKwbVciVmkwwyKApnSv4Xc9 OYpugwXMvdvN/J6/HpXkj27n0FR1/PJf5q7bJtZc6c77maCMaAByxXVhZyNL14322TI+ w7lxL81EGCZGFJQkU/04vJOSig+U91LvdqD+bsE0mZRRO1VxcF6i/xwm0zujn8OK62jY i6nOMlQcD+bbu2202i46MUlFWgSPy+7CFjJ1TJhquGaxFxKQSVB/okjliBhrVekgB1Wc f41A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=bVGMpPcWFgl7M9s2jR98o/z0XZ8d7dvgQokZ0Dy5qkE=; b=dgCbCT3EtOyX///Hbp1OpedZ2/unebBJsv35R1ubrkFm0HzezqYoxxYuR/jyoLaxRV yYSgUdkBtFI6B97lrpUPRVYjmZBddpAvV6jRFmGsv4rYcKwmX1VKJIbZzDsHJeA2tEmk dPFgJmqhNTojRRzKJZS6tKEo8nJRqnplztjqued0HHktbUpz/kOgpGTwhtR7gcXw1+bP gvod8iIObH6VgrWm7npoDKF5R+nsudYcYyq5nt6QS47bqMRpeCcKRalZcWNxAaRhGkAy xNMvc5YKgvhqh3folJ/sFEh3MHSgCnwDbOU825plojRnAuTRMnRJ1+wLffHu4UNqtm9q 3ItQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p9si15098233pgu.80.2018.04.26.03.57.07; Thu, 26 Apr 2018 03:57:21 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755017AbeDZKzv (ORCPT + 99 others); Thu, 26 Apr 2018 06:55:51 -0400 Received: from foss.arm.com ([217.140.101.70]:51776 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753879AbeDZKzu (ORCPT ); Thu, 26 Apr 2018 06:55:50 -0400 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 219C415AD; Thu, 26 Apr 2018 03:55:50 -0700 (PDT) Received: from [10.1.206.53] (e108454-lin.cambridge.arm.com [10.1.206.53]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 309F53F487; Thu, 26 Apr 2018 03:55:48 -0700 (PDT) Subject: Re: [PATCH v2 04/17] arm64: Refactor pud_huge for reusability To: Suzuki K Poulose , linux-arm-kernel@lists.infradead.org Cc: ard.biesheuvel@linaro.org, kvm@vger.kernel.org, marc.zyngier@arm.com, catalin.marinas@arm.com, punit.agrawal@arm.com, will.deacon@arm.com, linux-kernel@vger.kernel.org, kristina.martsenko@arm.com, pbonzini@redhat.com, kvmarm@lists.cs.columbia.edu References: <1522156531-28348-1-git-send-email-suzuki.poulose@arm.com> <1522156531-28348-5-git-send-email-suzuki.poulose@arm.com> From: Julien Grall Message-ID: <388557a3-f387-4c6c-b19f-88c958476f93@arm.com> Date: Thu, 26 Apr 2018 11:55:46 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <1522156531-28348-5-git-send-email-suzuki.poulose@arm.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Suzuki, On 27/03/18 14:15, Suzuki K Poulose wrote: > Make pud_huge reusable for stage2 tables, independent > of the stage1 levels. > > Cc: Steve Capper > Cc: Mark Rutland > Cc: Will Deacon > Cc: Catalin Marinas > Cc: Christoffer Dall > Signed-off-by: Suzuki K Poulose Reviewed-by: Julien Grall Cheers, > --- > arch/arm64/include/asm/pgtable.h | 5 +++++ > arch/arm64/mm/hugetlbpage.c | 2 +- > 2 files changed, 6 insertions(+), 1 deletion(-) > > diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h > index 5e22503..4a16c11 100644 > --- a/arch/arm64/include/asm/pgtable.h > +++ b/arch/arm64/include/asm/pgtable.h > @@ -479,6 +479,11 @@ static inline phys_addr_t pmd_page_paddr(pmd_t pmd) > #define __raw_pud_bad(pud) (!(pud_val(pud) & PUD_TABLE_BIT)) > #define __raw_pud_present(pud) pte_present(pud_pte(pud)) > > +static inline int __raw_pud_huge(pud_t pud) > +{ > + return pud_val(pud) && !(pud_val(pud) & PUD_TABLE_BIT); > +} > + > static inline void __raw_set_pud(pud_t *pudp, pud_t pud) > { > WRITE_ONCE(*pudp, pud); > diff --git a/arch/arm64/mm/hugetlbpage.c b/arch/arm64/mm/hugetlbpage.c > index ecc6818..3f4bb43 100644 > --- a/arch/arm64/mm/hugetlbpage.c > +++ b/arch/arm64/mm/hugetlbpage.c > @@ -35,7 +35,7 @@ int pmd_huge(pmd_t pmd) > int pud_huge(pud_t pud) > { > #ifndef __PAGETABLE_PMD_FOLDED > - return pud_val(pud) && !(pud_val(pud) & PUD_TABLE_BIT); > + return __raw_pud_huge(pud); > #else > return 0; > #endif > -- Julien Grall