aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/cpu/microcode/intel.c
diff options
context:
space:
mode:
authorJia Zhang <zhang.jia@linux.alibaba.com>2018-01-23 05:41:32 -0500
committerThomas Gleixner <tglx@linutronix.de>2018-01-24 07:00:35 -0500
commit7e702d17ed138cf4ae7c00e8c00681ed464587c7 (patch)
treea61b7671b22c03f3ae35a4ef49a902fd911964c3 /arch/x86/kernel/cpu/microcode/intel.c
parent40d4071ce2d20840d224b4a77b5dc6f752c9ab15 (diff)
x86/microcode/intel: Extend BDW late-loading further with LLC size check
Commit b94b73733171 ("x86/microcode/intel: Extend BDW late-loading with a revision check") reduced the impact of erratum BDF90 for Broadwell model 79. The impact can be reduced further by checking the size of the last level cache portion per core. Tony: "The erratum says the problem only occurs on the large-cache SKUs. So we only need to avoid the update if we are on a big cache SKU that is also running old microcode." For more details, see erratum BDF90 in document #334165 (Intel Xeon Processor E7-8800/4800 v4 Product Family Specification Update) from September 2017. Fixes: b94b73733171 ("x86/microcode/intel: Extend BDW late-loading with a revision check") Signed-off-by: Jia Zhang <zhang.jia@linux.alibaba.com> Signed-off-by: Borislav Petkov <bp@suse.de> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Acked-by: Tony Luck <tony.luck@intel.com> Cc: stable@vger.kernel.org Link: https://lkml.kernel.org/r/1516321542-31161-1-git-send-email-zhang.jia@linux.alibaba.com
Diffstat (limited to 'arch/x86/kernel/cpu/microcode/intel.c')
-rw-r--r--arch/x86/kernel/cpu/microcode/intel.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/arch/x86/kernel/cpu/microcode/intel.c b/arch/x86/kernel/cpu/microcode/intel.c
index d9e460fc7a3b..f7c55b0e753a 100644
--- a/arch/x86/kernel/cpu/microcode/intel.c
+++ b/arch/x86/kernel/cpu/microcode/intel.c
@@ -45,6 +45,9 @@ static const char ucode_path[] = "kernel/x86/microcode/GenuineIntel.bin";
45/* Current microcode patch used in early patching on the APs. */ 45/* Current microcode patch used in early patching on the APs. */
46static struct microcode_intel *intel_ucode_patch; 46static struct microcode_intel *intel_ucode_patch;
47 47
48/* last level cache size per core */
49static int llc_size_per_core;
50
48static inline bool cpu_signatures_match(unsigned int s1, unsigned int p1, 51static inline bool cpu_signatures_match(unsigned int s1, unsigned int p1,
49 unsigned int s2, unsigned int p2) 52 unsigned int s2, unsigned int p2)
50{ 53{
@@ -912,12 +915,14 @@ static bool is_blacklisted(unsigned int cpu)
912 915
913 /* 916 /*
914 * Late loading on model 79 with microcode revision less than 0x0b000021 917 * Late loading on model 79 with microcode revision less than 0x0b000021
915 * may result in a system hang. This behavior is documented in item 918 * and LLC size per core bigger than 2.5MB may result in a system hang.
916 * BDF90, #334165 (Intel Xeon Processor E7-8800/4800 v4 Product Family). 919 * This behavior is documented in item BDF90, #334165 (Intel Xeon
920 * Processor E7-8800/4800 v4 Product Family).
917 */ 921 */
918 if (c->x86 == 6 && 922 if (c->x86 == 6 &&
919 c->x86_model == INTEL_FAM6_BROADWELL_X && 923 c->x86_model == INTEL_FAM6_BROADWELL_X &&
920 c->x86_mask == 0x01 && 924 c->x86_mask == 0x01 &&
925 llc_size_per_core > 2621440 &&
921 c->microcode < 0x0b000021) { 926 c->microcode < 0x0b000021) {
922 pr_err_once("Erratum BDF90: late loading with revision < 0x0b000021 (0x%x) disabled.\n", c->microcode); 927 pr_err_once("Erratum BDF90: late loading with revision < 0x0b000021 (0x%x) disabled.\n", c->microcode);
923 pr_err_once("Please consider either early loading through initrd/built-in or a potential BIOS update.\n"); 928 pr_err_once("Please consider either early loading through initrd/built-in or a potential BIOS update.\n");
@@ -975,6 +980,15 @@ static struct microcode_ops microcode_intel_ops = {
975 .apply_microcode = apply_microcode_intel, 980 .apply_microcode = apply_microcode_intel,
976}; 981};
977 982
983static int __init calc_llc_size_per_core(struct cpuinfo_x86 *c)
984{
985 u64 llc_size = c->x86_cache_size * 1024;
986
987 do_div(llc_size, c->x86_max_cores);
988
989 return (int)llc_size;
990}
991
978struct microcode_ops * __init init_intel_microcode(void) 992struct microcode_ops * __init init_intel_microcode(void)
979{ 993{
980 struct cpuinfo_x86 *c = &boot_cpu_data; 994 struct cpuinfo_x86 *c = &boot_cpu_data;
@@ -985,5 +999,7 @@ struct microcode_ops * __init init_intel_microcode(void)
985 return NULL; 999 return NULL;
986 } 1000 }
987 1001
1002 llc_size_per_core = calc_llc_size_per_core(c);
1003
988 return &microcode_intel_ops; 1004 return &microcode_intel_ops;
989} 1005}