[RFC v2 02/13] arm64: boot: Handle TLBID boot requirements

Kristina Martšenko kristina.martsenko at arm.com
Thu Nov 26 03:49:25 PST 2026


To use FEAT_TLBID, some configuration is necessary at EL3 and EL2. This
patch documents the requirements and adds the initial EL2 setup code,
which enables the kernel to access the TLBIDIDR_EL1 register at EL1.

Signed-off-by: Kristina Martšenko <kristina.martsenko at arm.com>
---
 Documentation/arch/arm64/booting.rst | 10 ++++++++++
 arch/arm64/include/asm/el2_setup.h   | 10 +++++++++-
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/Documentation/arch/arm64/booting.rst b/Documentation/arch/arm64/booting.rst
index dae5ff9fae26..752917bf62c3 100644
--- a/Documentation/arch/arm64/booting.rst
+++ b/Documentation/arch/arm64/booting.rst
@@ -569,6 +569,16 @@ Before jumping into the kernel, the following conditions must be met:
 
     - HCRX_EL2.EnASR (bit 2) must be initialised to 0b1.
 
+  For CPUs with TLBI domains (FEAT_TLBID):
+
+  - If EL3 is present and the kernel is entered at EL2:
+
+    - SCR_EL3.VTLBIDEn (bit 56) must be initialised to 0b1.
+
+  - If EL2 is present and the kernel is entered at EL1:
+
+    - HFGRTR2_EL2.nTLBIDIDR_EL1 (bit 30) must be initialised to 0b1.
+
 The requirements described above for CPU mode, caches, MMUs, architected
 timers, coherency and system registers apply to all CPUs.  All CPUs must
 enter the kernel in the same exception level.  Where the values documented
diff --git a/arch/arm64/include/asm/el2_setup.h b/arch/arm64/include/asm/el2_setup.h
index 12a500181291..1521c9965ae3 100644
--- a/arch/arm64/include/asm/el2_setup.h
+++ b/arch/arm64/include/asm/el2_setup.h
@@ -448,7 +448,15 @@
 .Lskip_spefds_\@:
 	msr_s   SYS_HDFGRTR2_EL2, x0
 	msr_s   SYS_HDFGWTR2_EL2, x2
-	msr_s   SYS_HFGRTR2_EL2, xzr
+
+	mov	x0, xzr
+	mrs_s	x1, SYS_ID_AA64MMFR4_EL1
+	ubfx	x1, x1, #ID_AA64MMFR4_EL1_TLBID_SHIFT, #ID_AA64MMFR4_EL1_TLBID_WIDTH
+	cbz	x1, .Lskip_tlbid_\@
+	orr	x0, x0, #HFGRTR2_EL2_nTLBIDIDR_EL1
+
+.Lskip_tlbid_\@:
+	msr_s   SYS_HFGRTR2_EL2, x0
 	msr_s   SYS_HFGWTR2_EL2, xzr
 	msr_s   SYS_HFGITR2_EL2, xzr
 .Lskip_fgt2_\@:
-- 
2.43.0




More information about the linux-arm-kernel mailing list