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 909B5C00A8F for ; Tue, 24 Oct 2023 17:59:16 +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:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=nsYb3R/g450VTsDlJtVC6XSkx4dLHkhAdhNFBR5QWmg=; b=nPZ4MTN5IDZuhb TJ5T+Nj9k+HRFuZ2PKr1cI0aEBH84ZIr7pmFH/QGcl02pvfKQAMGR580fZfBgr6ntAduYA4IjtGQx 3X5fOtfNeRSTsGFV9571qbhhXhbXArx6GDlfTOAccjZKCr8nLzsEfcwNH0mpekYT9LZAp1/IW+PUo zjEPr71c8dGYJ3A9UMVnKcG8ryC8Jt+xnStmWrqAweB7KHaipJRH/3pD48PkigoA2tOr5culoCjQP CR4mMan9xUZEAb+3RsSpqinmJgdmVOv06Balkq/i5Z5pJxt2441uqPKLlZdFANmfUpSHbhxu43PtC m7C/yXEztj9wxwFVsyag==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qvLg2-00Acu7-2I; Tue, 24 Oct 2023 17:58:50 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qvLfz-00Actj-0o for linux-arm-kernel@lists.infradead.org; Tue, 24 Oct 2023 17:58:49 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 6D23A61B09; Tue, 24 Oct 2023 17:58:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 494ABC433C7; Tue, 24 Oct 2023 17:58:44 +0000 (UTC) Date: Tue, 24 Oct 2023 18:58:41 +0100 From: Catalin Marinas To: Ard Biesheuvel Cc: linux-arm-kernel@lists.infradead.org, Ard Biesheuvel , Will Deacon , Marc Zyngier , Mark Rutland , Ryan Roberts , Anshuman Khandual , Kees Cook , Joey Gouly Subject: Re: [PATCH v4 35/61] arm64: pgtable: Decouple PGDIR size macros from PGD/PUD/PMD levels Message-ID: References: <20230912141549.278777-63-ardb@google.com> <20230912141549.278777-98-ardb@google.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231024_105847_355918_3ABB91B8 X-CRM114-Status: GOOD ( 25.84 ) 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 Thu, Oct 19, 2023 at 05:34:33PM +0100, Catalin Marinas wrote: > On Tue, Sep 12, 2023 at 02:16:25PM +0000, Ard Biesheuvel wrote: > > diff --git a/arch/arm64/include/asm/kernel-pgtable.h b/arch/arm64/include/asm/kernel-pgtable.h > > index 742a4b2778f7..5000f38ae0c6 100644 > > --- a/arch/arm64/include/asm/kernel-pgtable.h > > +++ b/arch/arm64/include/asm/kernel-pgtable.h > > @@ -13,27 +13,22 @@ > > #include > > > > /* > > - * The linear mapping and the start of memory are both 2M aligned (per > > - * the arm64 booting.txt requirements). Hence we can use section mapping > > - * with 4K (section size = 2M) but not with 16K (section size = 32M) or > > - * 64K (section size = 512M). > > + * The physical and virtual addresses of the start of the kernel image are > > + * equal modulo 2 MiB (per the arm64 booting.txt requirements). Hence we can > > + * use section mapping with 4K (section size = 2M) but not with 16K (section > > + * size = 32M) or 64K (section size = 512M). > > */ > > - > > -/* > > - * The idmap and swapper page tables need some space reserved in the kernel > > - * image. Both require pgd, pud (4 levels only) and pmd tables to (section) > > - * map the kernel. With the 64K page configuration, swapper and idmap need to > > - * map to pte level. The swapper also maps the FDT (see __create_page_tables > > - * for more information). Note that the number of ID map translation levels > > - * could be increased on the fly if system RAM is out of reach for the default > > - * VA range, so pages required to map highest possible PA are reserved in all > > - * cases. > > - */ > > -#ifdef CONFIG_ARM64_4K_PAGES > > -#define SWAPPER_PGTABLE_LEVELS (CONFIG_PGTABLE_LEVELS - 1) > > +#if defined(PMD_SIZE) && PMD_SIZE <= MIN_KIMG_ALIGN > > Nitpick: we always have PMD_SIZE defined, either directly in the arm64 > headers if we have more than 2 levels or included from the generic > pgtable-nopmd.h. Otherwise the logic is fine. I pushed a patch removing this defined(PMD_SIZE) but it turns out that we include this file in assembly and while the generic PMD_SIZE is only defined if !defined(__ASSEMBLY__). Not sure the macro is used or just the linker complaining. I'll revert my patch temporarily on top of for-next/core and think about it tomorrow. I don't like that this #if check is only false because some other header bracketed it with #ifndef __ASSEMBLY__. -- Catalin _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel