arm64: Add HAS_ECV_CNTPOFF capability
authorMarc Zyngier <maz@kernel.org>
Thu, 30 Mar 2023 17:47:43 +0000 (18:47 +0100)
committerMarc Zyngier <maz@kernel.org>
Thu, 30 Mar 2023 18:01:09 +0000 (19:01 +0100)
Add the probing code for the FEAT_ECV variant that implements CNTPOFF_EL2.
Why it is optional is a mystery, but let's try and detect it.

Reviewed-by: Reiji Watanabe <reijiw@google.com>
Reviewed-by: Colton Lewis <coltonlewis@google.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20230330174800.2677007-4-maz@kernel.org
arch/arm64/kernel/cpufeature.c
arch/arm64/tools/cpucaps

index 2e3e5513977733b7a324c4263218be2bfbeef580..c331c49a7d19c82417db648f82252c449c8eadf5 100644 (file)
@@ -2223,6 +2223,17 @@ static const struct arm64_cpu_capabilities arm64_features[] = {
                .sign = FTR_UNSIGNED,
                .min_field_value = 1,
        },
+       {
+               .desc = "Enhanced Counter Virtualization (CNTPOFF)",
+               .capability = ARM64_HAS_ECV_CNTPOFF,
+               .type = ARM64_CPUCAP_SYSTEM_FEATURE,
+               .matches = has_cpuid_feature,
+               .sys_reg = SYS_ID_AA64MMFR0_EL1,
+               .field_pos = ID_AA64MMFR0_EL1_ECV_SHIFT,
+               .field_width = 4,
+               .sign = FTR_UNSIGNED,
+               .min_field_value = ID_AA64MMFR0_EL1_ECV_CNTPOFF,
+       },
 #ifdef CONFIG_ARM64_PAN
        {
                .desc = "Privileged Access Never",
index 37b1340e964664111b8d785d78dea3c2892d78a1..40ba95472594db7f053ec19b0d10af5088991e95 100644 (file)
@@ -23,6 +23,7 @@ HAS_DCPOP
 HAS_DIT
 HAS_E0PD
 HAS_ECV
+HAS_ECV_CNTPOFF
 HAS_EPAN
 HAS_GENERIC_AUTH
 HAS_GENERIC_AUTH_ARCH_QARMA3