Commit 74c3e3fc authored by H. Peter Anvin's avatar H. Peter Anvin

x86, microcode: Verify the family before dispatching microcode patching

For each CPU vendor that implements CPU microcode patching, there will
be a minimum family for which this is implemented.  Verify this
minimum level of support.

This can be done in the dispatch function or early in the application
functions.  Doing the latter turned out to be somewhat awkward because
of the ineviable split between the BSP and the AP paths, and rather
than pushing deep into the application functions, do this in
the dispatch function.
Reported-by: default avatar"Bryan O'Donoghue" <bryan.odonoghue.lkml@nexus-software.ie>
Suggested-by: default avatarBorislav Petkov <bp@alien8.de>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Link: http://lkml.kernel.org/r/1366392183-4149-1-git-send-email-bryan.odonoghue.lkml@nexus-software.ie
parent 7eff7ded
...@@ -45,9 +45,6 @@ static int __cpuinit x86_vendor(void) ...@@ -45,9 +45,6 @@ static int __cpuinit x86_vendor(void)
u32 eax = 0x00000000; u32 eax = 0x00000000;
u32 ebx, ecx = 0, edx; u32 ebx, ecx = 0, edx;
if (!have_cpuid_p())
return X86_VENDOR_UNKNOWN;
native_cpuid(&eax, &ebx, &ecx, &edx); native_cpuid(&eax, &ebx, &ecx, &edx);
if (CPUID_IS(CPUID_INTEL1, CPUID_INTEL2, CPUID_INTEL3, ebx, ecx, edx)) if (CPUID_IS(CPUID_INTEL1, CPUID_INTEL2, CPUID_INTEL3, ebx, ecx, edx))
...@@ -59,18 +56,45 @@ static int __cpuinit x86_vendor(void) ...@@ -59,18 +56,45 @@ static int __cpuinit x86_vendor(void)
return X86_VENDOR_UNKNOWN; return X86_VENDOR_UNKNOWN;
} }
static int __cpuinit x86_family(void)
{
u32 eax = 0x00000001;
u32 ebx, ecx = 0, edx;
int x86;
native_cpuid(&eax, &ebx, &ecx, &edx);
x86 = (eax >> 8) & 0xf;
if (x86 == 15)
x86 += (eax >> 20) & 0xff;
return x86;
}
void __init load_ucode_bsp(void) void __init load_ucode_bsp(void)
{ {
int vendor = x86_vendor(); int vendor, x86;
if (!have_cpuid_p())
return;
if (vendor == X86_VENDOR_INTEL) vendor = x86_vendor();
x86 = x86_family();
if (vendor == X86_VENDOR_INTEL && x86 >= 6)
load_ucode_intel_bsp(); load_ucode_intel_bsp();
} }
void __cpuinit load_ucode_ap(void) void __cpuinit load_ucode_ap(void)
{ {
int vendor = x86_vendor(); int vendor, x86;
if (!have_cpuid_p())
return;
vendor = x86_vendor();
x86 = x86_family();
if (vendor == X86_VENDOR_INTEL) if (vendor == X86_VENDOR_INTEL && x86 >= 6)
load_ucode_intel_ap(); load_ucode_intel_ap();
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment