Re: [PATCH 3.17 100/141] x86, microcode: Fix accessing dis_ucode_ldr on 32-bit

From: Borislav Petkov
Date: Tue Nov 25 2014 - 16:17:17 EST


On Tue, Nov 25, 2014 at 03:36:34PM -0500, Konrad Rzeszutek Wilk wrote:
> Is there an use-case for this in virtualization at all?

Not that I know of...

> Why not make it in general then? Like:
>
> if (cpu_has_hypervisor)
> return;

Ah, good idea. Although we need to do it by-foot because the cpu_has
stuff hasn't been initialized yet that early. Boris, I'm guessing
something that should work... ?

---
diff --git a/arch/x86/kernel/cpu/microcode/core_early.c b/arch/x86/kernel/cpu/microcode/core_early.c
index 2c017f242a78..77137b317e2a 100644
--- a/arch/x86/kernel/cpu/microcode/core_early.c
+++ b/arch/x86/kernel/cpu/microcode/core_early.c
@@ -74,6 +74,16 @@ static int x86_family(void)
return x86;
}

+static bool x86_guest(void)
+{
+ u32 eax = 0x1;
+ u32 ebx, ecx = 0, edx;
+
+ native_cpuid(&eax, &ebx, &ecx, &edx);
+
+ return !!(ecx & BIT(31));
+}
+
static bool __init check_loader_disabled_bsp(void)
{
#ifdef CONFIG_X86_32
@@ -98,6 +108,9 @@ void __init load_ucode_bsp(void)
{
int vendor, x86;

+ if (x86_guest())
+ return;
+
if (check_loader_disabled_bsp())
return;

@@ -134,6 +147,9 @@ void load_ucode_ap(void)
{
int vendor, x86;

+ if (x86_guest())
+ return;
+
if (check_loader_disabled_ap())
return;

--
Regards/Gruss,
Boris.

Sent from a fat crate under my desk. Formatting is fine.
--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/