From: Borislav Petkov <[email protected]>

No need to do it on each CPU. Read max base CPUID level on each CPU for
now so that the check in cpu_detect() works.

Signed-off-by: Borislav Petkov <[email protected]>
---
 arch/x86/kernel/cpu/common.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index 8a6071614652..f77ca116fba7 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -732,15 +732,21 @@ static void get_cpu_vendor(struct cpuinfo_x86 *c)
        this_cpu = &default_cpu;
 }
 
-void cpu_detect(struct cpuinfo_x86 *c)
+static void cpu_get_vendor_name(void)
 {
-       /* Get vendor name */
-       cpuid(0x00000000, (unsigned int *)&c->cpuid_level,
+       u32 dummy;
+
+       cpuid(0x00000000, &dummy,
              (unsigned int *)&x86_vendor_id[0],
              (unsigned int *)&x86_vendor_id[8],
              (unsigned int *)&x86_vendor_id[4]);
+}
 
+void cpu_detect(struct cpuinfo_x86 *c)
+{
+       c->cpuid_level = cpuid_eax(0);
        c->x86 = 4;
+
        /* Intel-defined flags: level 0x00000001 */
        if (c->cpuid_level >= 0x00000001) {
                u32 junk, tfms, cap0, misc;
@@ -1082,6 +1088,7 @@ static void __init early_identify_cpu(struct cpuinfo_x86 
*c)
 
        /* cyrix could have cpuid enabled via c_identify()*/
        if (have_cpuid_p()) {
+               cpu_get_vendor_name();
                cpu_detect(c);
                get_cpu_vendor(c);
                get_cpu_cap(c);
-- 
2.19.1

Reply via email to