x86: Unify APERF/MPERF support
authorBorislav Petkov <borislav.petkov@amd.com>
Wed, 31 Mar 2010 19:56:43 +0000 (21:56 +0200)
committerH. Peter Anvin <hpa@zytor.com>
Fri, 9 Apr 2010 21:05:50 +0000 (14:05 -0700)
Initialize this CPUID flag feature in common code. It could be made a
standalone function later, maybe, if more functionality is duplicated.

Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
LKML-Reference: <1270065406-1814-4-git-send-email-bp@amd64.org>
Reviewed-by: Thomas Renninger <trenn@suse.de>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
arch/x86/kernel/cpu/addon_cpuid_features.c
arch/x86/kernel/cpu/intel.c

index ead2a1cfa570bc01ae4551301dcddddefae11740..fd1fc1902a4744d6e77f6ee3d9a8cc6cc0bfc6e1 100644 (file)
@@ -54,6 +54,14 @@ void __cpuinit init_scattered_cpuid_features(struct cpuinfo_x86 *c)
                if (regs[cb->reg] & (1 << cb->bit))
                        set_cpu_cap(c, cb->feature);
        }
+
+       /*
+        * common AMD/Intel features
+        */
+       if (c->cpuid_level >= 6) {
+               if (cpuid_ecx(6) & 0x1)
+                       set_cpu_cap(c, X86_FEATURE_APERFMPERF);
+       }
 }
 
 /* leaf 0xb SMT level */
index 7e1cca13af3589a562d26c0ead4a2a3c1474c129..3830258a5f53a508496ab2082971de2445a78b5f 100644 (file)
@@ -352,12 +352,6 @@ static void __cpuinit init_intel(struct cpuinfo_x86 *c)
                        set_cpu_cap(c, X86_FEATURE_ARCH_PERFMON);
        }
 
-       if (c->cpuid_level > 6) {
-               unsigned ecx = cpuid_ecx(6);
-               if (ecx & 0x01)
-                       set_cpu_cap(c, X86_FEATURE_APERFMPERF);
-       }
-
        if (cpu_has_xmm2)
                set_cpu_cap(c, X86_FEATURE_LFENCE_RDTSC);
        if (cpu_has_ds) {