[PATCH] x86/microcode: don't try to load microcode when running as a xen pv guest

From: Juergen Gross
Date: Fri Dec 16 2016 - 01:18:34 EST


As a Xen pv guest some mechanisms to do microcode loading or
verification might not work. As the hypervisor is responsible for
loading the microcode just skip microcode loading in case of running
under Xen.

Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
---
arch/x86/kernel/cpu/microcode/core.c | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/arch/x86/kernel/cpu/microcode/core.c b/arch/x86/kernel/cpu/microcode/core.c
index 6996413..8dfc8bd 100644
--- a/arch/x86/kernel/cpu/microcode/core.c
+++ b/arch/x86/kernel/cpu/microcode/core.c
@@ -32,6 +32,8 @@
#include <linux/fs.h>
#include <linux/mm.h>

+#include <xen/xen.h>
+
#include <asm/microcode_intel.h>
#include <asm/cpu_device_id.h>
#include <asm/microcode_amd.h>
@@ -91,6 +93,9 @@ static bool __init check_loader_disabled_bsp(void)
if (cmdline_find_option_bool(cmdline, option))
*res = true;

+ if (xen_domain())
+ *res = true;
+
return *res;
}

@@ -143,6 +148,9 @@ void __init load_ucode_bsp(void)

static bool check_loader_disabled_ap(void)
{
+ if (xen_domain())
+ return true;
+
#ifdef CONFIG_X86_32
return *((bool *)__pa_nodebug(&dis_ucode_ldr));
#else
--
2.10.2


--------------DC1DDCAC39AE2B6B0F82DC88--