p5.c 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. * P5 specific Machine Check Exception Reporting
  3. * (C) Copyright 2002 Alan Cox <alan@lxorguk.ukuu.org.uk>
  4. */
  5. #include <linux/interrupt.h>
  6. #include <linux/kernel.h>
  7. #include <linux/types.h>
  8. #include <linux/smp.h>
  9. #include <asm/processor.h>
  10. #include <asm/traps.h>
  11. #include <asm/tlbflush.h>
  12. #include <asm/mce.h>
  13. #include <asm/msr.h>
  14. /* By default disabled */
  15. int mce_p5_enabled __read_mostly;
  16. /* Machine check handler for Pentium class Intel CPUs: */
  17. static void pentium_machine_check(struct pt_regs *regs, long error_code)
  18. {
  19. enum ctx_state prev_state;
  20. u32 loaddr, hi, lotype;
  21. prev_state = ist_enter(regs);
  22. rdmsr(MSR_IA32_P5_MC_ADDR, loaddr, hi);
  23. rdmsr(MSR_IA32_P5_MC_TYPE, lotype, hi);
  24. printk(KERN_EMERG
  25. "CPU#%d: Machine Check Exception: 0x%8X (type 0x%8X).\n",
  26. smp_processor_id(), loaddr, lotype);
  27. if (lotype & (1<<5)) {
  28. printk(KERN_EMERG
  29. "CPU#%d: Possible thermal failure (CPU on fire ?).\n",
  30. smp_processor_id());
  31. }
  32. add_taint(TAINT_MACHINE_CHECK, LOCKDEP_NOW_UNRELIABLE);
  33. ist_exit(regs, prev_state);
  34. }
  35. /* Set up machine check reporting for processors with Intel style MCE: */
  36. void intel_p5_mcheck_init(struct cpuinfo_x86 *c)
  37. {
  38. u32 l, h;
  39. /* Default P5 to off as its often misconnected: */
  40. if (!mce_p5_enabled)
  41. return;
  42. /* Check for MCE support: */
  43. if (!cpu_has(c, X86_FEATURE_MCE))
  44. return;
  45. machine_check_vector = pentium_machine_check;
  46. /* Make sure the vector pointer is visible before we enable MCEs: */
  47. wmb();
  48. /* Read registers before enabling: */
  49. rdmsr(MSR_IA32_P5_MC_ADDR, l, h);
  50. rdmsr(MSR_IA32_P5_MC_TYPE, l, h);
  51. printk(KERN_INFO
  52. "Intel old style machine check architecture supported.\n");
  53. /* Enable MCE: */
  54. cr4_set_bits(X86_CR4_MCE);
  55. printk(KERN_INFO
  56. "Intel old style machine check reporting enabled on CPU#%d.\n",
  57. smp_processor_id());
  58. }