Commit 8a92d663 authored by Dave Jones's avatar Dave Jones Committed by Dave Jones

[CPUFREQ] Add p4-clockmod ->get

p4-clockmod is a bit more complicated as it might run on SMP, HT, and
the instructions need to run on the specific (physical) CPU.
parent 0344b7bf
......@@ -252,6 +252,43 @@ static int cpufreq_p4_cpu_exit(struct cpufreq_policy *policy)
return 0;
}
static unsigned int cpufreq_p4_get(unsigned int cpu)
{
unsigned int hyperthreading;
cpumask_t cpus_allowed, affected_cpu_map;
u32 l, h;
hyperthreading = 0;
/* only run on CPU to be set, or on its sibling */
cpus_allowed = current->cpus_allowed;
affected_cpu_map = cpumask_of_cpu(cpu);
#ifdef CONFIG_X86_HT
hyperthreading = ((cpu_has_ht) && (smp_num_siblings == 2));
if (hyperthreading) {
sibling = cpu_sibling_map[cpu];
cpu_set(sibling, affected_cpu_map);
}
#endif
set_cpus_allowed(current, affected_cpu_map);
BUG_ON(!cpu_isset(smp_processor_id(), affected_cpu_map));
rdmsr(MSR_IA32_THERM_CONTROL, l, h);
set_cpus_allowed(current, cpus_allowed);
if (l & 0x10) {
l = l >> 1;
l &= 0x7;
} else
l = DC_DISABLE;
if (l != DC_DISABLE)
return (stock_freq * l / 8);
return stock_freq;
}
static struct freq_attr* p4clockmod_attr[] = {
&cpufreq_freq_attr_scaling_available_freqs,
NULL,
......@@ -262,6 +299,7 @@ static struct cpufreq_driver p4clockmod_driver = {
.target = cpufreq_p4_target,
.init = cpufreq_p4_cpu_init,
.exit = cpufreq_p4_cpu_exit,
.get = cpufreq_p4_get,
.name = "p4-clockmod",
.owner = THIS_MODULE,
.attr = p4clockmod_attr,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment