p5.c 1.6 KB

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