2005-04-16 22:20:36 +00:00
|
|
|
/*
|
|
|
|
* P5 specific Machine Check Exception Reporting
|
2009-01-05 14:08:04 +00:00
|
|
|
* (C) Copyright 2002 Alan Cox <alan@lxorguk.ukuu.org.uk>
|
2005-04-16 22:20:36 +00:00
|
|
|
*/
|
|
|
|
#include <linux/interrupt.h>
|
2009-04-08 10:31:21 +00:00
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/types.h>
|
|
|
|
#include <linux/init.h>
|
2005-04-16 22:20:36 +00:00
|
|
|
#include <linux/smp.h>
|
|
|
|
|
2008-02-19 22:20:45 +00:00
|
|
|
#include <asm/processor.h>
|
2005-04-16 22:20:36 +00:00
|
|
|
#include <asm/system.h>
|
|
|
|
#include <asm/msr.h>
|
|
|
|
|
|
|
|
#include "mce.h"
|
|
|
|
|
2009-04-08 10:31:21 +00:00
|
|
|
/* Machine check handler for Pentium class Intel CPUs: */
|
2008-02-19 22:20:45 +00:00
|
|
|
static void pentium_machine_check(struct pt_regs *regs, long error_code)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
|
|
|
u32 loaddr, hi, lotype;
|
2009-04-08 10:31:21 +00:00
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
rdmsr(MSR_IA32_P5_MC_ADDR, loaddr, hi);
|
|
|
|
rdmsr(MSR_IA32_P5_MC_TYPE, lotype, hi);
|
2009-04-08 10:31:21 +00:00
|
|
|
|
|
|
|
printk(KERN_EMERG
|
|
|
|
"CPU#%d: Machine Check Exception: 0x%8X (type 0x%8X).\n",
|
|
|
|
smp_processor_id(), loaddr, lotype);
|
|
|
|
|
|
|
|
if (lotype & (1<<5)) {
|
|
|
|
printk(KERN_EMERG
|
|
|
|
"CPU#%d: Possible thermal failure (CPU on fire ?).\n",
|
|
|
|
smp_processor_id());
|
|
|
|
}
|
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
add_taint(TAINT_MACHINE_CHECK);
|
|
|
|
}
|
|
|
|
|
2009-04-08 10:31:21 +00:00
|
|
|
/* Set up machine check reporting for processors with Intel style MCE: */
|
2005-11-07 08:58:42 +00:00
|
|
|
void intel_p5_mcheck_init(struct cpuinfo_x86 *c)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
|
|
|
u32 l, h;
|
2008-02-19 22:20:45 +00:00
|
|
|
|
2009-04-08 10:31:21 +00:00
|
|
|
/* Check for MCE support: */
|
2008-02-19 22:20:45 +00:00
|
|
|
if (!cpu_has(c, X86_FEATURE_MCE))
|
|
|
|
return;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2009-04-08 10:31:21 +00:00
|
|
|
/* Default P5 to off as its often misconnected: */
|
2008-02-19 22:20:45 +00:00
|
|
|
if (mce_disabled != -1)
|
2005-04-16 22:20:36 +00:00
|
|
|
return;
|
2009-04-08 10:31:21 +00:00
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
machine_check_vector = pentium_machine_check;
|
2009-04-08 10:31:21 +00:00
|
|
|
/* Make sure the vector pointer is visible before we enable MCEs: */
|
2005-04-16 22:20:36 +00:00
|
|
|
wmb();
|
|
|
|
|
2009-04-08 10:31:21 +00:00
|
|
|
/* Read registers before enabling: */
|
2005-04-16 22:20:36 +00:00
|
|
|
rdmsr(MSR_IA32_P5_MC_ADDR, l, h);
|
|
|
|
rdmsr(MSR_IA32_P5_MC_TYPE, l, h);
|
2009-04-08 10:31:21 +00:00
|
|
|
printk(KERN_INFO
|
|
|
|
"Intel old style machine check architecture supported.\n");
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2009-04-08 10:31:21 +00:00
|
|
|
/* Enable MCE: */
|
2005-04-16 22:20:36 +00:00
|
|
|
set_in_cr4(X86_CR4_MCE);
|
2009-04-08 10:31:21 +00:00
|
|
|
printk(KERN_INFO
|
|
|
|
"Intel old style machine check reporting enabled on CPU#%d.\n",
|
|
|
|
smp_processor_id());
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|