lkml.org 
[lkml]   [2018]   [Nov]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 2/3] x86/cpuid: Get vendor ID on the BSP
Date
From: Borislav Petkov <bp@suse.de>

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 <bp@suse.de>
---
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
\
 
 \ /
  Last update: 2018-11-14 22:30    [W:0.060 / U:0.116 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site