[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250905121515.192792-16-darwi@linutronix.de>
Date: Fri, 5 Sep 2025 14:14:55 +0200
From: "Ahmed S. Darwish" <darwi@...utronix.de>
To: Borislav Petkov <bp@...en8.de>,
Ingo Molnar <mingo@...hat.com>,
Dave Hansen <dave.hansen@...ux.intel.com>
Cc: Thomas Gleixner <tglx@...utronix.de>,
Andrew Cooper <andrew.cooper3@...rix.com>,
Sean Christopherson <seanjc@...gle.com>,
David Woodhouse <dwmw2@...radead.org>,
"H. Peter Anvin" <hpa@...or.com>,
Peter Zijlstra <peterz@...radead.org>,
Sohil Mehta <sohil.mehta@...el.com>,
John Ogness <john.ogness@...utronix.de>,
x86@...nel.org,
x86-cpuid@...ts.linux.dev,
LKML <linux-kernel@...r.kernel.org>,
"Ahmed S. Darwish" <darwi@...utronix.de>
Subject: [PATCH v5 15/35] x86/cpu: Use parsed CPUID(0x80000002)..CPUID(0x80000004)
For CPU brand string enumeration, use parsed CPUID(0x80000002) to
CPUID(0x80000004) access instead of directly invoking CPUID queries.
This allows centralizing CPUID queries, and the access of their cached
data output, to one place in the kernel.
Signed-off-by: Ahmed S. Darwish <darwi@...utronix.de>
---
arch/x86/kernel/cpu/common.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index 0a0340a7ac1c..1d45dbdd0e05 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -780,16 +780,19 @@ static const struct cpu_dev *cpu_devs[X86_VENDOR_NUM] = {};
static void get_model_name(struct cpuinfo_x86 *c)
{
- unsigned int *v;
+ const struct cpuid_regs *leaf[] = {
+ cpuid_leaf_raw(c, 0x80000002),
+ cpuid_leaf_raw(c, 0x80000003),
+ cpuid_leaf_raw(c, 0x80000004),
+ };
char *p, *q, *s;
- if (c->extended_cpuid_level < 0x80000004)
+ if (!leaf[0] || !leaf[1] || !leaf[2])
return;
- v = (unsigned int *)c->x86_model_id;
- cpuid(0x80000002, &v[0], &v[1], &v[2], &v[3]);
- cpuid(0x80000003, &v[4], &v[5], &v[6], &v[7]);
- cpuid(0x80000004, &v[8], &v[9], &v[10], &v[11]);
+ for (int i = 0; i < ARRAY_SIZE(leaf); i++)
+ *(struct cpuid_regs *)&c->x86_model_id[16 * i] = *leaf[i];
+
c->x86_model_id[48] = 0;
/* Trim whitespace */
--
2.50.1
Powered by blists - more mailing lists