Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0
0002 /*
0003  * IDT Winchip specific Machine Check Exception Reporting
0004  * (C) Copyright 2002 Alan Cox <alan@lxorguk.ukuu.org.uk>
0005  */
0006 #include <linux/interrupt.h>
0007 #include <linux/kernel.h>
0008 #include <linux/types.h>
0009 #include <linux/hardirq.h>
0010 
0011 #include <asm/processor.h>
0012 #include <asm/traps.h>
0013 #include <asm/tlbflush.h>
0014 #include <asm/mce.h>
0015 #include <asm/msr.h>
0016 
0017 #include "internal.h"
0018 
0019 /* Machine check handler for WinChip C6: */
0020 noinstr void winchip_machine_check(struct pt_regs *regs)
0021 {
0022     instrumentation_begin();
0023     pr_emerg("CPU0: Machine Check Exception.\n");
0024     add_taint(TAINT_MACHINE_CHECK, LOCKDEP_NOW_UNRELIABLE);
0025     instrumentation_end();
0026 }
0027 
0028 /* Set up machine check reporting on the Winchip C6 series */
0029 void winchip_mcheck_init(struct cpuinfo_x86 *c)
0030 {
0031     u32 lo, hi;
0032 
0033     rdmsr(MSR_IDT_FCR1, lo, hi);
0034     lo |= (1<<2);   /* Enable EIERRINT (int 18 MCE) */
0035     lo &= ~(1<<4);  /* Enable MCE */
0036     wrmsr(MSR_IDT_FCR1, lo, hi);
0037 
0038     cr4_set_bits(X86_CR4_MCE);
0039 
0040     pr_info("Winchip machine check reporting enabled on CPU#0.\n");
0041 }