Update to 3.4-final.
[linux-flexiantxendom0-3.2.10.git] / arch / x86 / kernel / cpu / mcheck / mce.c
index 11c9166..769363c 100644 (file)
@@ -118,8 +118,10 @@ void mce_setup(struct mce *m)
        m->time = get_seconds();
        m->cpuvendor = boot_cpu_data.x86_vendor;
        m->cpuid = cpuid_eax(1);
+#ifndef CONFIG_XEN
        m->socketid = cpu_data(m->extcpu).phys_proc_id;
        m->apicid = cpu_data(m->extcpu).initial_apicid;
+#endif
        rdmsrl(MSR_IA32_MCG_CAP, m->mcgcap);
 }
 
@@ -266,9 +268,14 @@ static void print_mce(struct mce *m)
         * Note this output is parsed by external tools and old fields
         * should not be changed.
         */
+#ifndef CONFIG_XEN
        pr_emerg(HW_ERR "PROCESSOR %u:%x TIME %llu SOCKET %u APIC %x microcode %x\n",
                m->cpuvendor, m->cpuid, m->time, m->socketid, m->apicid,
                cpu_data(m->extcpu).microcode);
+#else
+       pr_emerg(HW_ERR "PROCESSOR %u:%x TIME %llu SOCKET %u APIC %x\n",
+               m->cpuvendor, m->cpuid, m->time, m->socketid, m->apicid);
+#endif
 
        /*
         * Print out human-readable details about the MCE error,
@@ -1236,8 +1243,15 @@ void mce_log_therm_throt_event(__u64 status)
  * Periodic polling timer for "silent" machine check errors.  If the
  * poller finds an MCE, poll 2x faster.  When the poller finds no more
  * errors, poll 2x slower (up to check_interval seconds).
+ *
+ * We will disable polling in DOM0 since all CMCI/Polling
+ * mechanism will be done in XEN for Intel CPUs
  */
+#if defined (CONFIG_X86_XEN_MCE)
+static int check_interval = 0; /* disable polling */
+#else
 static int check_interval = 5 * 60; /* 5 minutes */
+#endif
 
 static DEFINE_PER_CPU(int, mce_next_interval); /* in jiffies */
 static DEFINE_PER_CPU(struct timer_list, mce_timer);
@@ -1410,6 +1424,7 @@ static int __cpuinit __mcheck_cpu_apply_quirks(struct cpuinfo_x86 *c)
 
        /* This should be disabled by the BIOS, but isn't always */
        if (c->x86_vendor == X86_VENDOR_AMD) {
+#ifndef CONFIG_XEN
                if (c->x86 == 15 && banks > 4) {
                        /*
                         * disable GART TBL walk error reporting, which
@@ -1418,6 +1433,7 @@ static int __cpuinit __mcheck_cpu_apply_quirks(struct cpuinfo_x86 *c)
                         */
                        clear_bit(10, (unsigned long *)&mce_banks[4].ctl);
                }
+#endif
                if (c->x86 <= 17 && mce_bootlog < 0) {
                        /*
                         * Lots of broken BIOS around that don't clear them
@@ -1490,6 +1506,7 @@ static int __cpuinit __mcheck_cpu_ancient_init(struct cpuinfo_x86 *c)
 
 static void __mcheck_cpu_init_vendor(struct cpuinfo_x86 *c)
 {
+#ifndef CONFIG_X86_64_XEN
        switch (c->x86_vendor) {
        case X86_VENDOR_INTEL:
                mce_intel_feature_init(c);
@@ -1500,6 +1517,7 @@ static void __mcheck_cpu_init_vendor(struct cpuinfo_x86 *c)
        default:
                break;
        }
+#endif
 }
 
 static void __mcheck_cpu_init_timer(void)
@@ -2288,6 +2306,16 @@ static __init int mcheck_init_device(void)
        /* register character device /dev/mcelog */
        misc_register(&mce_chrdev_device);
 
+#ifdef CONFIG_X86_XEN_MCE
+       if (is_initial_xendomain()) {
+               /* Register vIRQ handler for MCE LOG processing */
+               extern int bind_virq_for_mce(void);
+
+               printk(KERN_DEBUG "MCE: bind virq for DOM0 logging\n");
+               bind_virq_for_mce();
+       }
+#endif
+
        return err;
 }
 device_initcall(mcheck_init_device);