1 // SPDX-License-Identifier: GPL-2.0
3 * P5 specific Machine Check Exception Reporting
4 * (C) Copyright 2002 Alan Cox <alan@lxorguk.ukuu.org.uk>
6 #include <linux/interrupt.h>
7 #include <linux/kernel.h>
8 #include <linux/types.h>
10 #include <linux/hardirq.h>
12 #include <asm/processor.h>
13 #include <asm/traps.h>
14 #include <asm/tlbflush.h>
20 /* By default disabled */
21 int mce_p5_enabled __read_mostly;
23 /* Machine check handler for Pentium class Intel CPUs: */
24 static void pentium_machine_check(struct pt_regs *regs)
26 u32 loaddr, hi, lotype;
28 rdmsr(MSR_IA32_P5_MC_ADDR, loaddr, hi);
29 rdmsr(MSR_IA32_P5_MC_TYPE, lotype, hi);
31 pr_emerg("CPU#%d: Machine Check Exception: 0x%8X (type 0x%8X).\n",
32 smp_processor_id(), loaddr, lotype);
34 if (lotype & (1<<5)) {
35 pr_emerg("CPU#%d: Possible thermal failure (CPU on fire ?).\n",
39 add_taint(TAINT_MACHINE_CHECK, LOCKDEP_NOW_UNRELIABLE);
42 /* Set up machine check reporting for processors with Intel style MCE: */
43 void intel_p5_mcheck_init(struct cpuinfo_x86 *c)
47 /* Default P5 to off as its often misconnected: */
51 /* Check for MCE support: */
52 if (!cpu_has(c, X86_FEATURE_MCE))
55 machine_check_vector = pentium_machine_check;
56 /* Make sure the vector pointer is visible before we enable MCEs: */
59 /* Read registers before enabling: */
60 rdmsr(MSR_IA32_P5_MC_ADDR, l, h);
61 rdmsr(MSR_IA32_P5_MC_TYPE, l, h);
62 pr_info("Intel old style machine check architecture supported.\n");
65 cr4_set_bits(X86_CR4_MCE);
66 pr_info("Intel old style machine check reporting enabled on CPU#%d.\n",