diff options
| author | Borislav Petkov <borislav.petkov@amd.com> | 2010-03-31 15:56:43 -0400 |
|---|---|---|
| committer | H. Peter Anvin <hpa@zytor.com> | 2010-04-09 17:05:50 -0400 |
| commit | d65ad45cd82a0db9544469b8c54f5dc5cafbb2d8 (patch) | |
| tree | 35055e3261c6c75e0d5bd6df00603233f8f47fea | |
| parent | 73860c6b2fd159a35637e233d735e36887c266ad (diff) | |
x86: Unify APERF/MPERF support
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>
| -rw-r--r-- | arch/x86/kernel/cpu/addon_cpuid_features.c | 8 | ||||
| -rw-r--r-- | arch/x86/kernel/cpu/intel.c | 6 |
2 files changed, 8 insertions, 6 deletions
diff --git a/arch/x86/kernel/cpu/addon_cpuid_features.c b/arch/x86/kernel/cpu/addon_cpuid_features.c index ead2a1cfa570..fd1fc1902a47 100644 --- a/arch/x86/kernel/cpu/addon_cpuid_features.c +++ b/arch/x86/kernel/cpu/addon_cpuid_features.c | |||
| @@ -54,6 +54,14 @@ void __cpuinit init_scattered_cpuid_features(struct cpuinfo_x86 *c) | |||
| 54 | if (regs[cb->reg] & (1 << cb->bit)) | 54 | if (regs[cb->reg] & (1 << cb->bit)) |
| 55 | set_cpu_cap(c, cb->feature); | 55 | set_cpu_cap(c, cb->feature); |
| 56 | } | 56 | } |
| 57 | |||
| 58 | /* | ||
| 59 | * common AMD/Intel features | ||
| 60 | */ | ||
| 61 | if (c->cpuid_level >= 6) { | ||
| 62 | if (cpuid_ecx(6) & 0x1) | ||
| 63 | set_cpu_cap(c, X86_FEATURE_APERFMPERF); | ||
| 64 | } | ||
| 57 | } | 65 | } |
| 58 | 66 | ||
| 59 | /* leaf 0xb SMT level */ | 67 | /* leaf 0xb SMT level */ |
diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c index 7e1cca13af35..3830258a5f53 100644 --- a/arch/x86/kernel/cpu/intel.c +++ b/arch/x86/kernel/cpu/intel.c | |||
| @@ -352,12 +352,6 @@ static void __cpuinit init_intel(struct cpuinfo_x86 *c) | |||
| 352 | set_cpu_cap(c, X86_FEATURE_ARCH_PERFMON); | 352 | set_cpu_cap(c, X86_FEATURE_ARCH_PERFMON); |
| 353 | } | 353 | } |
| 354 | 354 | ||
| 355 | if (c->cpuid_level > 6) { | ||
| 356 | unsigned ecx = cpuid_ecx(6); | ||
| 357 | if (ecx & 0x01) | ||
| 358 | set_cpu_cap(c, X86_FEATURE_APERFMPERF); | ||
| 359 | } | ||
| 360 | |||
| 361 | if (cpu_has_xmm2) | 355 | if (cpu_has_xmm2) |
| 362 | set_cpu_cap(c, X86_FEATURE_LFENCE_RDTSC); | 356 | set_cpu_cap(c, X86_FEATURE_LFENCE_RDTSC); |
| 363 | if (cpu_has_ds) { | 357 | if (cpu_has_ds) { |
