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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id ED404C77B75 for ; Tue, 18 Apr 2023 15:02:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To: Subject:MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=F2UdAjHG+Nyw6NJRTLaCmO/UMm1Deate79/JMHYbOmU=; b=gEvFExwav7C+qn q3T1g4zVDEG7cxFBx9fs1zWQ/b3pKmzLSj/yMFvtNG3ae8/z00pEtoPZanhl6mKxebuTx3cxRfD9v sn0ZjJ+aioc/MC8hFRbobjm+2e3FqYJ1L/qpLfavR0eyLelfRVmabBYjup6gF7RmsY2mgG3hrjA8f KeLlFaPgw9eCdeZl4l1Jz1pFsoK9suX6XEcnaS0vQDxufyI5iYCKBJcJivrKTlXrz1iZS5lRL+or+ gJQZLv1oGlSfwa5GNAs2Un0rOce8xWUtkmhsh+poTdwRiNqvnyYSI0eCImPgTm5K6frXgURdlqG6R b4lZJmABB1dDGtwOmPyQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pompx-002W9s-2w; Tue, 18 Apr 2023 15:01:41 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pompn-002W6L-1w for linux-arm-kernel@lists.infradead.org; Tue, 18 Apr 2023 15:01:33 +0000 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 C6C1D168F; Tue, 18 Apr 2023 08:02:10 -0700 (PDT) Received: from [10.1.27.157] (C02CF1NRLVDN.cambridge.arm.com [10.1.27.157]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E6FC83F5A1; Tue, 18 Apr 2023 08:01:25 -0700 (PDT) Message-ID: Date: Tue, 18 Apr 2023 16:01:24 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.9.1 Subject: Re: [PATCH v3 00/60] arm64: Add support for LPA2 at stage1 and WXN Content-Language: en-US To: Ard Biesheuvel , linux-kernel@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, Catalin Marinas , Will Deacon , Marc Zyngier , Mark Rutland , Anshuman Khandual , Kees Cook References: <20230307140522.2311461-1-ardb@kernel.org> From: Ryan Roberts In-Reply-To: <20230307140522.2311461-1-ardb@kernel.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230418_080131_734481_256CCD95 X-CRM114-Status: GOOD ( 32.26 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 07/03/2023 14:04, Ard Biesheuvel wrote: > This is a followup to [0], which was a lot smaller. Thanks to Ryan for > feedback and review. This series is independent from Ryan's work on > adding support for LPA2 to KVM - the only potential source of conflict > should be the patch "arm64: kvm: Limit HYP VA and host S2 range to 48 > bits when LPA2 is in effect", which could simply be dropped in favour of > the KVM changes to make it support LPA2. > > The first ~15 patches of this series rework how the kernel VA space is > organized, so that the vmemmap region does not take up more space than > necessary, and so that most of it can be reclaimed when running a build > capable of 52-bit virtual addressing on hardware that is not. This is > needed because the vmemmap region will take up a substantial part of the > upper VA region that it shares with the kernel, modules and > vmalloc/vmap mappings once we enable LPA2 with 4k pages. > > The next ~30 patches rework the early init code, reimplementing most of > the page table and relocation handling in C code. There are several > reasons why this is beneficial: > - we generally prefer C code over asm for these things, and the macros > that currently exist in head.S for creating the kernel pages tables > are a good example why; > - we no longer need to create the kernel mapping in two passes, which > means we can remove the logic that copies parts of the fixmap and the > KAsan shadow from one set of page tables to the other; this is > especially advantageous for KAsan with LPA2, which needs more > elaborate shadow handling across multiple levels, since the KAsan > region cannot be placed on exact pgd_t bouundaries in that case; > - we can read the ID registers and parse command line overrides before > creating the page tables, which simplifies the LPA2 case, as flicking > the global TCR_EL1.DS bit at a later stage would require elaborate > repainting of all page table descriptors, some of which with the MMU > disabled; > - we can use more elaborate logic to create the mappings, which means we > can use more precise mappings for code and data sections even when > using 2 MiB granularity, and this is a prerequisite for running with > WXN. > > As part of the ID map changes, we decouple the ID map size from the > kernel VA size, and switch to a 48-bit VA map for all configurations. > > The next 18 patches rework the existing LVA support as a CPU feature, > which simplifies some code and gets rid of the vabits_actual variable. > Then, LPA2 support is implemented in the same vein. This requires adding > support for 5 level paging as well, given that LPA2 introduces a new > paging level '-1' when using 4k pages. I still don't see any changes for TLBI, which I raised in the first round, and which I think you need when enabling LPA2. I have 2 patches, which I think are appropriate; one covers the non-range tlbi routines (and is part of my KVM series) and the other covers the rage-based routines (this would need a bit of fix up to use your lpa2_is_enabled()). At [1] and [2] respectively. [1] https://lore.kernel.org/kvmarm/20230306195438.1557851-2-ryan.roberts@arm.com/ [2] https://gitlab.arm.com/linux-arm/linux-rr/-/commit/38628decb785aea42a349a857b9f8a65a19e9c2b Thanks, Ryan _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel