WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] Add support for AMD MPERF/APERF

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] Add support for AMD MPERF/APERF
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 09 Apr 2010 01:00:35 -0700
Delivery-date: Fri, 09 Apr 2010 01:04:43 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1270799633 -3600
# Node ID b44a4f9b9a62ab28074b31a68b0c53a2ec722955
# Parent  b432d7d9be925265d1b2de054fd84a9b2589b486
Add support for AMD MPERF/APERF

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.  max_freq is taken from the policy definition
instead of being a private argument in struct acpi_cpufreq_data.
The struct member is entirely removed from the function since it
is no longer used.

Signed-off-by: Mark Langsdorf <mark.langsdorf@xxxxxxx>
---
 xen/arch/x86/acpi/cpufreq/cpufreq.c       |    5 ++---
 xen/arch/x86/acpi/cpufreq/powernow.c      |    7 +++++++
 xen/include/acpi/cpufreq/cpufreq.h        |    1 -
 xen/include/acpi/cpufreq/processor_perf.h |    1 +
 4 files changed, 10 insertions(+), 4 deletions(-)

diff -r b432d7d9be92 -r b44a4f9b9a62 xen/arch/x86/acpi/cpufreq/cpufreq.c
--- a/xen/arch/x86/acpi/cpufreq/cpufreq.c       Fri Apr 09 08:53:19 2010 +0100
+++ b/xen/arch/x86/acpi/cpufreq/cpufreq.c       Fri Apr 09 08:53:53 2010 +0100
@@ -269,7 +269,7 @@ static void read_measured_perf_ctrs(void
  * 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 @@ static unsigned int get_measured_perf(un
 
 #endif
 
-    retval = drv_data[policy->cpu]->max_freq * perf_percent / 100;
+    retval = policy->cpuinfo.max_freq * perf_percent / 100;
 
     return retval;
 }
@@ -582,7 +582,6 @@ acpi_cpufreq_cpu_init(struct cpufreq_pol
 
     policy->governor = cpufreq_opt_governor ? : CPUFREQ_DEFAULT_GOVERNOR;
 
-    data->max_freq = perf->states[0].core_frequency * 1000;
     /* table init */
     for (i=0; i<perf->state_count; i++) {
         if (i>0 && perf->states[i].core_frequency >=
diff -r b432d7d9be92 -r b44a4f9b9a62 xen/arch/x86/acpi/cpufreq/powernow.c
--- a/xen/arch/x86/acpi/cpufreq/powernow.c      Fri Apr 09 08:53:19 2010 +0100
+++ b/xen/arch/x86/acpi/cpufreq/powernow.c      Fri Apr 09 08:53:53 2010 +0100
@@ -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 @@ struct powernow_cpufreq_data {
 
 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 @@ static int powernow_cpufreq_cpu_init(str
 
     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;
diff -r b432d7d9be92 -r b44a4f9b9a62 xen/include/acpi/cpufreq/cpufreq.h
--- a/xen/include/acpi/cpufreq/cpufreq.h        Fri Apr 09 08:53:19 2010 +0100
+++ b/xen/include/acpi/cpufreq/cpufreq.h        Fri Apr 09 08:53:53 2010 +0100
@@ -29,7 +29,6 @@ struct acpi_cpufreq_data {
 struct acpi_cpufreq_data {
     struct processor_performance *acpi_data;
     struct cpufreq_frequency_table *freq_table;
-    unsigned int max_freq;
     unsigned int cpu_feature;
 };
 
diff -r b432d7d9be92 -r b44a4f9b9a62 xen/include/acpi/cpufreq/processor_perf.h
--- a/xen/include/acpi/cpufreq/processor_perf.h Fri Apr 09 08:53:19 2010 +0100
+++ b/xen/include/acpi/cpufreq/processor_perf.h Fri Apr 09 08:53:53 2010 +0100
@@ -9,6 +9,7 @@ int get_cpu_id(u8);
 int get_cpu_id(u8);
 int powernow_cpufreq_init(void);
 unsigned int powernow_register_driver(void);
+unsigned int get_measured_perf(unsigned int cpu, unsigned int flag);
 void cpufreq_residency_update(unsigned int, uint8_t);
 void cpufreq_statistic_update(unsigned int, uint8_t, uint8_t);
 int  cpufreq_statistic_init(unsigned int);

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] Add support for AMD MPERF/APERF, Xen patchbot-unstable <=