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 F1FD7C4167B for ; Thu, 30 Nov 2023 08:53:05 +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=xN8PgTiZJxvthZRcvQwQ8PocwVSFy+f3wxMNrkfcdA4=; b=op638CG6qfY5WS OiRRy+j+RrXd0DqrpfXp7GXUrMTCy84YksWbkDZ6FeAA72AWhAAZxovUndNOggS7JqPmnkvC3uZJo DFs4uqtsABiVZyCT9CDG1IZXNn7vSuN8u3BEga8GWzjKSQRuZdwR1M3hEt4KLoKK6KszGp9RG39J/ WI7usCekEbD1PBJoIvvcgi0Gu0QMsUSIxSqWfL/7YD8z91V+KF7QoTyGp1DULDD4o5x14BU3NYmIu eBrYhwXwy8ce/hxVQpVAlsWxSgGjLDL2KmE3vI8nm1TsmjHRDT6ACs6CBatg7YD+WFGjKy3cLDhED Ebpd6WN8RJ85iYpnYhUw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r8cml-00AGHR-1M; Thu, 30 Nov 2023 08:52:39 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r8cmi-00AGGr-2g for linux-arm-kernel@lists.infradead.org; Thu, 30 Nov 2023 08:52:38 +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 1B8B81042; Thu, 30 Nov 2023 00:53:20 -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 95C2E3F6C4; Thu, 30 Nov 2023 00:52:30 -0800 (PST) Message-ID: <507db315-f580-47bf-89fd-111347395951@arm.com> Date: Thu, 30 Nov 2023 14:22:27 +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 Cc: Ard Biesheuvel , linux-arm-kernel@lists.infradead.org, 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> <5b52d515-d970-4566-a621-b44d5ab4aa99@arm.com> From: Anshuman Khandual In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231130_005236_964720_78F3418C X-CRM114-Status: GOOD ( 15.44 ) 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/30/23 13:32, Ard Biesheuvel wrote: > On Thu, 30 Nov 2023 at 08:59, Anshuman Khandual > wrote: >> >> >> >> 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 }, >>> }; >>> > > Hi Anshuman, > >> >> I have not debugged this any further, but the PCI region displays no entries >> via ptdump just after this patch being applied. >> > > It also does not display any mappings without the patch. What exactly > were you expecting to see here? Is not there a single entry inside - without this patch section. OR does it signify the gap-width of the PCI mapping area ? ---[ PCI I/O start ]--- 0xfffffbfffe800000-0xfffffbffff800000 16M PMD ---[ PCI I/O end ]--- > >> 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