[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] x86: Fix RevF detection in powernow.c



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1256289112 -3600
# Node ID 51b031b0737e4371ec2a3e1f37835e7c017d6537
# Parent  b5c6c4a584951a653dca20e168cc40dced1e6bae
x86: Fix RevF detection in powernow.c

The PowerNow! driver does not support RevF and earlier parts.
The current code checks for RevF processors in a function that
is not called.  Change the code path so that RevF processors
are detected and the driver fails registration.

Also fix cpufreq_add_cpu() to handle unsuccessful registration.

Signed-off-by: Mark Langsdorf <mark.langsdorf@xxxxxxx>
---
 xen/arch/x86/acpi/cpufreq/powernow.c |   47 ++++-------------------------------
 xen/drivers/cpufreq/cpufreq.c        |    3 ++
 2 files changed, 9 insertions(+), 41 deletions(-)

diff -r b5c6c4a58495 -r 51b031b0737e xen/arch/x86/acpi/cpufreq/powernow.c
--- a/xen/arch/x86/acpi/cpufreq/powernow.c      Fri Oct 23 10:09:37 2009 +0100
+++ b/xen/arch/x86/acpi/cpufreq/powernow.c      Fri Oct 23 10:11:52 2009 +0100
@@ -274,58 +274,23 @@ static struct cpufreq_driver powernow_cp
 
 unsigned int powernow_register_driver()
 {
-    unsigned int ret;
-    ret = cpufreq_register_driver(&powernow_cpufreq_driver);
-    return ret;
-}
-
-int powernow_cpufreq_init(void)
-{
     unsigned int i, ret = 0;
-    unsigned int max_dom = 0;
-    cpumask_t *pt;
-    unsigned long *dom_mask;
 
     for_each_online_cpu(i) {
         struct cpuinfo_x86 *c = &cpu_data[i];
-       if (c->x86_vendor != X86_VENDOR_AMD)
+        if (c->x86_vendor != X86_VENDOR_AMD)
             ret = -ENODEV;
-        else 
+        else
         {
             u32 eax, ebx, ecx, edx;
             cpuid(CPUID_FREQ_VOLT_CAPABILITIES, &eax, &ebx, &ecx, &edx);
             if ((edx & USE_HW_PSTATE) != USE_HW_PSTATE)
                 ret = -ENODEV;
-       }
+        }
         if (ret)
             return ret;
-        if (max_dom < processor_pminfo[i]->perf.domain_info.domain)
-            max_dom = processor_pminfo[i]->perf.domain_info.domain;
-    }
-    max_dom++;
-
-    dom_mask = xmalloc_array(unsigned long, BITS_TO_LONGS(max_dom));
-    if (!dom_mask)
-        return -ENOMEM;
-    bitmap_zero(dom_mask, max_dom);
-
-    pt = xmalloc_array(cpumask_t, max_dom);
-    if (!pt)
-        return -ENOMEM;
-    memset(pt, 0, max_dom * sizeof(cpumask_t));
-
-    /* get cpumask of each psd domain */
-    for_each_online_cpu(i) {
-        __set_bit(processor_pminfo[i]->perf.domain_info.domain, dom_mask);
-        cpu_set(i, pt[processor_pminfo[i]->perf.domain_info.domain]);
-    }
-
-    for_each_online_cpu(i)
-        processor_pminfo[i]->perf.shared_cpu_map =
-            pt[processor_pminfo[i]->perf.domain_info.domain];
-
-    xfree(pt);
-    xfree(dom_mask);
-   
+    }
+
+    ret = cpufreq_register_driver(&powernow_cpufreq_driver);
     return ret;
 }
diff -r b5c6c4a58495 -r 51b031b0737e xen/drivers/cpufreq/cpufreq.c
--- a/xen/drivers/cpufreq/cpufreq.c     Fri Oct 23 10:09:37 2009 +0100
+++ b/xen/drivers/cpufreq/cpufreq.c     Fri Oct 23 10:11:52 2009 +0100
@@ -143,6 +143,9 @@ int cpufreq_add_cpu(unsigned int cpu)
         !cpu_online(cpu))
         return -EINVAL;
 
+    if (!cpufreq_driver)
+        return 0;
+
     if (cpufreq_cpu_policy[cpu])
         return 0;
 

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.