aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
diff options
context:
space:
mode:
authorMark Langsdorf <mark.langsdorf@amd.com>2010-03-18 13:41:46 -0400
committerH. Peter Anvin <hpa@zytor.com>2010-04-09 17:07:40 -0400
commita2fed573f065e526bfd5cbf26e5491973d9e9aaa (patch)
tree069ea4932051dd4535de4bf896e09deff836e0b9 /arch/x86/kernel/cpu/cpufreq/powernow-k8.c
parentd65ad45cd82a0db9544469b8c54f5dc5cafbb2d8 (diff)
x86, cpufreq: Add APERF/MPERF support for AMD processors
Starting with model 10 of Family 0x10, AMD processors may have support for APERF/MPERF. Add support for identifying it and using it within cpufreq. Move the APERF/MPERF functions out of the acpi-cpufreq code and into their own file so they can easily be shared. Signed-off-by: Mark Langsdorf <mark.langsdorf@amd.com> LKML-Reference: <20100401141956.GA1930@aftab> Signed-off-by: Borislav Petkov <borislav.petkov@amd.com> Reviewed-by: Thomas Renninger <trenn@suse.de> Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'arch/x86/kernel/cpu/cpufreq/powernow-k8.c')
-rw-r--r--arch/x86/kernel/cpu/cpufreq/powernow-k8.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/arch/x86/kernel/cpu/cpufreq/powernow-k8.c b/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
index 74ca34b5c00..52fce638f44 100644
--- a/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
+++ b/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
@@ -45,6 +45,7 @@
45#define PFX "powernow-k8: " 45#define PFX "powernow-k8: "
46#define VERSION "version 2.20.00" 46#define VERSION "version 2.20.00"
47#include "powernow-k8.h" 47#include "powernow-k8.h"
48#include "mperf.h"
48 49
49/* serialize freq changes */ 50/* serialize freq changes */
50static DEFINE_MUTEX(fidvid_mutex); 51static DEFINE_MUTEX(fidvid_mutex);
@@ -57,6 +58,8 @@ static int cpu_family = CPU_OPTERON;
57static bool cpb_capable, cpb_enabled; 58static bool cpb_capable, cpb_enabled;
58static struct msr __percpu *msrs; 59static struct msr __percpu *msrs;
59 60
61static struct cpufreq_driver cpufreq_amd64_driver;
62
60#ifndef CONFIG_SMP 63#ifndef CONFIG_SMP
61static inline const struct cpumask *cpu_core_mask(int cpu) 64static inline const struct cpumask *cpu_core_mask(int cpu)
62{ 65{
@@ -1251,6 +1254,7 @@ static int __cpuinit powernowk8_cpu_init(struct cpufreq_policy *pol)
1251 struct powernow_k8_data *data; 1254 struct powernow_k8_data *data;
1252 struct init_on_cpu init_on_cpu; 1255 struct init_on_cpu init_on_cpu;
1253 int rc; 1256 int rc;
1257 struct cpuinfo_x86 *c = &cpu_data(pol->cpu);
1254 1258
1255 if (!cpu_online(pol->cpu)) 1259 if (!cpu_online(pol->cpu))
1256 return -ENODEV; 1260 return -ENODEV;
@@ -1325,6 +1329,10 @@ static int __cpuinit powernowk8_cpu_init(struct cpufreq_policy *pol)
1325 return -EINVAL; 1329 return -EINVAL;
1326 } 1330 }
1327 1331
1332 /* Check for APERF/MPERF support in hardware */
1333 if (cpu_has(c, X86_FEATURE_APERFMPERF))
1334 cpufreq_amd64_driver.getavg = cpufreq_get_measured_perf;
1335
1328 cpufreq_frequency_table_get_attr(data->powernow_table, pol->cpu); 1336 cpufreq_frequency_table_get_attr(data->powernow_table, pol->cpu);
1329 1337
1330 if (cpu_family == CPU_HW_PSTATE) 1338 if (cpu_family == CPU_HW_PSTATE)