[PATCH v6 20/90] x86/cpu: Use parsed CPUID(0x80000002) to CPUID(0x80000004)
From: Ahmed S. Darwish
Date: Thu Mar 26 2026 - 22:32:01 EST
For CPU brand string enumeration, use parsed CPUID(0x80000002) to
CPUID(0x80000004) instead of invoking direct CPUID queries.
This centralizes CPUID invocation to the system's CPUID parser.
Signed-off-by: Ahmed S. Darwish <darwi@xxxxxxxxxxxxx>
---
arch/x86/kernel/cpu/common.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index 204c1f65f265..060f69ab3739 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -824,16 +824,18 @@ static const struct cpu_dev *cpu_devs[X86_VENDOR_NUM] = {};
static void get_model_name(struct cpuinfo_x86 *c)
{
- unsigned int *v;
+ const struct leaf_0x80000002_0 *l2 = cpuid_leaf(c, 0x80000002);
+ const struct leaf_0x80000003_0 *l3 = cpuid_leaf(c, 0x80000003);
+ const struct leaf_0x80000004_0 *l4 = cpuid_leaf(c, 0x80000004);
char *p, *q, *s;
- if (c->extended_cpuid_level < 0x80000004)
+ if (!l2 || !l3 || !l4)
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]);
+ *(struct leaf_0x80000002_0 *)&c->x86_model_id[0] = *l2;
+ *(struct leaf_0x80000003_0 *)&c->x86_model_id[16] = *l3;
+ *(struct leaf_0x80000004_0 *)&c->x86_model_id[32] = *l4;
+
c->x86_model_id[48] = 0;
/* Trim whitespace */
--
2.53.0