Skip to contentSkip to conversation

x86/ucode/intel: Writeback and invalidate caches before updating microcode

PATCH In review Andrew Cooper 2 participants 2 messages May 4, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/ucode/intel: Writeback and invalidate caches before updating microcode

From: Ashok Raj <[email protected]>

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.

[Linux commit 91df9fdf51492aec9fed6b4cbd33160886740f47, ported to Xen]

---
CC: Jan Beulich <[email protected]>
CC: Wei Liu <[email protected]>
CC: Roger Pau Monné <[email protected]>

---
 xen/arch/x86/cpu/microcode/intel.c | 3 +++
 1 file changed, 3 insertions(+)
xen/arch/x86/cpu/microcode/intel.c +3 -0
index a9f4d6e829..d031196d4c 100644
@@ -25,6 +25,7 @@
 #include <xen/init.h>
 
 #include <asm/msr.h>
+#include <asm/system.h>
 
 #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);
Signature · 1 line
2.11.0
Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · Andrew Cooper

From: Ashok Raj <[email protected]>

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.

Quoted 5 lines
[Linux commit 91df9fdf51492aec9fed6b4cbd33160886740f47, ported to Xen]