diff options
author | Alexey Dobriyan <adobriyan@sw.ru> | 2007-03-19 12:17:00 -0400 |
---|---|---|
committer | Dave Jones <davej@redhat.com> | 2007-04-26 14:32:02 -0400 |
commit | 551948bc44260a5ab3ad63546506b2062f77eaa0 (patch) | |
tree | f3865de6d8b63a26726f5e3522d033fbfa4abd4c /arch | |
parent | de46c33745f5e2ad594c72f2cf5f490861b16ce1 (diff) |
[CPUFREQ] p4-clockmod: switch to rdmsr_on_cpu/wrmsr_on_cpu
Dances with cpumasks go away.
Signed-off-by: Alexey Dobriyan <adobriyan@sw.ru>
Signed-off-by: Dave Jones <davej@redhat.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/i386/kernel/cpu/cpufreq/p4-clockmod.c | 31 |
1 files changed, 6 insertions, 25 deletions
diff --git a/arch/i386/kernel/cpu/cpufreq/p4-clockmod.c b/arch/i386/kernel/cpu/cpufreq/p4-clockmod.c index 4786fedca6eb..4c76b511e194 100644 --- a/arch/i386/kernel/cpu/cpufreq/p4-clockmod.c +++ b/arch/i386/kernel/cpu/cpufreq/p4-clockmod.c | |||
@@ -27,7 +27,6 @@ | |||
27 | #include <linux/cpufreq.h> | 27 | #include <linux/cpufreq.h> |
28 | #include <linux/slab.h> | 28 | #include <linux/slab.h> |
29 | #include <linux/cpumask.h> | 29 | #include <linux/cpumask.h> |
30 | #include <linux/sched.h> /* current / set_cpus_allowed() */ | ||
31 | 30 | ||
32 | #include <asm/processor.h> | 31 | #include <asm/processor.h> |
33 | #include <asm/msr.h> | 32 | #include <asm/msr.h> |
@@ -62,7 +61,7 @@ static int cpufreq_p4_setdc(unsigned int cpu, unsigned int newstate) | |||
62 | if (!cpu_online(cpu) || (newstate > DC_DISABLE) || (newstate == DC_RESV)) | 61 | if (!cpu_online(cpu) || (newstate > DC_DISABLE) || (newstate == DC_RESV)) |
63 | return -EINVAL; | 62 | return -EINVAL; |
64 | 63 | ||
65 | rdmsr(MSR_IA32_THERM_STATUS, l, h); | 64 | rdmsr_on_cpu(cpu, MSR_IA32_THERM_STATUS, &l, &h); |
66 | 65 | ||
67 | if (l & 0x01) | 66 | if (l & 0x01) |
68 | dprintk("CPU#%d currently thermal throttled\n", cpu); | 67 | dprintk("CPU#%d currently thermal throttled\n", cpu); |
@@ -70,10 +69,10 @@ static int cpufreq_p4_setdc(unsigned int cpu, unsigned int newstate) | |||
70 | if (has_N44_O17_errata[cpu] && (newstate == DC_25PT || newstate == DC_DFLT)) | 69 | if (has_N44_O17_errata[cpu] && (newstate == DC_25PT || newstate == DC_DFLT)) |
71 | newstate = DC_38PT; | 70 | newstate = DC_38PT; |
72 | 71 | ||
73 | rdmsr(MSR_IA32_THERM_CONTROL, l, h); | 72 | rdmsr_on_cpu(cpu, MSR_IA32_THERM_CONTROL, &l, &h); |
74 | if (newstate == DC_DISABLE) { | 73 | if (newstate == DC_DISABLE) { |
75 | dprintk("CPU#%d disabling modulation\n", cpu); | 74 | dprintk("CPU#%d disabling modulation\n", cpu); |
76 | wrmsr(MSR_IA32_THERM_CONTROL, l & ~(1<<4), h); | 75 | wrmsr_on_cpu(cpu, MSR_IA32_THERM_CONTROL, l & ~(1<<4), h); |
77 | } else { | 76 | } else { |
78 | dprintk("CPU#%d setting duty cycle to %d%%\n", | 77 | dprintk("CPU#%d setting duty cycle to %d%%\n", |
79 | cpu, ((125 * newstate) / 10)); | 78 | cpu, ((125 * newstate) / 10)); |
@@ -84,7 +83,7 @@ static int cpufreq_p4_setdc(unsigned int cpu, unsigned int newstate) | |||
84 | */ | 83 | */ |
85 | l = (l & ~14); | 84 | l = (l & ~14); |
86 | l = l | (1<<4) | ((newstate & 0x7)<<1); | 85 | l = l | (1<<4) | ((newstate & 0x7)<<1); |
87 | wrmsr(MSR_IA32_THERM_CONTROL, l, h); | 86 | wrmsr_on_cpu(cpu, MSR_IA32_THERM_CONTROL, l, h); |
88 | } | 87 | } |
89 | 88 | ||
90 | return 0; | 89 | return 0; |
@@ -111,7 +110,6 @@ static int cpufreq_p4_target(struct cpufreq_policy *policy, | |||
111 | { | 110 | { |
112 | unsigned int newstate = DC_RESV; | 111 | unsigned int newstate = DC_RESV; |
113 | struct cpufreq_freqs freqs; | 112 | struct cpufreq_freqs freqs; |
114 | cpumask_t cpus_allowed; | ||
115 | int i; | 113 | int i; |
116 | 114 | ||
117 | if (cpufreq_frequency_table_target(policy, &p4clockmod_table[0], target_freq, relation, &newstate)) | 115 | if (cpufreq_frequency_table_target(policy, &p4clockmod_table[0], target_freq, relation, &newstate)) |
@@ -132,17 +130,8 @@ static int cpufreq_p4_target(struct cpufreq_policy *policy, | |||
132 | /* run on each logical CPU, see section 13.15.3 of IA32 Intel Architecture Software | 130 | /* run on each logical CPU, see section 13.15.3 of IA32 Intel Architecture Software |
133 | * Developer's Manual, Volume 3 | 131 | * Developer's Manual, Volume 3 |
134 | */ | 132 | */ |
135 | cpus_allowed = current->cpus_allowed; | 133 | for_each_cpu_mask(i, policy->cpus) |
136 | |||
137 | for_each_cpu_mask(i, policy->cpus) { | ||
138 | cpumask_t this_cpu = cpumask_of_cpu(i); | ||
139 | |||
140 | set_cpus_allowed(current, this_cpu); | ||
141 | BUG_ON(smp_processor_id() != i); | ||
142 | |||
143 | cpufreq_p4_setdc(i, p4clockmod_table[newstate].index); | 134 | cpufreq_p4_setdc(i, p4clockmod_table[newstate].index); |
144 | } | ||
145 | set_cpus_allowed(current, cpus_allowed); | ||
146 | 135 | ||
147 | /* notifiers */ | 136 | /* notifiers */ |
148 | for_each_cpu_mask(i, policy->cpus) { | 137 | for_each_cpu_mask(i, policy->cpus) { |
@@ -256,17 +245,9 @@ static int cpufreq_p4_cpu_exit(struct cpufreq_policy *policy) | |||
256 | 245 | ||
257 | static unsigned int cpufreq_p4_get(unsigned int cpu) | 246 | static unsigned int cpufreq_p4_get(unsigned int cpu) |
258 | { | 247 | { |
259 | cpumask_t cpus_allowed; | ||
260 | u32 l, h; | 248 | u32 l, h; |
261 | 249 | ||
262 | cpus_allowed = current->cpus_allowed; | 250 | rdmsr_on_cpu(cpu, MSR_IA32_THERM_CONTROL, &l, &h); |
263 | |||
264 | set_cpus_allowed(current, cpumask_of_cpu(cpu)); | ||
265 | BUG_ON(smp_processor_id() != cpu); | ||
266 | |||
267 | rdmsr(MSR_IA32_THERM_CONTROL, l, h); | ||
268 | |||
269 | set_cpus_allowed(current, cpus_allowed); | ||
270 | 251 | ||
271 | if (l & 0x10) { | 252 | if (l & 0x10) { |
272 | l = l >> 1; | 253 | l = l >> 1; |