aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/cpu/microcode/intel.c
diff options
context:
space:
mode:
authorAshok Raj <ashok.raj@intel.com>2018-02-28 05:28:42 -0500
committerThomas Gleixner <tglx@linutronix.de>2018-03-08 04:19:25 -0500
commit91df9fdf51492aec9fed6b4cbd33160886740f47 (patch)
tree940c5fe62a3610aaa1c1b954c151b41fa02de41d /arch/x86/kernel/cpu/microcode/intel.c
parentc182d2b7d0ca48e0d6ff16f7d883161238c447ed (diff)
x86/microcode/intel: Writeback and invalidate caches before updating microcode
Updating microcode is less error prone when caches have been flushed and depending on what exactly the microcode is updating. For example, some of the issues around certain Broadwell parts can be addressed by doing a full cache flush. [ Borislav: Massage it and use native_wbinvd() in both cases. ] Signed-off-by: Ashok Raj <ashok.raj@intel.com> Signed-off-by: Borislav Petkov <bp@suse.de> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Tested-by: Tom Lendacky <thomas.lendacky@amd.com> Tested-by: Ashok Raj <ashok.raj@intel.com> Cc: Arjan Van De Ven <arjan.van.de.ven@intel.com> Link: http://lkml.kernel.org/r/1519352533-15992-3-git-send-email-ashok.raj@intel.com Link: https://lkml.kernel.org/r/20180228102846.13447-4-bp@alien8.de
Diffstat (limited to 'arch/x86/kernel/cpu/microcode/intel.c')
-rw-r--r--arch/x86/kernel/cpu/microcode/intel.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/arch/x86/kernel/cpu/microcode/intel.c b/arch/x86/kernel/cpu/microcode/intel.c
index 87bd6dc94081..e2864bc2d575 100644
--- a/arch/x86/kernel/cpu/microcode/intel.c
+++ b/arch/x86/kernel/cpu/microcode/intel.c
@@ -600,6 +600,12 @@ static int apply_microcode_early(struct ucode_cpu_info *uci, bool early)
600 return UCODE_OK; 600 return UCODE_OK;
601 } 601 }
602 602
603 /*
604 * Writeback and invalidate caches before updating microcode to avoid
605 * internal issues depending on what the microcode is updating.
606 */
607 native_wbinvd();
608
603 /* write microcode via MSR 0x79 */ 609 /* write microcode via MSR 0x79 */
604 native_wrmsrl(MSR_IA32_UCODE_WRITE, (unsigned long)mc->bits); 610 native_wrmsrl(MSR_IA32_UCODE_WRITE, (unsigned long)mc->bits);
605 611
@@ -816,6 +822,12 @@ static enum ucode_state apply_microcode_intel(int cpu)
816 return UCODE_OK; 822 return UCODE_OK;
817 } 823 }
818 824
825 /*
826 * Writeback and invalidate caches before updating microcode to avoid
827 * internal issues depending on what the microcode is updating.
828 */
829 native_wbinvd();
830
819 /* write microcode via MSR 0x79 */ 831 /* write microcode via MSR 0x79 */
820 wrmsrl(MSR_IA32_UCODE_WRITE, (unsigned long)mc->bits); 832 wrmsrl(MSR_IA32_UCODE_WRITE, (unsigned long)mc->bits);
821 833