Skip to contentSkip to conversation

x86/ucode: Drop the sanity check for interrupts being disabled

PATCH In review Andrew Cooper 2 participants 2 messages Mar 27, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/ucode: Drop the sanity check for interrupts being disabled

Of the substantial number of things which can go wrong during microcode load, this is not one. Loading occurs entirely within the boundary of a single WRMSR instruction. Its certainly not a BUG()-worthy condition.

Xen has legitimate reasons to not want interrupts enabled at this point, but that is to do with organising the system rendezvous. As these are private low level helpers invoked only from the microcode core logic, forgo the check entirely.

While dropping system.h, clean up the processor.h include which was an oversight in the previous header cleanup.

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

An ASSERT() would be one option, but I'd prefer to remove the include.

---
 xen/arch/x86/cpu/microcode/amd.c   | 4 ----
 xen/arch/x86/cpu/microcode/intel.c | 4 ----
 2 files changed, 8 deletions(-)
xen/arch/x86/cpu/microcode/amd.c +0 -4
index 01854be92c..9fe1a3c941 100644
@@ -20,8 +20,6 @@
 
 #include <asm/hvm/svm/svm.h>
 #include <asm/msr.h>
-#include <asm/processor.h>
-#include <asm/system.h>
 
 #include "private.h"
 
@@ -237,8 +235,6 @@ static int apply_microcode(const struct microcode_patch *patch)
 
     hdr = patch->mpb;
 
-    BUG_ON(local_irq_is_enabled());
-
     hw_err = wrmsr_safe(MSR_AMD_PATCHLOADER, (unsigned long)hdr);
 
     /* get patch id after patching */
xen/arch/x86/cpu/microcode/intel.c +0 -4
index bd33f5bc9b..b8b28060f5 100644
@@ -25,8 +25,6 @@
 #include <xen/init.h>
 
 #include <asm/msr.h>
-#include <asm/processor.h>
-#include <asm/system.h>
 
 #include "private.h"
 
@@ -304,8 +302,6 @@ static int apply_microcode(const struct microcode_patch *patch)
     if ( !match_cpu(patch) )
         return -EINVAL;
 
-    BUG_ON(local_irq_is_enabled());
-
     /* write microcode via MSR 0x79 */
     wrmsrl(MSR_IA32_UCODE_WRITE, (unsigned long)patch->data);
 
Signature · 1 line
2.11.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Andrew Cooper

Of the substantial number of things which can go wrong during microcode load, this is not one. Loading occurs entirely within the boundary of a single WRMSR instruction. Its certainly not a BUG()-worthy condition.

Xen has legitimate reasons to not want interrupts enabled at this point, but that is to do with organising the system rendezvous. As these are private low level helpers invoked only from the microcode core logic, forgo the check entirely.

Quoted 4 lines

While dropping system.h, clean up the processor.h include which was an oversight in the previous header cleanup.