From nobody Sat Oct 4 11:14:52 2025 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A014E30DEAF for ; Mon, 18 Aug 2025 09:14:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755508489; cv=none; b=Z/0fgsw3SBjAtaWrQcr5+m1y5LBxo+/bapPpWyNCdkc/CBmyr5DCJy+jKnbPOMZhAJpUyMW8WGtzrPGINBOcb4nIG74TITkpue5s++K4bLbmYnV0zdh5JcthoE3FC1HVm8HNuj6a98X3+Tv+jAB4rhfcpYEoDjO9RhsfnWjNLsc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755508489; c=relaxed/simple; bh=W3GEjgS3UdAA0U3JrlUn4vR255ZNONrTBozFim3cczw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=uGPXlmS7ezIRokJyFzT50HmA/GDwKeCtYoIpotgin3sI6xokyxt9R3aku5bPPgTwd5QfxJ9MhlViZbVaVFzbXuqlQD7zDfKKyez3wYVk0Wf0kJwBhZ/laHuVi5c+j88EBLQmM3KpuFGV1c3YzC/I7qvEAhMQ6CtyyrSPQYZm0Mc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com 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 C5ACA1424; Mon, 18 Aug 2025 02:14:38 -0700 (PDT) Received: from a076716.blr.arm.com (a076716.blr.arm.com [10.164.21.47]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 9A21E3F58B; Mon, 18 Aug 2025 02:14:44 -0700 (PDT) From: Anshuman Khandual To: linux-arm-kernel@lists.infradead.org Cc: Anshuman Khandual , Catalin Marinas , Will Deacon , Mark Brown , Ryan Roberts , Mark Rutland , linux-kernel@vger.kernel.org Subject: [RFC 1/3] arm64/ptdump: Re-organize ptdump_init() Date: Mon, 18 Aug 2025 14:44:34 +0530 Message-Id: <20250818091436.938517-2-anshuman.khandual@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250818091436.938517-1-anshuman.khandual@arm.com> References: <20250818091436.938517-1-anshuman.khandual@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Split ptdump_debugfs_register() from ptdump_init() which there after can be called early on during the boot and also enable dump kernel page table when required. While here rename ptdump_init() as ptdump_debugfs_init() to avoid name space collision. Signed-off-by: Anshuman Khandual --- arch/arm64/include/asm/ptdump.h | 2 ++ arch/arm64/kernel/setup.c | 2 ++ arch/arm64/mm/ptdump.c | 8 ++++++-- drivers/firmware/efi/arm-runtime.c | 4 ++-- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/arch/arm64/include/asm/ptdump.h b/arch/arm64/include/asm/ptdum= p.h index fded5358641f..27e774134e7f 100644 --- a/arch/arm64/include/asm/ptdump.h +++ b/arch/arm64/include/asm/ptdump.h @@ -57,6 +57,7 @@ struct ptdump_pg_state { unsigned long uxn_pages; }; =20 +void __init ptdump_init(void); void ptdump_walk(struct seq_file *s, struct ptdump_info *info); void note_page(struct ptdump_state *pt_st, unsigned long addr, int level, pteval_t val); @@ -74,6 +75,7 @@ static inline void ptdump_debugfs_register(struct ptdump_= info *info, const char *name) { } #endif /* CONFIG_PTDUMP_DEBUGFS */ #else +static inline void __init ptdump_init(void) { } static inline void note_page(struct ptdump_state *pt_st, unsigned long add= r, int level, pteval_t val) { } static inline void note_page_pte(struct ptdump_state *st, unsigned long ad= dr, pte_t pte) { } diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c index 77c7926a4df6..0a3812c8e177 100644 --- a/arch/arm64/kernel/setup.c +++ b/arch/arm64/kernel/setup.c @@ -43,6 +43,7 @@ #include #include #include +#include #include #include #include @@ -332,6 +333,7 @@ void __init __no_sanitize_address setup_arch(char **cmd= line_p) arm64_memblock_init(); =20 paging_init(); + ptdump_init(); =20 acpi_table_upgrade(); =20 diff --git a/arch/arm64/mm/ptdump.c b/arch/arm64/mm/ptdump.c index 421a5de806c6..7c42be62898b 100644 --- a/arch/arm64/mm/ptdump.c +++ b/arch/arm64/mm/ptdump.c @@ -367,7 +367,7 @@ bool ptdump_check_wx(void) } } =20 -static int __init ptdump_init(void) +void __init ptdump_init(void) { u64 page_offset =3D _PAGE_OFFSET(vabits_actual); u64 vmemmap_start =3D (u64)virt_to_page((void *)page_offset); @@ -396,7 +396,11 @@ static int __init ptdump_init(void) kernel_ptdump_info.base_addr =3D page_offset; =20 ptdump_initialize(); +} + +static int __init ptdump_debugfs_init(void) +{ ptdump_debugfs_register(&kernel_ptdump_info, "kernel_page_tables"); return 0; } -device_initcall(ptdump_init); +device_initcall(ptdump_debugfs_init); diff --git a/drivers/firmware/efi/arm-runtime.c b/drivers/firmware/efi/arm-= runtime.c index 83092d93f36a..3c84e84dc6ea 100644 --- a/drivers/firmware/efi/arm-runtime.c +++ b/drivers/firmware/efi/arm-runtime.c @@ -38,14 +38,14 @@ static struct ptdump_info efi_ptdump_info =3D { .base_addr =3D 0, }; =20 -static int __init ptdump_init(void) +static int __init ptdump_debugfs_init(void) { if (efi_enabled(EFI_RUNTIME_SERVICES)) ptdump_debugfs_register(&efi_ptdump_info, "efi_page_tables"); =20 return 0; } -device_initcall(ptdump_init); +device_initcall(ptdump_debugfs_init); =20 #endif =20 --=20 2.25.1