]> Pileus Git - ~andy/linux/blobdiff - arch/x86/kernel/cpu/amd.c
Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[~andy/linux] / arch / x86 / kernel / cpu / amd.c
index bca023bdd6b2a8b4525d10145795408dee4fa01b..d3153e281d7291e78bb57d647d388171f4d006b2 100644 (file)
@@ -1,5 +1,4 @@
 #include <linux/export.h>
-#include <linux/init.h>
 #include <linux/bitops.h>
 #include <linux/elf.h>
 #include <linux/mm.h>
@@ -487,7 +486,7 @@ static void early_init_amd(struct cpuinfo_x86 *c)
                set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC);
                set_cpu_cap(c, X86_FEATURE_NONSTOP_TSC);
                if (!check_tsc_unstable())
-                       sched_clock_stable = 1;
+                       set_sched_clock_stable();
        }
 
 #ifdef CONFIG_X86_64
@@ -508,6 +507,16 @@ static void early_init_amd(struct cpuinfo_x86 *c)
                        set_cpu_cap(c, X86_FEATURE_EXTD_APICID);
        }
 #endif
+
+       /* F16h erratum 793, CVE-2013-6885 */
+       if (c->x86 == 0x16 && c->x86_model <= 0xf) {
+               u64 val;
+
+               rdmsrl(MSR_AMD64_LS_CFG, val);
+               if (!(val & BIT(15)))
+                       wrmsrl(MSR_AMD64_LS_CFG, val | BIT(15));
+       }
+
 }
 
 static const int amd_erratum_383[];
@@ -790,14 +799,10 @@ static void cpu_detect_tlb_amd(struct cpuinfo_x86 *c)
        }
 
        /* Handle DTLB 2M and 4M sizes, fall back to L1 if L2 is disabled */
-       if (!((eax >> 16) & mask)) {
-               u32 a, b, c, d;
-
-               cpuid(0x80000005, &a, &b, &c, &d);
-               tlb_lld_2m[ENTRIES] = (a >> 16) & 0xff;
-       } else {
+       if (!((eax >> 16) & mask))
+               tlb_lld_2m[ENTRIES] = (cpuid_eax(0x80000005) >> 16) & 0xff;
+       else
                tlb_lld_2m[ENTRIES] = (eax >> 16) & mask;
-       }
 
        /* a 4M entry uses two 2M entries */
        tlb_lld_4m[ENTRIES] = tlb_lld_2m[ENTRIES] >> 1;