[RFC 12/12] arm64: tlbid: Add documentation
Kristina Martšenko
kristina.martsenko at arm.com
Thu Oct 1 04:06:55 PDT 2026
Add documentation to describe how the kernel manages TLBI domains. The
bitmap approach is based on ideas from Miko Lenczewski.
Also document booting requirements for TLBI domains.
Signed-off-by: Kristina Martšenko <kristina.martsenko at arm.com>
---
Documentation/arch/arm64/booting.rst | 10 ++++++++++
arch/arm64/mm/tlbid.c | 18 ++++++++++++++++++
2 files changed, 28 insertions(+)
diff --git a/Documentation/arch/arm64/booting.rst b/Documentation/arch/arm64/booting.rst
index 13ef311dace8..6a2c46cc4b22 100644
--- a/Documentation/arch/arm64/booting.rst
+++ b/Documentation/arch/arm64/booting.rst
@@ -568,6 +568,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/mm/tlbid.c b/arch/arm64/mm/tlbid.c
index c748e710e2ee..2b3e41e6ac22 100644
--- a/arch/arm64/mm/tlbid.c
+++ b/arch/arm64/mm/tlbid.c
@@ -19,6 +19,24 @@
#include <asm/mmu.h>
+/*
+ * FEAT_TLBID enables a TLB invalidation to target a subset of CPUs instead of
+ * the whole Inner Shareable domain. It can improve performance on systems with
+ * many CPUs.
+ *
+ * A system with FEAT_TLBID contains a number of TLBI domains. Each domain
+ * contains a number of CPUs. Domain 0 is always present and contains all CPUs.
+ *
+ * For each CPU we maintain a bitmap of domains that the CPU belongs to. For
+ * each mm we maintain a bitmap of domains that contain all the CPUs that the
+ * mm has been installed on. When an mm is installed on a new CPU we reduce its
+ * bitmap to only include domains that include the new CPU.
+ *
+ * When issuing a TLBI we use the smallest domain for the mm instead of
+ * broadcasting to all CPUs. The domain bitmap is ordered by size, with the
+ * highest bit corresponding to the smallest domain.
+ */
+
DEFINE_STATIC_KEY_FALSE(tlbid_enabled);
static u16 *domain_ids;
--
2.43.0
More information about the linux-arm-kernel
mailing list