3/3 Add support for AMD MPERF/APERF
PATCH 1/1 3/3 Add support for AMD MPERF/APERF
# HG changeset patch
# User [email protected]
# Date 1270061976 18000
# Node ID 9bde2053016569af994540ec11b9fa45d3d1a8d7
# Parent c00eb5a678e61f4da0db7b4bdeab1660060376d2 Starting with Family 0x10, model 10 processors, some AMD processors will have support for the APERF/MPERF MSRs. This patch adds the checks necessary to support those MSRs.
It also makes the get_measured_perf function defined inside cpufreq.c driver independent. The max_freq is passed to the function by the caller instead of being taking from the acpi-cpufreq only drv_data structure.
xen/arch/x86/acpi/cpufreq/cpufreq.c +2 -2
@@ -269,7 +269,7 @@* Only IA32_APERF/IA32_MPERF ratio is architecturally defined and * no meaning should be associated with absolute values of these MSRs. */ -static unsigned int get_measured_perf (unsigned int cpu,unsigned int flag) +unsigned int get_measured_perf (unsigned int cpu,unsigned int flag) {struct cpufreq_policy *policy;struct perf_pair readin, cur, *saved;
@@ -353,7 +353,7 @@#endif - retval = drv_data[policy->cpu]->max_freq * perf_percent /100 ; + retval = policy->cpuinfo.max_freq * perf_percent /100 ;return retval; }
xen/arch/x86/acpi/cpufreq/powernow.c +7 -0
@@ -38,6 +38,7 @@#include <acpi/acpi.h> #include <acpi/cpufreq/cpufreq.h> +#define CPUID_6_ECX_APERFMPERF_CAPABILITY (0x1)#define CPUID_FREQ_VOLT_CAPABILITIES 0x80000007#define CPB_CAPABLE 0x00000200#define USE_HW_PSTATE 0x00000080
@@ -61,6 +62,8 @@static struct powernow_cpufreq_data *drv_data[NR_CPUS ]; +static struct cpufreq_driver powernow_cpufreq_driver; +struct drv_cmd {unsigned int type;cpumask_t mask;
@@ -249,6 +252,10 @@if (c->cpuid_level >=6 ) {unsigned int edx; +unsigned int ecx; + ecx =cpuid_ecx (6 ); +if (ecx &CPUID_6_ECX_APERFMPERF_CAPABILITY ) + powernow_cpufreq_driver.getavg = get_measured_perf; edx =cpuid_edx (CPUID_FREQ_VOLT_CAPABILITIES );if ((edx &CPB_CAPABLE ) ==CPB_CAPABLE ) { policy->turbo =CPUFREQ_TURBO_ENABLED ;
Quoted 15 lines
-----Original Message-----
From: Mark Langsdorf [mailto:[email protected]]
Sent: Thursday, April 01, 2010 3:27 AM
To: [email protected]; Yu, Ke
Subject: [PATCH] [retry 3] 3/3 Add support for AMD MPERF/APERF# HG changeset patch
# User [email protected]
# Date 1270061976 18000
# Node ID9bde2053016569af994540ec11b9fa45d3d1a8d7
# Parentc00eb5a678e61f4da0db7b4bdeab1660060376d2Starting with Family0x10, model 10 processors, some AMD processors will have support for the APERF/MPERF MSRs. This patch adds the checks necessary to support those MSRs.
Quoted 5 lines
It also makes the
get_measured_perffunction defined insidecpufreq.cdriver independent. Themax_freqis passed to the function by the caller instead of being taking from the acpi-cpufreq onlydrv_datastructure.Signed-off-by Mark Langsdorf <[email protected]>
Looks you forget changing the description accordingly :)
Quoted 16 lines
diff -r
c00eb5a678e6-r9bde20530165xen/arch/x86/acpi/cpufreq/cpufreq.c
---a/xen/arch/x86/acpi/cpufreq/cpufreq.cWed Mar 31 13:58:45 2010 -
0500
+++b/xen/arch/x86/acpi/cpufreq/cpufreq.cWed Mar 31 13:59:36
2010 -0500xen/arch/x86/acpi/cpufreq/cpufreq.c +1
-1@@ -269,7 +269,7 @@* Only IA32_APERF/IA32_MPERF ratio is architecturally defined and * no meaning should be associated with absolute values of these MSRs. */ -static unsigned int get_measured_perf (unsigned int cpu,unsigned int flag) +unsigned int get_measured_perf (unsigned int cpu,unsigned int flag) {struct cpufreq_policy *policy;struct perf_pair readin, cur, *saved;
xen/arch/x86/acpi/cpufreq/cpufreq.c line 359
Quoted 8 lines
xen/arch/x86/acpi/cpufreq/cpufreq.c +1
-1@@ -353,7 +353,7 @@#endif - retval = drv_data[policy->cpu]->max_freq * perf_percent /100 ; + retval = policy->cpuinfo.max_freq * perf_percent /100 ;return retval; }
BTW, since drv_data->max_freq is no longer used, could you please remove this filed from "struct acpi_cpufreq_data", and also remove the drv_data->max_freq initialization code.
Best Regards
Ke