]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
arm64: cpufeature: Use pmuv3_implemented() function
authorJames Clark <james.clark@linaro.org>
Thu, 5 Mar 2026 16:28:19 +0000 (16:28 +0000)
committerWill Deacon <will@kernel.org>
Tue, 24 Mar 2026 12:33:49 +0000 (12:33 +0000)
Other places that are doing this version comparison are already using
pmuv3_implemented(), so might as well use it here too for consistency.

Signed-off-by: James Clark <james.clark@linaro.org>
Reviewed-by: Marc Zyngier <maz@kernel.org>
Reviewed-by: Colton Lewis <coltonlewis@google.com>
Signed-off-by: Will Deacon <will@kernel.org>
arch/arm/include/asm/arm_pmuv3.h
arch/arm64/kernel/cpufeature.c

index 2ec0e5e83fc98fb811990e0692e038d5cb9a6e93..ecfede0c034868f1f366755d5637633f4bf973a7 100644 (file)
@@ -238,6 +238,13 @@ static inline void kvm_vcpu_pmu_resync_el0(void) {}
 
 static inline bool pmuv3_implemented(int pmuver)
 {
+       /*
+        * PMUVer follows the standard ID scheme for an unsigned field with the
+        * exception of 0xF (IMP_DEF) which is treated specially and implies
+        * FEAT_PMUv3 is not implemented.
+        *
+        * See DDI0487L.a D24.1.3.2 for more details.
+        */
        return !(pmuver == ARMV8_PMU_DFR_VER_IMP_DEF ||
                 pmuver == ARMV8_PMU_DFR_VER_NI);
 }
index 07abdfd407569fc2254ced6f67ea60cb15d153c2..cc9783b264434ef65143b50c9d67c4af980cf82f 100644 (file)
@@ -77,6 +77,7 @@
 #include <linux/percpu.h>
 #include <linux/sched/isolation.h>
 
+#include <asm/arm_pmuv3.h>
 #include <asm/cpu.h>
 #include <asm/cpufeature.h>
 #include <asm/cpu_ops.h>
@@ -1927,19 +1928,10 @@ static bool has_pmuv3(const struct arm64_cpu_capabilities *entry, int scope)
        u64 dfr0 = read_sanitised_ftr_reg(SYS_ID_AA64DFR0_EL1);
        unsigned int pmuver;
 
-       /*
-        * PMUVer follows the standard ID scheme for an unsigned field with the
-        * exception of 0xF (IMP_DEF) which is treated specially and implies
-        * FEAT_PMUv3 is not implemented.
-        *
-        * See DDI0487L.a D24.1.3.2 for more details.
-        */
        pmuver = cpuid_feature_extract_unsigned_field(dfr0,
                                                      ID_AA64DFR0_EL1_PMUVer_SHIFT);
-       if (pmuver == ID_AA64DFR0_EL1_PMUVer_IMP_DEF)
-               return false;
 
-       return pmuver >= ID_AA64DFR0_EL1_PMUVer_IMP;
+       return pmuv3_implemented(pmuver);
 }
 #endif