aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/cpu/mcheck/therm_throt.c
diff options
context:
space:
mode:
authorHidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>2009-06-15 04:25:27 -0400
committerH. Peter Anvin <hpa@zytor.com>2009-06-16 19:56:08 -0400
commita65c88dd2c83b569dbd13778da689861bdf977f2 (patch)
tree61c1e44b539b722909256969bd4d4dfb1c5143b5 /arch/x86/kernel/cpu/mcheck/therm_throt.c
parente8ce2c5ee826b3787202493effcd08d4b1e1e639 (diff)
x86, mce: unify smp_thermal_interrupt
Put common functions into therm_throt.c, modify Makefile. unexpected_thermal_interrupt intel_thermal_interrupt smp_thermal_interrupt intel_set_thermal_handler 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/therm_throt.c')
-rw-r--r--arch/x86/kernel/cpu/mcheck/therm_throt.c40
1 files changed, 39 insertions, 1 deletions
diff --git a/arch/x86/kernel/cpu/mcheck/therm_throt.c b/arch/x86/kernel/cpu/mcheck/therm_throt.c
index 7b1ae2e20ba5..b3792b196856 100644
--- a/arch/x86/kernel/cpu/mcheck/therm_throt.c
+++ b/arch/x86/kernel/cpu/mcheck/therm_throt.c
@@ -13,6 +13,7 @@
13 * Credits: Adapted from Zwane Mwaikambo's original code in mce_intel.c. 13 * Credits: Adapted from Zwane Mwaikambo's original code in mce_intel.c.
14 * Inspired by Ross Biro's and Al Borchers' counter code. 14 * Inspired by Ross Biro's and Al Borchers' counter code.
15 */ 15 */
16#include <linux/interrupt.h>
16#include <linux/notifier.h> 17#include <linux/notifier.h>
17#include <linux/jiffies.h> 18#include <linux/jiffies.h>
18#include <linux/percpu.h> 19#include <linux/percpu.h>
@@ -20,6 +21,8 @@
20#include <linux/cpu.h> 21#include <linux/cpu.h>
21 22
22#include <asm/therm_throt.h> 23#include <asm/therm_throt.h>
24#include <asm/idle.h>
25#include <asm/mce.h>
23 26
24/* How long to wait between reporting thermal events */ 27/* How long to wait between reporting thermal events */
25#define CHECK_INTERVAL (300 * HZ) 28#define CHECK_INTERVAL (300 * HZ)
@@ -186,6 +189,41 @@ static __init int thermal_throttle_init_device(void)
186 189
187 return 0; 190 return 0;
188} 191}
189
190device_initcall(thermal_throttle_init_device); 192device_initcall(thermal_throttle_init_device);
193
191#endif /* CONFIG_SYSFS */ 194#endif /* CONFIG_SYSFS */
195
196/* Thermal transition interrupt handler */
197void intel_thermal_interrupt(void)
198{
199 __u64 msr_val;
200
201 rdmsrl(MSR_IA32_THERM_STATUS, msr_val);
202 if (therm_throt_process(msr_val & THERM_STATUS_PROCHOT))
203 mce_log_therm_throt_event(msr_val);
204}
205
206static void unexpected_thermal_interrupt(void)
207{
208 printk(KERN_ERR "CPU%d: Unexpected LVT TMR interrupt!\n",
209 smp_processor_id());
210 add_taint(TAINT_MACHINE_CHECK);
211}
212
213static void (*smp_thermal_vector)(void) = unexpected_thermal_interrupt;
214
215asmlinkage void smp_thermal_interrupt(struct pt_regs *regs)
216{
217 exit_idle();
218 irq_enter();
219 inc_irq_stat(irq_thermal_count);
220 smp_thermal_vector();
221 irq_exit();
222 /* Ack only at the end to avoid potential reentry */
223 ack_APIC_irq();
224}
225
226void intel_set_thermal_handler(void)
227{
228 smp_thermal_vector = intel_thermal_interrupt;
229}