arm64: Detect the ARMv8.4 TTL feature
authorMarc Zyngier <maz@kernel.org>
Sat, 22 Dec 2018 12:00:10 +0000 (12:00 +0000)
committerMarc Zyngier <maz@kernel.org>
Tue, 7 Jul 2020 08:27:14 +0000 (09:27 +0100)
In order to reduce the cost of TLB invalidation, the ARMv8.4 TTL
feature allows TLBs to be issued with a level allowing for quicker
invalidation.

Let's detect the feature for now. Further patches will implement
its actual usage.

Reviewed-by : Suzuki K Polose <suzuki.poulose@arm.com>
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
arch/arm64/include/asm/cpucaps.h
arch/arm64/include/asm/sysreg.h
arch/arm64/kernel/cpufeature.c

index d7b3bb0cb180462fa260eaf58f49117760a020ea..d44ba903d11d653dba6c5c0a66803724dca770b5 100644 (file)
@@ -62,7 +62,8 @@
 #define ARM64_HAS_GENERIC_AUTH                 52
 #define ARM64_HAS_32BIT_EL1                    53
 #define ARM64_BTI                              54
+#define ARM64_HAS_ARMv8_4_TTL                  55
 
-#define ARM64_NCAPS                            55
+#define ARM64_NCAPS                            56
 
 #endif /* __ASM_CPUCAPS_H */
index 463175f80341f98b7ae4ad7bfe78d60b55ea5d59..8c209aa1727376f610c7e8357ba630a44f89f403 100644 (file)
 
 /* id_aa64mmfr2 */
 #define ID_AA64MMFR2_E0PD_SHIFT                60
+#define ID_AA64MMFR2_TTL_SHIFT         48
 #define ID_AA64MMFR2_FWB_SHIFT         40
 #define ID_AA64MMFR2_AT_SHIFT          32
 #define ID_AA64MMFR2_LVA_SHIFT         16
index 9f63053a63a981efffb0192b697d99aac825e779..e877f56ff1ab9914cbdc96748b789980cbc2ecd1 100644 (file)
@@ -323,6 +323,7 @@ static const struct arm64_ftr_bits ftr_id_aa64mmfr1[] = {
 
 static const struct arm64_ftr_bits ftr_id_aa64mmfr2[] = {
        ARM64_FTR_BITS(FTR_HIDDEN, FTR_NONSTRICT, FTR_LOWER_SAFE, ID_AA64MMFR2_E0PD_SHIFT, 4, 0),
+       ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_LOWER_SAFE, ID_AA64MMFR2_TTL_SHIFT, 4, 0),
        ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_LOWER_SAFE, ID_AA64MMFR2_FWB_SHIFT, 4, 0),
        ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_LOWER_SAFE, ID_AA64MMFR2_AT_SHIFT, 4, 0),
        ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_LOWER_SAFE, ID_AA64MMFR2_LVA_SHIFT, 4, 0),
@@ -1882,6 +1883,16 @@ static const struct arm64_cpu_capabilities arm64_features[] = {
                .matches = has_cpuid_feature,
                .cpu_enable = cpu_has_fwb,
        },
+       {
+               .desc = "ARMv8.4 Translation Table Level",
+               .type = ARM64_CPUCAP_SYSTEM_FEATURE,
+               .capability = ARM64_HAS_ARMv8_4_TTL,
+               .sys_reg = SYS_ID_AA64MMFR2_EL1,
+               .sign = FTR_UNSIGNED,
+               .field_pos = ID_AA64MMFR2_TTL_SHIFT,
+               .min_field_value = 1,
+               .matches = has_cpuid_feature,
+       },
 #ifdef CONFIG_ARM64_HW_AFDBM
        {
                /*