For Zhaoxin's PMU enumeration, use parsed CPUID(0xa) instead of a direct
CPUID query and ugly bitwise operations.
Remove comments; the generated bitfield names already make everything clear.
Signed-off-by: Ahmed S. Darwish <darwi@linutronix.de>
---
arch/x86/kernel/cpu/zhaoxin.c | 15 ++++-----------
1 file changed, 4 insertions(+), 11 deletions(-)
diff --git a/arch/x86/kernel/cpu/zhaoxin.c b/arch/x86/kernel/cpu/zhaoxin.c
index ea76e9594453..b068922efed9 100644
--- a/arch/x86/kernel/cpu/zhaoxin.c
+++ b/arch/x86/kernel/cpu/zhaoxin.c
@@ -61,20 +61,13 @@ static void early_init_zhaoxin(struct cpuinfo_x86 *c)
static void init_zhaoxin(struct cpuinfo_x86 *c)
{
+ const struct leaf_0xa_0 *la = cpuid_leaf(c, 0xa);
+
early_init_zhaoxin(c);
init_intel_cacheinfo(c);
- if (c->cpuid_level > 9) {
- unsigned int eax = cpuid_eax(10);
-
- /*
- * Check for version and the number of counters
- * Version(eax[7:0]) can't be 0;
- * Counters(eax[15:8]) should be greater than 1;
- */
- if ((eax & 0xff) && (((eax >> 8) & 0xff) > 1))
- set_cpu_cap(c, X86_FEATURE_ARCH_PERFMON);
- }
+ if (la && la->pmu_version && la->num_counters_gp > 1)
+ set_cpu_cap(c, X86_FEATURE_ARCH_PERFMON);
if (c->x86 >= 0x6)
init_zhaoxin_cap(c);
--
2.53.0