p5.c 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. u32 loaddr, hi, lotype;
  20. ist_enter(regs);
  21. rdmsr(MSR_IA32_P5_MC_ADDR, loaddr, hi);
  22. rdmsr(MSR_IA32_P5_MC_TYPE, lotype, hi);
  23. printk(KERN_EMERG
  24. "CPU#%d: Machine Check Exception: 0x%8X (type 0x%8X).\n",
  25. smp_processor_id(), loaddr, lotype);
  26. if (lotype & (1<<5)) {
  27. printk(KERN_EMERG
  28. "CPU#%d: Possible thermal failure (CPU on fire ?).\n",
  29. smp_processor_id());
  30. }
  31. add_taint(TAINT_MACHINE_CHECK, LOCKDEP_NOW_UNRELIABLE);
  32. ist_exit(regs);
  33. }
  34. /* Set up machine check reporting for processors with Intel style MCE: */
  35. void intel_p5_mcheck_init(struct cpuinfo_x86 *c)
  36. {
  37. u32 l, h;
  38. /* Default P5 to off as its often misconnected: */
  39. if (!mce_p5_enabled)
  40. return;
  41. /* Check for MCE support: */
  42. if (!cpu_has(c, X86_FEATURE_MCE))
  43. return;
  44. machine_check_vector = pentium_machine_check;
  45. /* Make sure the vector pointer is visible before we enable MCEs: */
  46. wmb();
  47. /* Read registers before enabling: */
  48. rdmsr(MSR_IA32_P5_MC_ADDR, l, h);
  49. rdmsr(MSR_IA32_P5_MC_TYPE, l, h);
  50. printk(KERN_INFO
  51. "Intel old style machine check architecture supported.\n");
  52. /* Enable MCE: */
  53. cr4_set_bits(X86_CR4_MCE);
  54. printk(KERN_INFO
  55. "Intel old style machine check reporting enabled on CPU#%d.\n",
  56. smp_processor_id());
  57. }