[PATCH 2/2] arm64: mm: Convert the temporary KPTI pgd address for TTBR1_EL1

Fuad Tabba fuad.tabba at linux.dev
Thu Dec 3 05:25:17 PST 2026


Since commit 47546a1912fc4 ("arm64: mm: install KPTI nG mappings with
MMU enabled"), idmap_kpti_install_ng_mappings() writes the address of
the temporary pgd to TTBR1_EL1 without the phys_to_ttbr conversion. For
a pgd above 2^48 with CONFIG_ARM64_PA_BITS_52, the CPU walks from the
wrong table and the boot hangs.

The kernel image is kept below 2^48, but this pgd comes from the page
allocator. Systems aren't known to have RAM that high.

Use load_ttbr1, which does the conversion.

Signed-off-by: Fuad Tabba <fuad.tabba at linux.dev>
---
 arch/arm64/mm/proc.S | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/arch/arm64/mm/proc.S b/arch/arm64/mm/proc.S
index e122622838ff3..5b95489152a78 100644
--- a/arch/arm64/mm/proc.S
+++ b/arch/arm64/mm/proc.S
@@ -313,9 +313,7 @@ SYM_TYPED_FUNC_START(idmap_kpti_install_ng_mappings)
 
 	/* Switch to the temporary page tables on this CPU only */
 	__idmap_cpu_set_reserved_ttbr1 x8, x9
-	offset_ttbr1 temp_pgd_phys, x8
-	msr	ttbr1_el1, temp_pgd_phys
-	isb
+	load_ttbr1 temp_pgd_phys, x8, x9
 
 	mov	temp_pte, x5
 	mov_q	pte_flags, KPTI_NG_PTE_FLAGS
-- 
2.47.3




More information about the linux-arm-kernel mailing list