ia64/xen-unstable

changeset 18532:415c3da25b26

x86: fix powernow

... by allocating the necessary cpufreq_policy structures.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
author Keir Fraser <keir.fraser@citrix.com>
date Mon Sep 22 15:56:12 2008 +0100 (2008-09-22)
parents 81483e49c74c
children 0c8d2e44126d
files xen/arch/x86/acpi/cpufreq/powernow.c
line diff
     1.1 --- a/xen/arch/x86/acpi/cpufreq/powernow.c	Mon Sep 22 15:50:59 2008 +0100
     1.2 +++ b/xen/arch/x86/acpi/cpufreq/powernow.c	Mon Sep 22 15:56:12 2008 +0100
     1.3 @@ -283,9 +283,27 @@ int powernow_cpufreq_init(void)
     1.4  
     1.5      /* setup cpufreq infrastructure */
     1.6      for_each_online_cpu(i) {
     1.7 -        cpufreq_cpu_policy[i]->cpu = i;
     1.8 +        struct cpufreq_policy *policy = cpufreq_cpu_policy[i];
     1.9  
    1.10 -        ret = powernow_cpufreq_cpu_init(cpufreq_cpu_policy[i]);
    1.11 +        if (!policy) {
    1.12 +            unsigned int firstcpu;
    1.13 +
    1.14 +            firstcpu = first_cpu(processor_pminfo[i]->perf.shared_cpu_map);
    1.15 +            if (i == firstcpu) {
    1.16 +                policy = xmalloc(struct cpufreq_policy);
    1.17 +                if (!policy) {
    1.18 +                    ret = -ENOMEM;
    1.19 +                    goto cpufreq_init_out;
    1.20 +                }
    1.21 +                memset(policy, 0, sizeof(struct cpufreq_policy));
    1.22 +                policy->cpu = i;
    1.23 +            } else
    1.24 +                policy = cpufreq_cpu_policy[firstcpu];
    1.25 +            cpu_set(i, policy->cpus);
    1.26 +            cpufreq_cpu_policy[i] = policy;
    1.27 +        }
    1.28 +
    1.29 +        ret = powernow_cpufreq_cpu_init(policy);
    1.30          if (ret)
    1.31              goto cpufreq_init_out;
    1.32      }