Merge branch 'master' of /pub/scm/linux/kernel/git/torvalds/linux-2.6
[sfrench/cifs-2.6.git] / arch / x86 / kernel / cpu / amd.c
index dcf6bbb1c7c0011d3a91f2e722f7d1abf25c8364..693e353999cdfbda06f6dedf3ece288990ebffa9 100644 (file)
@@ -4,6 +4,7 @@
 #include <asm/io.h>
 #include <asm/processor.h>
 #include <asm/apic.h>
+#include <asm/mach_apic.h>
 
 #include "cpu.h"
 
@@ -45,19 +46,32 @@ static __cpuinit int amd_apic_timer_broken(void)
        case CPUID_XFAM_10H:
        case CPUID_XFAM_11H:
                rdmsr(MSR_K8_ENABLE_C1E, lo, hi);
-               if (lo & ENABLE_C1E_MASK)
+               if (lo & ENABLE_C1E_MASK) {
+                       if (smp_processor_id() != boot_cpu_physical_apicid)
+                               printk(KERN_INFO "AMD C1E detected late. "
+                                      "        Force timer broadcast.\n");
                        return 1;
-                break;
-        default:
-                /* err on the side of caution */
+               }
+               break;
+       default:
+               /* err on the side of caution */
                return 1;
-        }
+       }
        return 0;
 }
 #endif
 
 int force_mwait __cpuinitdata;
 
+void __cpuinit early_init_amd(struct cpuinfo_x86 *c)
+{
+       if (cpuid_eax(0x80000000) >= 0x80000007) {
+               c->x86_power = cpuid_edx(0x80000007);
+               if (c->x86_power & (1<<8))
+                       set_bit(X86_FEATURE_CONSTANT_TSC, c->x86_capability);
+       }
+}
+
 static void __cpuinit init_amd(struct cpuinfo_x86 *c)
 {
        u32 l, h;
@@ -80,6 +94,8 @@ static void __cpuinit init_amd(struct cpuinfo_x86 *c)
        }
 #endif
 
+       early_init_amd(c);
+
        /*
         *      FIXME: We should handle the K5 here. Set up the write
         *      range and also turn on MSR 83 bits 4 and 31 (write alloc,
@@ -252,16 +268,10 @@ static void __cpuinit init_amd(struct cpuinfo_x86 *c)
                c->x86_max_cores = (cpuid_ecx(0x80000008) & 0xff) + 1;
        }
 
-       if (cpuid_eax(0x80000000) >= 0x80000007) {
-               c->x86_power = cpuid_edx(0x80000007);
-               if (c->x86_power & (1<<8))
-                       set_bit(X86_FEATURE_CONSTANT_TSC, c->x86_capability);
-       }
-
 #ifdef CONFIG_X86_HT
        /*
         * On a AMD multi core setup the lower bits of the APIC id
-        * distingush the cores.
+        * distinguish the cores.
         */
        if (c->x86_max_cores > 1) {
                int cpu = smp_processor_id();
@@ -290,12 +300,12 @@ static void __cpuinit init_amd(struct cpuinfo_x86 *c)
                local_apic_timer_disabled = 1;
 #endif
 
-       if (c->x86 == 0x10 && !force_mwait)
-               clear_bit(X86_FEATURE_MWAIT, c->x86_capability);
-
        /* K6s reports MCEs but don't actually have all the MSRs */
        if (c->x86 < 6)
                clear_bit(X86_FEATURE_MCE, c->x86_capability);
+
+       if (cpu_has_xmm2)
+               set_bit(X86_FEATURE_MFENCE_RDTSC, c->x86_capability);
 }
 
 static unsigned int __cpuinit amd_size_cache(struct cpuinfo_x86 * c, unsigned int size)