diff options
author | Keir Fraser <keir.fraser@citrix.com> | 2010-04-09 08:52:43 +0100 |
---|---|---|
committer | Keir Fraser <keir.fraser@citrix.com> | 2010-04-09 08:52:43 +0100 |
commit | 002c5bcdbe112c70718ebc81ba95290210fa7f0d (patch) | |
tree | 79b6f996ecc5d1dd2d5f847acdf4525e4be768e2 /xen/drivers/cpufreq | |
parent | e136054cedf0b8d9395d35b8d3e5334eb514c47d (diff) | |
download | xen-002c5bcdbe112c70718ebc81ba95290210fa7f0d.tar.gz xen-002c5bcdbe112c70718ebc81ba95290210fa7f0d.tar.bz2 xen-002c5bcdbe112c70718ebc81ba95290210fa7f0d.zip |
Refactor Xen Support for Intel Turbo Boost
Refactor the existing code that supports the Intel Turbo feature to
move all the driver specific bits in the cpufreq driver. Create
a tri-state interface for the Turbo feature that can distinguish
amongst enabled Turbo, disabled Turbo, and processors that don't
support Turbo at all.
Signed-off-by: Mark Langsdorf <mark.langsdorf@amd.com>
Diffstat (limited to 'xen/drivers/cpufreq')
-rw-r--r-- | xen/drivers/cpufreq/cpufreq_ondemand.c | 31 | ||||
-rw-r--r-- | xen/drivers/cpufreq/utility.c | 25 |
2 files changed, 25 insertions, 31 deletions
diff --git a/xen/drivers/cpufreq/cpufreq_ondemand.c b/xen/drivers/cpufreq/cpufreq_ondemand.c index 5728a8fbaf..dd4f6c45c1 100644 --- a/xen/drivers/cpufreq/cpufreq_ondemand.c +++ b/xen/drivers/cpufreq/cpufreq_ondemand.c @@ -58,9 +58,6 @@ static struct dbs_tuners { static struct timer dbs_timer[NR_CPUS]; -/* Turbo Mode */ -static int turbo_detected = 0; - int write_ondemand_sampling_rate(unsigned int sampling_rate) { if ( (sampling_rate > MAX_SAMPLING_RATE / MICROSECS(1)) || @@ -111,10 +108,6 @@ static void dbs_check_cpu(struct cpu_dbs_info_s *this_dbs_info) policy = this_dbs_info->cur_policy; max = policy->max; - if (turbo_detected && !this_dbs_info->turbo_enabled) { - if (max > policy->cpuinfo.second_max_freq) - max = policy->cpuinfo.second_max_freq; - } if (unlikely(policy->resume)) { __cpufreq_driver_target(policy, max,CPUFREQ_RELATION_H); @@ -276,7 +269,6 @@ int cpufreq_governor_dbs(struct cpufreq_policy *policy, unsigned int event) } else dbs_tuners_ins.sampling_rate = usr_sampling_rate; } - this_dbs_info->turbo_enabled = 1; dbs_timer_init(this_dbs_info); break; @@ -353,13 +345,6 @@ struct cpufreq_governor cpufreq_gov_dbs = { static int __init cpufreq_gov_dbs_init(void) { -#ifdef CONFIG_X86 - unsigned int eax = cpuid_eax(6); - if ( eax & 0x2 ) { - turbo_detected = 1; - printk(XENLOG_INFO "Turbo Mode detected!\n"); - } -#endif return cpufreq_register_governor(&cpufreq_gov_dbs); } __initcall(cpufreq_gov_dbs_init); @@ -404,19 +389,3 @@ void cpufreq_dbs_timer_resume(void) } } } - -void cpufreq_dbs_enable_turbo(int cpuid) -{ - per_cpu(cpu_dbs_info, cpuid).turbo_enabled = 1; -} - -void cpufreq_dbs_disable_turbo(int cpuid) -{ - per_cpu(cpu_dbs_info, cpuid).turbo_enabled = 0; -} - -unsigned int cpufreq_dbs_get_turbo_status(int cpuid) -{ - return turbo_detected && per_cpu(cpu_dbs_info, cpuid).turbo_enabled; -} - diff --git a/xen/drivers/cpufreq/utility.c b/xen/drivers/cpufreq/utility.c index c730df951f..612f7e0919 100644 --- a/xen/drivers/cpufreq/utility.c +++ b/xen/drivers/cpufreq/utility.c @@ -394,6 +394,31 @@ int cpufreq_driver_getavg(unsigned int cpu, unsigned int flag) return policy->cur; } +void cpufreq_enable_turbo(int cpuid) +{ + struct cpufreq_policy *policy; + + policy = cpufreq_cpu_policy[cpuid]; + if (policy->turbo != CPUFREQ_TURBO_UNSUPPORTED) + policy->turbo = CPUFREQ_TURBO_ENABLED; +} + +void cpufreq_disable_turbo(int cpuid) +{ + struct cpufreq_policy *policy; + + policy = cpufreq_cpu_policy[cpuid]; + if (policy->turbo != CPUFREQ_TURBO_UNSUPPORTED) + policy->turbo = CPUFREQ_TURBO_DISABLED; +} + +int cpufreq_get_turbo_status(int cpuid) +{ + struct cpufreq_policy *policy; + + policy = cpufreq_cpu_policy[cpuid]; + return policy->turbo; +} /********************************************************************* * POLICY * |