From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E2336C4338F for ; Thu, 12 Aug 2021 10:08:59 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 78621610A5 for ; Thu, 12 Aug 2021 10:08:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 78621610A5 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id D46C16B0088; Thu, 12 Aug 2021 06:08:58 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CCFBB6B0089; Thu, 12 Aug 2021 06:08:58 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BBDD28D000D; Thu, 12 Aug 2021 06:08:58 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0234.hostedemail.com [216.40.44.234]) by kanga.kvack.org (Postfix) with ESMTP id 9D1FB6B0088 for ; Thu, 12 Aug 2021 06:08:58 -0400 (EDT) Received: from smtpin03.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 34D00181CC425 for ; Thu, 12 Aug 2021 10:08:58 +0000 (UTC) X-FDA: 78466005156.03.A40F532 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf30.hostedemail.com (Postfix) with ESMTP id ACB87E008BE8 for ; Thu, 12 Aug 2021 10:08:57 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id A5C3F1042; Thu, 12 Aug 2021 03:08:56 -0700 (PDT) Received: from [10.163.68.17] (unknown [10.163.68.17]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 9CF043F718; Thu, 12 Aug 2021 03:08:53 -0700 (PDT) Subject: Re: [RFC V2 05/10] arm64/mm: Add CONFIG_ARM64_PA_BITS_52_[LPA|LPA2] To: Catalin Marinas Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, akpm@linux-foundation.org, suzuki.poulose@arm.com, mark.rutland@arm.com, will@kernel.org, maz@kernel.org, james.morse@arm.com, steven.price@arm.com References: <1627281445-12445-1-git-send-email-anshuman.khandual@arm.com> <1627281445-12445-6-git-send-email-anshuman.khandual@arm.com> <20210805172550.GG6719@arm.com> From: Anshuman Khandual Message-ID: <44a3f3e2-ee11-09b1-69cf-210aa2f6ddb5@arm.com> Date: Thu, 12 Aug 2021 15:39:47 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20210805172550.GG6719@arm.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Authentication-Results: imf30.hostedemail.com; dkim=none; spf=pass (imf30.hostedemail.com: domain of anshuman.khandual@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=anshuman.khandual@arm.com; dmarc=pass (policy=none) header.from=arm.com X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: ACB87E008BE8 X-Stat-Signature: 6d3hcgpcq8fwqkshxat8qr4h7sytuyhi X-HE-Tag: 1628762937-361712 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 8/5/21 10:55 PM, Catalin Marinas wrote: > On Mon, Jul 26, 2021 at 12:07:20PM +0530, Anshuman Khandual wrote: >> diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig >> index b5b13a9..1999ac6 100644 >> --- a/arch/arm64/Kconfig >> +++ b/arch/arm64/Kconfig >> @@ -934,6 +934,12 @@ config ARM64_VA_BITS >> default 48 if ARM64_VA_BITS_48 >> default 52 if ARM64_VA_BITS_52 >> >> +config ARM64_PA_BITS_52_LPA >> + bool >> + >> +config ARM64_PA_BITS_52_LPA2 >> + bool >> + >> choice >> prompt "Physical address space size" >> default ARM64_PA_BITS_48 >> @@ -948,6 +954,7 @@ config ARM64_PA_BITS_52 >> bool "52-bit (ARMv8.2)" >> depends on ARM64_64K_PAGES >> depends on ARM64_PAN || !ARM64_SW_TTBR0_PAN >> + select ARM64_PA_BITS_52_LPA if ARM64_64K_PAGES >> help >> Enable support for a 52-bit physical address space, introduced as >> part of the ARMv8.2-LPA extension. > > Do we actually need to bother with LPA, LPA2 options? We could just add These are internal configs for code organization purpose, which otherwise becomes bit entangled. Basically these configs just imply the following combinations being selected together. - ARM64_PA_BITS_52_LPA : ARM64_64K_PAGES && ARM64_PA_BITS_52 - ARM64_PA_BITS_52_LPA2 : (ARM64_4K_PAGES || ARM64_16K_PAGES) && ARM64_PA_BITS_52 There are some benefits here - ARM64_PA_BITS_52_[LPA|LPA2] helps in avoiding writing out code blocks for these above combinations in various different places, keeps it clean. - Cleanly encapsulates ARM64_PA_BITS_52 implementation into two different logical code blocks depending on the respective HW features enabling it i.e FEAT_LPA and FEAT_LPA2. This is important because there are distinct pte <----> phys encodings, ptdump handling, setting TCR_DS, FEAT_LPA2 detection, PTE sharability attribute handling which are dependent on how 52 bits PA is implemented. > an extra defined(ARM64_64K_PAGES) in places, it may be easier to follow > in a few years time when we won't remember what LPA or LPA2 was. I Are you suggesting that over the years, folks might forget about LPA/LPA2 details and might have to look back in arch/arm64/Kconfig to figure this out, which is not desirable ? But would not that be an acceptable trade off given the encapsulation it helps achieve ? > haven't got to the rest of the patches but it may just be simpler to > define the shifts separately for 52-bit based on 4K/16K/64K and ignore > the LPA/LPA2 distinction altogether (we'll still keep it for CPUID > checking though). > Sure. After you have gone through and reviewed rest of the series, if it still appears that dropping LPA/LPA2 distinction here would be simpler from a long term perspective, will be happy to change it accordingly.