diff options
| author | Thomas Gleixner <[email protected]> | 2018-02-16 15:47:26 +0100 | 
|---|---|---|
| committer | Thomas Gleixner <[email protected]> | 2018-02-16 15:47:26 +0100 | 
| commit | 6dee6ae9d62642e81def4d461d71f13a6496ab59 (patch) | |
| tree | 6c75d416c427a59f190e197ad83fe59b7bebf656 /arch/x86/kernel/cpu/intel.c | |
| parent | 1beaeacdc88b537703d04d5536235d0bbb36db93 (diff) | |
| parent | 0b24a0bbe2147815d982d9335c41bb10c04f40bc (diff) | |
Merge tag 'irqchip-4.16-2' of git://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms into irq/urgent
Pull irqchip updates for 4.16-rc2 from Marc Zyngier
 - A MIPS GIC fix for spurious, masked interrupts
 - A fix for a subtle IPI bug in GICv3
 - Do not probe GICv3 ITSs that are marked as disabled
 - Multi-MSI support for GICv2m
 - Various cleanups
Diffstat (limited to 'arch/x86/kernel/cpu/intel.c')
| -rw-r--r-- | arch/x86/kernel/cpu/intel.c | 66 | 
1 files changed, 66 insertions, 0 deletions
| diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c index b1af22073e28..319bf989fad1 100644 --- a/arch/x86/kernel/cpu/intel.c +++ b/arch/x86/kernel/cpu/intel.c @@ -102,6 +102,59 @@ static void probe_xeon_phi_r3mwait(struct cpuinfo_x86 *c)  		ELF_HWCAP2 |= HWCAP2_RING3MWAIT;  } +/* + * Early microcode releases for the Spectre v2 mitigation were broken. + * Information taken from; + * - https://newsroom.intel.com/wp-content/uploads/sites/11/2018/01/microcode-update-guidance.pdf + * - https://kb.vmware.com/s/article/52345 + * - Microcode revisions observed in the wild + * - Release note from 20180108 microcode release + */ +struct sku_microcode { +	u8 model; +	u8 stepping; +	u32 microcode; +}; +static const struct sku_microcode spectre_bad_microcodes[] = { +	{ INTEL_FAM6_KABYLAKE_DESKTOP,	0x0B,	0x84 }, +	{ INTEL_FAM6_KABYLAKE_DESKTOP,	0x0A,	0x84 }, +	{ INTEL_FAM6_KABYLAKE_DESKTOP,	0x09,	0x84 }, +	{ INTEL_FAM6_KABYLAKE_MOBILE,	0x0A,	0x84 }, +	{ INTEL_FAM6_KABYLAKE_MOBILE,	0x09,	0x84 }, +	{ INTEL_FAM6_SKYLAKE_X,		0x03,	0x0100013e }, +	{ INTEL_FAM6_SKYLAKE_X,		0x04,	0x0200003c }, +	{ INTEL_FAM6_SKYLAKE_MOBILE,	0x03,	0xc2 }, +	{ INTEL_FAM6_SKYLAKE_DESKTOP,	0x03,	0xc2 }, +	{ INTEL_FAM6_BROADWELL_CORE,	0x04,	0x28 }, +	{ INTEL_FAM6_BROADWELL_GT3E,	0x01,	0x1b }, +	{ INTEL_FAM6_BROADWELL_XEON_D,	0x02,	0x14 }, +	{ INTEL_FAM6_BROADWELL_XEON_D,	0x03,	0x07000011 }, +	{ INTEL_FAM6_BROADWELL_X,	0x01,	0x0b000025 }, +	{ INTEL_FAM6_HASWELL_ULT,	0x01,	0x21 }, +	{ INTEL_FAM6_HASWELL_GT3E,	0x01,	0x18 }, +	{ INTEL_FAM6_HASWELL_CORE,	0x03,	0x23 }, +	{ INTEL_FAM6_HASWELL_X,		0x02,	0x3b }, +	{ INTEL_FAM6_HASWELL_X,		0x04,	0x10 }, +	{ INTEL_FAM6_IVYBRIDGE_X,	0x04,	0x42a }, +	/* Updated in the 20180108 release; blacklist until we know otherwise */ +	{ INTEL_FAM6_ATOM_GEMINI_LAKE,	0x01,	0x22 }, +	/* Observed in the wild */ +	{ INTEL_FAM6_SANDYBRIDGE_X,	0x06,	0x61b }, +	{ INTEL_FAM6_SANDYBRIDGE_X,	0x07,	0x712 }, +}; + +static bool bad_spectre_microcode(struct cpuinfo_x86 *c) +{ +	int i; + +	for (i = 0; i < ARRAY_SIZE(spectre_bad_microcodes); i++) { +		if (c->x86_model == spectre_bad_microcodes[i].model && +		    c->x86_mask == spectre_bad_microcodes[i].stepping) +			return (c->microcode <= spectre_bad_microcodes[i].microcode); +	} +	return false; +} +  static void early_init_intel(struct cpuinfo_x86 *c)  {  	u64 misc_enable; @@ -122,6 +175,19 @@ static void early_init_intel(struct cpuinfo_x86 *c)  	if (c->x86 >= 6 && !cpu_has(c, X86_FEATURE_IA64))  		c->microcode = intel_get_microcode_revision(); +	/* Now if any of them are set, check the blacklist and clear the lot */ +	if ((cpu_has(c, X86_FEATURE_SPEC_CTRL) || +	     cpu_has(c, X86_FEATURE_INTEL_STIBP) || +	     cpu_has(c, X86_FEATURE_IBRS) || cpu_has(c, X86_FEATURE_IBPB) || +	     cpu_has(c, X86_FEATURE_STIBP)) && bad_spectre_microcode(c)) { +		pr_warn("Intel Spectre v2 broken microcode detected; disabling Speculation Control\n"); +		setup_clear_cpu_cap(X86_FEATURE_IBRS); +		setup_clear_cpu_cap(X86_FEATURE_IBPB); +		setup_clear_cpu_cap(X86_FEATURE_STIBP); +		setup_clear_cpu_cap(X86_FEATURE_SPEC_CTRL); +		setup_clear_cpu_cap(X86_FEATURE_INTEL_STIBP); +	} +  	/*  	 * Atom erratum AAE44/AAF40/AAG38/AAH41:  	 * |