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 58AF2C4167B for ; Thu, 30 Nov 2023 08:00:27 +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=X9o90uVJRsyQ7rMtTrqdP7HsLO6AgSXQghU+WyxQyPk=; b=uZUTLNRtEnOXw0 Eq02D3KSFiWqX0IjZ6bJ9mGLfnFYFG0vGQ00BoruvZD0IGRY08DpP9RCGrRSHlu/DAvr/Q/787lfN ApeoTD60nK+TBVgEZ6wSzSWFTScG2sBvgJJ3NCJ4H66Fn1HRpNbNJDAZxHKmMGJNnLlRq5ySrqO6Z BMqVccfsvwBBTtCvnOmQF9eJt8F+YXP66zOCN81bcb+/wg2GsjOBoN6vx51WS/IkEkeqZfHUsHykR 63I3DQYgYc05SG2/WgsK0PaQMtJ4IITra5ONzhdJ4YHPbdJQ0952EcpP6ocbZD7PSJc1UhSZUoteO +AagfMuYH3ICiFG9q76A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r8bxk-00A9Ks-16; Thu, 30 Nov 2023 07:59:56 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r8bxg-00A9KW-1Z for linux-arm-kernel@lists.infradead.org; Thu, 30 Nov 2023 07:59:54 +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 C98711042; Thu, 30 Nov 2023 00:00:32 -0800 (PST) Received: from [10.162.41.8] (a077893.blr.arm.com [10.162.41.8]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 50DC43F6C4; Wed, 29 Nov 2023 23:59:43 -0800 (PST) Message-ID: <5b52d515-d970-4566-a621-b44d5ab4aa99@arm.com> Date: Thu, 30 Nov 2023 13:29:40 +0530 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v6 04/41] arm64: mm: Move PCI I/O emulation region above the vmemmap region Content-Language: en-US To: Ard Biesheuvel , linux-arm-kernel@lists.infradead.org Cc: Ard Biesheuvel , Catalin Marinas , Will Deacon , Marc Zyngier , Mark Rutland , Ryan Roberts , Kees Cook References: <20231129111555.3594833-43-ardb@google.com> <20231129111555.3594833-47-ardb@google.com> From: Anshuman Khandual In-Reply-To: <20231129111555.3594833-47-ardb@google.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231129_235952_639720_3467CD00 X-CRM114-Status: GOOD ( 14.86 ) 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 11/29/23 16:46, Ard Biesheuvel wrote: > From: Ard Biesheuvel > > Move the PCI I/O region above the vmemmap region in the kernel's VA > space. This will permit us to reclaim the lower part of the vmemmap > region for vmalloc/vmap allocations when running a 52-bit VA capable > build on a 48-bit VA capable system. > > Signed-off-by: Ard Biesheuvel > --- > arch/arm64/include/asm/memory.h | 4 ++-- > arch/arm64/mm/ptdump.c | 4 ++-- > 2 files changed, 4 insertions(+), 4 deletions(-) > > diff --git a/arch/arm64/include/asm/memory.h b/arch/arm64/include/asm/memory.h > index b8d726f951ae..99caeff78e1a 100644 > --- a/arch/arm64/include/asm/memory.h > +++ b/arch/arm64/include/asm/memory.h > @@ -49,8 +49,8 @@ > #define MODULES_VSIZE (SZ_2G) > #define VMEMMAP_START (-(UL(1) << (VA_BITS - VMEMMAP_SHIFT))) > #define VMEMMAP_END (VMEMMAP_START + VMEMMAP_SIZE) > -#define PCI_IO_END (VMEMMAP_START - SZ_8M) > -#define PCI_IO_START (PCI_IO_END - PCI_IO_SIZE) > +#define PCI_IO_START (VMEMMAP_END + SZ_8M) > +#define PCI_IO_END (PCI_IO_START + PCI_IO_SIZE) > #define FIXADDR_TOP (VMEMMAP_START - SZ_32M) > > #if VA_BITS > 48 > diff --git a/arch/arm64/mm/ptdump.c b/arch/arm64/mm/ptdump.c > index e305b6593c4e..d1df56d44f8a 100644 > --- a/arch/arm64/mm/ptdump.c > +++ b/arch/arm64/mm/ptdump.c > @@ -47,10 +47,10 @@ static struct addr_marker address_markers[] = { > { VMALLOC_END, "vmalloc() end" }, > { FIXADDR_TOT_START, "Fixmap start" }, > { FIXADDR_TOP, "Fixmap end" }, > - { PCI_IO_START, "PCI I/O start" }, > - { PCI_IO_END, "PCI I/O end" }, > { VMEMMAP_START, "vmemmap start" }, > { VMEMMAP_START + VMEMMAP_SIZE, "vmemmap end" }, > + { PCI_IO_START, "PCI I/O start" }, > + { PCI_IO_END, "PCI I/O end" }, > { -1, NULL }, > }; > I have not debugged this any further, but the PCI region displays no entries via ptdump just after this patch being applied. With the patch: ---[ Fixmap end ]--- 0xfffffbfffe000000-0xfffffc0000000000 32M PMD ---[ vmemmap start ]--- 0xfffffc0000000000-0xfffffc0002000000 32M PMD RW NX SHD AF NG BLK UXN MEM/NORMAL 0xfffffc0002000000-0xfffffc0020000000 480M PMD 0xfffffc0020000000-0xfffffc0022000000 32M PMD RW NX SHD AF NG BLK UXN MEM/NORMAL 0xfffffc0022000000-0xfffffc0040000000 480M PMD 0xfffffc0040000000-0xfffffc8000000000 511G PUD 0xfffffc8000000000-0xfffffe0000000000 1536G PGD ---[ vmemmap end ]--- 0xfffffe0000000000-0xfffffe8000000000 512G PGD ---[ PCI I/O start ]--- ---[ PCI I/O end ]--- -----> No entries 0xfffffe8000000000-0x0000000000000000 1536G PGD Without the patch: --[ Fixmap start ]--- 0xfffffbfffdc31000-0xfffffbfffddf6000 1812K PTE 0xfffffbfffddf6000-0xfffffbfffddf9000 12K PTE ro x SHD AF UXN MEM/NORMAL 0xfffffbfffddf9000-0xfffffbfffddfa000 4K PTE ro NX SHD AF NG UXN MEM/NORMAL 0xfffffbfffddfa000-0xfffffbfffddfd000 12K PTE 0xfffffbfffddfd000-0xfffffbfffddfe000 4K PTE RW NX SHD AF NG UXN DEVICE/nGnRE 0xfffffbfffddfe000-0xfffffbfffde00000 8K PTE ro NX SHD AF NG UXN MEM/NORMAL 0xfffffbfffde00000-0xfffffbfffe000000 2M PTE ---[ Fixmap end ]--- 0xfffffbfffe000000-0xfffffbfffe800000 8M PMD ---[ PCI I/O start ]--- 0xfffffbfffe800000-0xfffffbffff800000 16M PMD ---[ PCI I/O end ]--- 0xfffffbffff800000-0xfffffc0000000000 8M PMD ---[ vmemmap start ]--- 0xfffffc0000000000-0xfffffc0002000000 32M PMD RW NX SHD AF NG BLK UXN MEM/NORMAL 0xfffffc0002000000-0xfffffc0020000000 480M PMD 0xfffffc0020000000-0xfffffc0022000000 32M PMD RW NX SHD AF NG BLK UXN MEM/NORMAL 0xfffffc0022000000-0xfffffc0040000000 480M PMD 0xfffffc0040000000-0xfffffc8000000000 511G PUD 0xfffffc8000000000-0xfffffe0000000000 1536G PGD ---[ vmemmap end ]--- _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel