Skip to content

Commit 91df9fd

Browse files
ashok-rajKAGA-KOKO
authored andcommitted
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 <[email protected]> Signed-off-by: Borislav Petkov <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Tested-by: Tom Lendacky <[email protected]> Tested-by: Ashok Raj <[email protected]> Cc: Arjan Van De Ven <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Link: https://lkml.kernel.org/r/[email protected]
1 parent c182d2b commit 91df9fd

File tree

1 file changed

+12
-0
lines changed
  • arch/x86/kernel/cpu/microcode

1 file changed

+12
-0
lines changed

arch/x86/kernel/cpu/microcode/intel.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -600,6 +600,12 @@ static int apply_microcode_early(struct ucode_cpu_info *uci, bool early)
600600
return UCODE_OK;
601601
}
602602

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+
603609
/* write microcode via MSR 0x79 */
604610
native_wrmsrl(MSR_IA32_UCODE_WRITE, (unsigned long)mc->bits);
605611

@@ -816,6 +822,12 @@ static enum ucode_state apply_microcode_intel(int cpu)
816822
return UCODE_OK;
817823
}
818824

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+
819831
/* write microcode via MSR 0x79 */
820832
wrmsrl(MSR_IA32_UCODE_WRITE, (unsigned long)mc->bits);
821833

0 commit comments

Comments
 (0)