From: Ashok Raj Date: Wed, 28 Feb 2018 10:28:42 +0000 (+0000) Subject: x86/ucode/intel: Writeback and invalidate caches before updating microcode X-Git-Tag: archive/raspbian/4.14.0+80-gd101b417b7-1+rpi1^2~63^2~303 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=77c82949990edaf21130be842a289a7fb7a439e1;p=xen.git x86/ucode/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. Signed-off-by: Ashok Raj Signed-off-by: Borislav Petkov Signed-off-by: Thomas Gleixner [Linux commit 91df9fdf51492aec9fed6b4cbd33160886740f47, ported to Xen] Signed-off-by: Andrew Cooper Acked-by: Jan Beulich --- diff --git a/xen/arch/x86/cpu/microcode/intel.c b/xen/arch/x86/cpu/microcode/intel.c index a9f4d6e829..d031196d4c 100644 --- a/xen/arch/x86/cpu/microcode/intel.c +++ b/xen/arch/x86/cpu/microcode/intel.c @@ -25,6 +25,7 @@ #include #include +#include #include "private.h" @@ -267,6 +268,8 @@ static int apply_microcode(const struct microcode_patch *patch) if ( microcode_update_match(patch) != NEW_UCODE ) return -EINVAL; + wbinvd(); + /* write microcode via MSR 0x79 */ wrmsrl(MSR_IA32_UCODE_WRITE, (unsigned long)patch->data); wrmsrl(MSR_IA32_UCODE_REV, 0x0ULL);