Skip to content

Commit d73c162

Browse files
fvincenzowilldeacon
authored andcommitted
arm64: mte: CPU feature detection for Asymm MTE
Add the cpufeature entries to detect the presence of Asymmetric MTE. Note: The tag checking mode is initialized via cpu_enable_mte() -> kasan_init_hw_tags() hence to enable it we require asymmetric mode to be at least on the boot CPU. If the boot CPU does not have it, it is fine for late CPUs to have it as long as the feature is not enabled (ARM64_CPUCAP_BOOT_CPU_FEATURE). Cc: Will Deacon <[email protected]> Cc: Catalin Marinas <[email protected]> Cc: Suzuki K Poulose <[email protected]> Signed-off-by: Vincenzo Frascino <[email protected]> Reviewed-by: Catalin Marinas <[email protected]> Reviewed-by: Suzuki K Poulose <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
1 parent ba1a98e commit d73c162

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

arch/arm64/kernel/cpufeature.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2321,6 +2321,16 @@ static const struct arm64_cpu_capabilities arm64_features[] = {
23212321
.sign = FTR_UNSIGNED,
23222322
.cpu_enable = cpu_enable_mte,
23232323
},
2324+
{
2325+
.desc = "Asymmetric MTE Tag Check Fault",
2326+
.capability = ARM64_MTE_ASYMM,
2327+
.type = ARM64_CPUCAP_BOOT_CPU_FEATURE,
2328+
.matches = has_cpuid_feature,
2329+
.sys_reg = SYS_ID_AA64PFR1_EL1,
2330+
.field_pos = ID_AA64PFR1_MTE_SHIFT,
2331+
.min_field_value = ID_AA64PFR1_MTE_ASYMM,
2332+
.sign = FTR_UNSIGNED,
2333+
},
23242334
#endif /* CONFIG_ARM64_MTE */
23252335
{
23262336
.desc = "RCpc load-acquire (LDAPR)",

arch/arm64/tools/cpucaps

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ HW_DBM
3939
KVM_PROTECTED_MODE
4040
MISMATCHED_CACHE_TYPE
4141
MTE
42+
MTE_ASYMM
4243
SPECTRE_V2
4344
SPECTRE_V3A
4445
SPECTRE_V4

0 commit comments

Comments
 (0)