[PATCH v2 0/6] arm64: distinguish HW PTE pointers from SW PTE value pointers
flat view
COLD15d
From: Muhammad Usama Anjum <hidden>
Date: 2026-09-22 17:33:03
Also in:
linux-efi, linux-mm, lkml
Hi, The generic series introduces hw_pte_t for HW PTEs, while SW PTE values use pte_t. This series enables the distinct type on arm64 so the compiler can distinguish HW PTE pointers (hw_pte_t *) from SW PTE value pointers (pte_t *). The conversion updates HW PTE pointers and accessors, including atomic updates, fixmap, and early page-table construction, before selecting ARCH_HAS_HW_PTE_T. Higher-level entry types remain out of scope, and shared helpers retain explicit casts. The linked generic series is a prerequisite. Its cover contains the Coccinelle script used for most pointer conversions; the remaining sites were converted by hand. Testing: Testing was performed with and without the series on both x86_64 and arm64. KUnit and the MM kselftests produced matching before-and-after results problems or regressions. Fastpath performance testing was also completed on arm64. No regression was found. Link: https://lore.kernel.org/all/20260922-pte0-v3-0-5670b8cb9059@arm.com (local) Signed-off-by: Muhammad Usama Anjum <redacted> --- Changes in v2: - Move hw_pte_val() to the generic series and drop an unrelated comment change from the atomic-access patch. - Use raw PTE values instead of generic HW/SW conversion helpers. - Drop a comment and add testing resutls in the cover letter - Add Reviewed-by tags. - Link to v1: https://patch.msgid.link/20260914-pte0_arm-v1-0-bb53b663e396@arm.com (local) To: Catalin Marinas <catalin.marinas@arm.com> To: Will Deacon <will@kernel.org> To: Mark Rutland <mark.rutland@arm.com> To: Ard Biesheuvel <ardb@kernel.org> To: Ilias Apalodimas <ilias.apalodimas@linaro.org> To: Andrey Ryabinin <ryabinin.a.a@gmail.com> To: Alexander Potapenko <glider@google.com> To: Andrey Konovalov <andreyknvl@gmail.com> To: Dmitry Vyukov <dvyukov@google.com> To: Vincenzo Frascino <vincenzo.frascino@arm.com> Cc: usama.anjum@arm.com Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org Cc: linux-efi@vger.kernel.org Cc: kasan-dev@googlegroups.com --- Muhammad Usama Anjum (6): arm64: use hw_pte_t for HW PTE pointers arm64: use hw_pte_val for HW PTE atomics arm64: use hw_pte_val for HW PTE loads and stores arm64: use hw_pte_t for fixmap HW PTEs arm64: use HW PTE accessors in early map_range() arm64: enable a distinct type for HW PTEs arch/arm64/Kconfig | 1 + arch/arm64/include/asm/hugetlb.h | 19 ++++---- arch/arm64/include/asm/pgalloc.h | 2 +- arch/arm64/include/asm/pgtable.h | 157 ++++++++++++++++++++++++++++++++++------------------------------ arch/arm64/include/asm/vmalloc.h | 2 +- arch/arm64/kernel/efi.c | 3 +- arch/arm64/kernel/pi/map_kernel.c | 4 +- arch/arm64/kernel/pi/map_range.c | 20 +++++---- arch/arm64/kernel/pi/pi.h | 3 +- arch/arm64/mm/contpte.c | 49 ++++++++++---------- arch/arm64/mm/fault.c | 7 +-- arch/arm64/mm/fixmap.c | 8 ++-- arch/arm64/mm/hugetlbpage.c | 48 ++++++++++---------- arch/arm64/mm/kasan_init.c | 4 +- arch/arm64/mm/mmu.c | 46 +++++++++++-------- arch/arm64/mm/pageattr.c | 4 +- arch/arm64/mm/trans_pgd.c | 4 +- 17 files changed, 207 insertions(+), 174 deletions(-) --- base-commit: ead700ca770c82167af32622cf8b68c9f87c3c7c change-id: 20260911-pte0_arm-f1b7df7c0b51 prerequisite-message-id: 20260922-pte0-v3-0-5670b8cb9059@arm.com prerequisite-patch-id: 0114fcc6ab0dbb739b5bb6fc0fe6b1c8f1fa37a1 prerequisite-patch-id: 09fcf65970074620dd3a9cce6850b901beb01db8 prerequisite-patch-id: 9b2fdab97c99effabb85526fa7f141c933b3aa23 prerequisite-patch-id: 1aa309a26d98a1e93a54742705a03567ee93be71 prerequisite-patch-id: ebe32f52c95ad0542982f0b37798d209595e25e1 prerequisite-patch-id: 22950028c3d2060de8acd3fe4a73d755b18215e3 prerequisite-patch-id: a60d249f52d092524176851b2570d7245bb24434 prerequisite-patch-id: 81ebd1378e25d40a1771b53973abcc4defa87535 prerequisite-patch-id: d982f2b00c5eddb2459f69008a73e4f4ae4d8299 Best regards, -- Usama