p5.c 1.6 KB
Newer Older
L
Linus Torvalds 已提交
1 2
/*
 * P5 specific Machine Check Exception Reporting
3
 * (C) Copyright 2002 Alan Cox <alan@lxorguk.ukuu.org.uk>
L
Linus Torvalds 已提交
4 5
 */
#include <linux/interrupt.h>
I
Ingo Molnar 已提交
6 7
#include <linux/kernel.h>
#include <linux/types.h>
L
Linus Torvalds 已提交
8 9
#include <linux/smp.h>

10
#include <asm/processor.h>
H
Hidetoshi Seto 已提交
11
#include <asm/mce.h>
L
Linus Torvalds 已提交
12 13
#include <asm/msr.h>

14
/* By default disabled */
15
int mce_p5_enabled __read_mostly;
16

I
Ingo Molnar 已提交
17
/* Machine check handler for Pentium class Intel CPUs: */
18
static void pentium_machine_check(struct pt_regs *regs, long error_code)
L
Linus Torvalds 已提交
19 20
{
	u32 loaddr, hi, lotype;
I
Ingo Molnar 已提交
21

L
Linus Torvalds 已提交
22 23
	rdmsr(MSR_IA32_P5_MC_ADDR, loaddr, hi);
	rdmsr(MSR_IA32_P5_MC_TYPE, lotype, hi);
I
Ingo Molnar 已提交
24 25 26 27 28 29 30 31 32 33 34

	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());
	}

35
	add_taint(TAINT_MACHINE_CHECK, LOCKDEP_NOW_UNRELIABLE);
L
Linus Torvalds 已提交
36 37
}

I
Ingo Molnar 已提交
38
/* Set up machine check reporting for processors with Intel style MCE: */
S
Shaohua Li 已提交
39
void intel_p5_mcheck_init(struct cpuinfo_x86 *c)
L
Linus Torvalds 已提交
40 41
{
	u32 l, h;
42

43 44
	/* Default P5 to off as its often misconnected: */
	if (!mce_p5_enabled)
45
		return;
L
Linus Torvalds 已提交
46

47 48
	/* Check for MCE support: */
	if (!cpu_has(c, X86_FEATURE_MCE))
L
Linus Torvalds 已提交
49
		return;
I
Ingo Molnar 已提交
50

L
Linus Torvalds 已提交
51
	machine_check_vector = pentium_machine_check;
I
Ingo Molnar 已提交
52
	/* Make sure the vector pointer is visible before we enable MCEs: */
L
Linus Torvalds 已提交
53 54
	wmb();

I
Ingo Molnar 已提交
55
	/* Read registers before enabling: */
L
Linus Torvalds 已提交
56 57
	rdmsr(MSR_IA32_P5_MC_ADDR, l, h);
	rdmsr(MSR_IA32_P5_MC_TYPE, l, h);
I
Ingo Molnar 已提交
58 59
	printk(KERN_INFO
	       "Intel old style machine check architecture supported.\n");
L
Linus Torvalds 已提交
60

I
Ingo Molnar 已提交
61
	/* Enable MCE: */
L
Linus Torvalds 已提交
62
	set_in_cr4(X86_CR4_MCE);
I
Ingo Molnar 已提交
63 64 65
	printk(KERN_INFO
	       "Intel old style machine check reporting enabled on CPU#%d.\n",
	       smp_processor_id());
L
Linus Torvalds 已提交
66
}