Skip to content

Commit 15ed3fa

Browse files
james-c-linarowilldeacon
authored andcommitted
arm64: cpufeature: Use pmuv3_implemented() function
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>
1 parent d1dcc20 commit 15ed3fa

2 files changed

Lines changed: 9 additions & 10 deletions

File tree

arch/arm/include/asm/arm_pmuv3.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,13 @@ static inline void kvm_vcpu_pmu_resync_el0(void) {}
238238

239239
static inline bool pmuv3_implemented(int pmuver)
240240
{
241+
/*
242+
* PMUVer follows the standard ID scheme for an unsigned field with the
243+
* exception of 0xF (IMP_DEF) which is treated specially and implies
244+
* FEAT_PMUv3 is not implemented.
245+
*
246+
* See DDI0487L.a D24.1.3.2 for more details.
247+
*/
241248
return !(pmuver == ARMV8_PMU_DFR_VER_IMP_DEF ||
242249
pmuver == ARMV8_PMU_DFR_VER_NI);
243250
}

arch/arm64/kernel/cpufeature.c

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@
7777
#include <linux/percpu.h>
7878
#include <linux/sched/isolation.h>
7979

80+
#include <asm/arm_pmuv3.h>
8081
#include <asm/cpu.h>
8182
#include <asm/cpufeature.h>
8283
#include <asm/cpu_ops.h>
@@ -1927,19 +1928,10 @@ static bool has_pmuv3(const struct arm64_cpu_capabilities *entry, int scope)
19271928
u64 dfr0 = read_sanitised_ftr_reg(SYS_ID_AA64DFR0_EL1);
19281929
unsigned int pmuver;
19291930

1930-
/*
1931-
* PMUVer follows the standard ID scheme for an unsigned field with the
1932-
* exception of 0xF (IMP_DEF) which is treated specially and implies
1933-
* FEAT_PMUv3 is not implemented.
1934-
*
1935-
* See DDI0487L.a D24.1.3.2 for more details.
1936-
*/
19371931
pmuver = cpuid_feature_extract_unsigned_field(dfr0,
19381932
ID_AA64DFR0_EL1_PMUVer_SHIFT);
1939-
if (pmuver == ID_AA64DFR0_EL1_PMUVer_IMP_DEF)
1940-
return false;
19411933

1942-
return pmuver >= ID_AA64DFR0_EL1_PMUVer_IMP;
1934+
return pmuv3_implemented(pmuver);
19431935
}
19441936
#endif
19451937

0 commit comments

Comments
 (0)