[PATCH 5/5] arm64: mm: switch to 52-bit ID map on 52-bit VA capable systems

Ard Biesheuvel ardb at kernel.org
Wed Mar 10 17:15:15 GMT 2021


Now that we cleaned up the code a bit, add back the code path to use a
52-bit VA ID map on hardware that is 52-bit VA capable. This removes
a TCR update from the cpuidle path.

At the same time, make the 52-bit VA handling mutually exclusive with
the extended ID map code: a 52-bit VA kernel running on 48-bit VA only
hardware never has a need for it.

Signed-off-by: Ard Biesheuvel <ardb at kernel.org>
---
 arch/arm64/kernel/head.S | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S
index da6e99fa4e08..06f1ddeef821 100644
--- a/arch/arm64/kernel/head.S
+++ b/arch/arm64/kernel/head.S
@@ -303,8 +303,10 @@ SYM_FUNC_START_LOCAL(__create_page_tables)
 	str	x5, [x6]
 	dmb	sy
 	dc	ivac, x6		// Invalidate potentially stale cache line
-#endif
 
+	mov	x5, TCR_T0SZ(VA_BITS)
+	b.eq	1f			// skip VA range extension on !LVA hardware
+#else
 	/*
 	 * VA_BITS may be too small to allow for an ID mapping to be created
 	 * that covers system RAM if that is located sufficiently high in the
@@ -321,6 +323,7 @@ SYM_FUNC_START_LOCAL(__create_page_tables)
 	clz	x5, x5
 	cmp	x5, TCR_T0SZ(VA_BITS_MIN) // default T0SZ small enough?
 	b.ge	1f			// .. then skip VA range extension
+#endif
 
 	adr_l	x6, idmap_t0sz
 	str	x5, [x6]
-- 
2.30.1




More information about the linux-arm-kernel mailing list