mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Fuad Tabba <fuad.tabba@linux.dev>
To: Catalin Marinas <catalin.marinas@arm.com>, Will Deacon <will@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>,
	Ard Biesheuvel <ardb@kernel.org>,
	Ryan Roberts <ryan.roberts@arm.com>,
	Anshuman Khandual <anshuman.khandual@arm.com>,
	Kevin Brodsky <kevin.brodsky@arm.com>,
	Vladimir Murzin <vladimir.murzin@arm.com>,
	Carl Worth <carl@os.amperecomputing.com>,
	Linu Cherian <linu.cherian@arm.com>,
	Yeoreum Yun <yeoreum.yun@arm.com>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, Fuad Tabba <tabba@google.com>
Subject: [PATCH 2/2] arm64: mm: Convert the temporary KPTI pgd address for TTBR1_EL1
Date: Thu,  3 Dec 2026 13:25:17 +0000	[thread overview]
Message-ID: <20261203132517.428942-3-fuad.tabba@linux.dev> (raw)
In-Reply-To: <20261203132517.428942-1-fuad.tabba@linux.dev>

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@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


  parent reply	other threads:[~2026-12-03 13:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03 13:25 [PATCH 0/2] arm64: mm: Fix a TLBI operand and a TTBR1 write in the KPTI nG rewrite Fuad Tabba
2026-12-03 13:25 ` [PATCH 1/2] arm64: mm: Mask the TLBI operand in kpti_map_pgtbl() Fuad Tabba
2026-12-03 13:25 ` Fuad Tabba [this message]
2026-12-03 14:28 ` [PATCH 0/2] arm64: mm: Fix a TLBI operand and a TTBR1 write in the KPTI nG rewrite Ard Biesheuvel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261203132517.428942-3-fuad.tabba@linux.dev \
    --to=fuad.tabba@linux.dev \
    --cc=anshuman.khandual@arm.com \
    --cc=ardb@kernel.org \
    --cc=carl@os.amperecomputing.com \
    --cc=catalin.marinas@arm.com \
    --cc=kevin.brodsky@arm.com \
    --cc=linu.cherian@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=ryan.roberts@arm.com \
    --cc=tabba@google.com \
    --cc=vladimir.murzin@arm.com \
    --cc=will@kernel.org \
    --cc=yeoreum.yun@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®