From: Borislav Petkov <bp@alien8.de>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: X86 ML <x86@kernel.org>, LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH 2/3] x86/cpuid: Get vendor ID on the BSP
Date: Wed, 14 Nov 2018 22:28:42 +0100 [thread overview]
Message-ID: <20181114212843.16954-3-bp@alien8.de> (raw)
In-Reply-To: <20181114212843.16954-1-bp@alien8.de>
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
next prev parent reply other threads:[~2018-11-14 21:29 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-14 21:28 [PATCH 0/3] x86/CPUID: CPUID parsing rework, p1 Borislav Petkov
2018-11-14 21:28 ` [PATCH 1/3] x86/cpuid: Make cpuinfo_x86.x86_vendor_id global Borislav Petkov
2018-11-14 21:28 ` Borislav Petkov [this message]
2018-11-14 21:28 ` [PATCH 3/3] x86/cpuid: Make cpuinfo_x86.x86_model_id global Borislav Petkov
2018-11-27 15:55 ` Andy Shevchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181114212843.16954-3-bp@alien8.de \
--to=bp@alien8.de \
--cc=linux-kernel@vger.kernel.org \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox