diff options
author | Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com> | 2009-06-15 04:26:10 -0400 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2009-06-16 19:56:08 -0400 |
commit | 895287c0a6aa571160c47ee10de11b542166c4f9 (patch) | |
tree | 27cb16731bc31d0f77881cec4ac1f1b26c6d22a1 /arch/x86/kernel/cpu/mcheck | |
parent | a65c88dd2c83b569dbd13778da689861bdf977f2 (diff) |
x86, mce: squash mce_intel.c into therm_throt.c
move intel_init_thermal() into therm_throt.c
Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'arch/x86/kernel/cpu/mcheck')
-rw-r--r-- | arch/x86/kernel/cpu/mcheck/Makefile | 2 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/mcheck/mce_intel.c | 73 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/mcheck/therm_throt.c | 66 |
3 files changed, 67 insertions, 74 deletions
diff --git a/arch/x86/kernel/cpu/mcheck/Makefile b/arch/x86/kernel/cpu/mcheck/Makefile index 53df57d11c50..659564e5fc0f 100644 --- a/arch/x86/kernel/cpu/mcheck/Makefile +++ b/arch/x86/kernel/cpu/mcheck/Makefile | |||
@@ -9,4 +9,4 @@ obj-$(CONFIG_X86_MCE_NONFATAL) += non-fatal.o | |||
9 | obj-$(CONFIG_X86_MCE_THRESHOLD) += threshold.o | 9 | obj-$(CONFIG_X86_MCE_THRESHOLD) += threshold.o |
10 | obj-$(CONFIG_X86_MCE_INJECT) += mce-inject.o | 10 | obj-$(CONFIG_X86_MCE_INJECT) += mce-inject.o |
11 | 11 | ||
12 | obj-$(CONFIG_X86_THERMAL_VECTOR) += therm_throt.o mce_intel.o | 12 | obj-$(CONFIG_X86_THERMAL_VECTOR) += therm_throt.o |
diff --git a/arch/x86/kernel/cpu/mcheck/mce_intel.c b/arch/x86/kernel/cpu/mcheck/mce_intel.c deleted file mode 100644 index 475478b20884..000000000000 --- a/arch/x86/kernel/cpu/mcheck/mce_intel.c +++ /dev/null | |||
@@ -1,73 +0,0 @@ | |||
1 | /* | ||
2 | * Common code for Intel machine checks | ||
3 | */ | ||
4 | #include <linux/interrupt.h> | ||
5 | #include <linux/kernel.h> | ||
6 | #include <linux/types.h> | ||
7 | #include <linux/init.h> | ||
8 | #include <linux/smp.h> | ||
9 | |||
10 | #include <asm/therm_throt.h> | ||
11 | #include <asm/processor.h> | ||
12 | #include <asm/system.h> | ||
13 | #include <asm/apic.h> | ||
14 | #include <asm/mce.h> | ||
15 | #include <asm/msr.h> | ||
16 | |||
17 | void intel_init_thermal(struct cpuinfo_x86 *c) | ||
18 | { | ||
19 | unsigned int cpu = smp_processor_id(); | ||
20 | int tm2 = 0; | ||
21 | u32 l, h; | ||
22 | |||
23 | /* Thermal monitoring depends on ACPI and clock modulation*/ | ||
24 | if (!cpu_has(c, X86_FEATURE_ACPI) || !cpu_has(c, X86_FEATURE_ACC)) | ||
25 | return; | ||
26 | |||
27 | /* | ||
28 | * First check if its enabled already, in which case there might | ||
29 | * be some SMM goo which handles it, so we can't even put a handler | ||
30 | * since it might be delivered via SMI already: | ||
31 | */ | ||
32 | rdmsr(MSR_IA32_MISC_ENABLE, l, h); | ||
33 | h = apic_read(APIC_LVTTHMR); | ||
34 | if ((l & MSR_IA32_MISC_ENABLE_TM1) && (h & APIC_DM_SMI)) { | ||
35 | printk(KERN_DEBUG | ||
36 | "CPU%d: Thermal monitoring handled by SMI\n", cpu); | ||
37 | return; | ||
38 | } | ||
39 | |||
40 | if (cpu_has(c, X86_FEATURE_TM2) && (l & MSR_IA32_MISC_ENABLE_TM2)) | ||
41 | tm2 = 1; | ||
42 | |||
43 | /* Check whether a vector already exists */ | ||
44 | if (h & APIC_VECTOR_MASK) { | ||
45 | printk(KERN_DEBUG | ||
46 | "CPU%d: Thermal LVT vector (%#x) already installed\n", | ||
47 | cpu, (h & APIC_VECTOR_MASK)); | ||
48 | return; | ||
49 | } | ||
50 | |||
51 | /* We'll mask the thermal vector in the lapic till we're ready: */ | ||
52 | h = THERMAL_APIC_VECTOR | APIC_DM_FIXED | APIC_LVT_MASKED; | ||
53 | apic_write(APIC_LVTTHMR, h); | ||
54 | |||
55 | rdmsr(MSR_IA32_THERM_INTERRUPT, l, h); | ||
56 | wrmsr(MSR_IA32_THERM_INTERRUPT, | ||
57 | l | (THERM_INT_LOW_ENABLE | THERM_INT_HIGH_ENABLE), h); | ||
58 | |||
59 | intel_set_thermal_handler(); | ||
60 | |||
61 | rdmsr(MSR_IA32_MISC_ENABLE, l, h); | ||
62 | wrmsr(MSR_IA32_MISC_ENABLE, l | MSR_IA32_MISC_ENABLE_TM1, h); | ||
63 | |||
64 | /* Unmask the thermal vector: */ | ||
65 | l = apic_read(APIC_LVTTHMR); | ||
66 | apic_write(APIC_LVTTHMR, l & ~APIC_LVT_MASKED); | ||
67 | |||
68 | printk(KERN_INFO "CPU%d: Thermal monitoring enabled (%s)\n", | ||
69 | cpu, tm2 ? "TM2" : "TM1"); | ||
70 | |||
71 | /* enable thermal throttle processing */ | ||
72 | atomic_set(&therm_throt_en, 1); | ||
73 | } | ||
diff --git a/arch/x86/kernel/cpu/mcheck/therm_throt.c b/arch/x86/kernel/cpu/mcheck/therm_throt.c index b3792b196856..7a508aaafcea 100644 --- a/arch/x86/kernel/cpu/mcheck/therm_throt.c +++ b/arch/x86/kernel/cpu/mcheck/therm_throt.c | |||
@@ -16,13 +16,21 @@ | |||
16 | #include <linux/interrupt.h> | 16 | #include <linux/interrupt.h> |
17 | #include <linux/notifier.h> | 17 | #include <linux/notifier.h> |
18 | #include <linux/jiffies.h> | 18 | #include <linux/jiffies.h> |
19 | #include <linux/kernel.h> | ||
19 | #include <linux/percpu.h> | 20 | #include <linux/percpu.h> |
20 | #include <linux/sysdev.h> | 21 | #include <linux/sysdev.h> |
22 | #include <linux/types.h> | ||
23 | #include <linux/init.h> | ||
24 | #include <linux/smp.h> | ||
21 | #include <linux/cpu.h> | 25 | #include <linux/cpu.h> |
22 | 26 | ||
23 | #include <asm/therm_throt.h> | 27 | #include <asm/therm_throt.h> |
28 | #include <asm/processor.h> | ||
29 | #include <asm/system.h> | ||
30 | #include <asm/apic.h> | ||
24 | #include <asm/idle.h> | 31 | #include <asm/idle.h> |
25 | #include <asm/mce.h> | 32 | #include <asm/mce.h> |
33 | #include <asm/msr.h> | ||
26 | 34 | ||
27 | /* How long to wait between reporting thermal events */ | 35 | /* How long to wait between reporting thermal events */ |
28 | #define CHECK_INTERVAL (300 * HZ) | 36 | #define CHECK_INTERVAL (300 * HZ) |
@@ -227,3 +235,61 @@ void intel_set_thermal_handler(void) | |||
227 | { | 235 | { |
228 | smp_thermal_vector = intel_thermal_interrupt; | 236 | smp_thermal_vector = intel_thermal_interrupt; |
229 | } | 237 | } |
238 | |||
239 | void intel_init_thermal(struct cpuinfo_x86 *c) | ||
240 | { | ||
241 | unsigned int cpu = smp_processor_id(); | ||
242 | int tm2 = 0; | ||
243 | u32 l, h; | ||
244 | |||
245 | /* Thermal monitoring depends on ACPI and clock modulation*/ | ||
246 | if (!cpu_has(c, X86_FEATURE_ACPI) || !cpu_has(c, X86_FEATURE_ACC)) | ||
247 | return; | ||
248 | |||
249 | /* | ||
250 | * First check if its enabled already, in which case there might | ||
251 | * be some SMM goo which handles it, so we can't even put a handler | ||
252 | * since it might be delivered via SMI already: | ||
253 | */ | ||
254 | rdmsr(MSR_IA32_MISC_ENABLE, l, h); | ||
255 | h = apic_read(APIC_LVTTHMR); | ||
256 | if ((l & MSR_IA32_MISC_ENABLE_TM1) && (h & APIC_DM_SMI)) { | ||
257 | printk(KERN_DEBUG | ||
258 | "CPU%d: Thermal monitoring handled by SMI\n", cpu); | ||
259 | return; | ||
260 | } | ||
261 | |||
262 | if (cpu_has(c, X86_FEATURE_TM2) && (l & MSR_IA32_MISC_ENABLE_TM2)) | ||
263 | tm2 = 1; | ||
264 | |||
265 | /* Check whether a vector already exists */ | ||
266 | if (h & APIC_VECTOR_MASK) { | ||
267 | printk(KERN_DEBUG | ||
268 | "CPU%d: Thermal LVT vector (%#x) already installed\n", | ||
269 | cpu, (h & APIC_VECTOR_MASK)); | ||
270 | return; | ||
271 | } | ||
272 | |||
273 | /* We'll mask the thermal vector in the lapic till we're ready: */ | ||
274 | h = THERMAL_APIC_VECTOR | APIC_DM_FIXED | APIC_LVT_MASKED; | ||
275 | apic_write(APIC_LVTTHMR, h); | ||
276 | |||
277 | rdmsr(MSR_IA32_THERM_INTERRUPT, l, h); | ||
278 | wrmsr(MSR_IA32_THERM_INTERRUPT, | ||
279 | l | (THERM_INT_LOW_ENABLE | THERM_INT_HIGH_ENABLE), h); | ||
280 | |||
281 | intel_set_thermal_handler(); | ||
282 | |||
283 | rdmsr(MSR_IA32_MISC_ENABLE, l, h); | ||
284 | wrmsr(MSR_IA32_MISC_ENABLE, l | MSR_IA32_MISC_ENABLE_TM1, h); | ||
285 | |||
286 | /* Unmask the thermal vector: */ | ||
287 | l = apic_read(APIC_LVTTHMR); | ||
288 | apic_write(APIC_LVTTHMR, l & ~APIC_LVT_MASKED); | ||
289 | |||
290 | printk(KERN_INFO "CPU%d: Thermal monitoring enabled (%s)\n", | ||
291 | cpu, tm2 ? "TM2" : "TM1"); | ||
292 | |||
293 | /* enable thermal throttle processing */ | ||
294 | atomic_set(&therm_throt_en, 1); | ||
295 | } | ||