Re: [PATCH v7 015/120] x86/cpu: Use parsed CPUID(0x80000002) to CPUID(0x80000004)
"Ahmed S. Darwish" <[email protected]> Fri, 12 Jun 2026 22:10:04 +0200
| Newsgroups | dev.linux.lists.x86-cpuid,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <aixnnLmThoPqkbyb@lx-t490> |
On Thu, 11 Jun 2026, David Laight wrote: > > "Ahmed S. Darwish" <[email protected]> wrote: > > > > - 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; > > Those assignment are nasty. > You could probably use an anon union to do: > c->x86_model_id_leaf_2 = *l2; > I appreciate the feedback, but I'm not gonna modify a central data structure like 'cpuinfo_x86' for the sake of this single call site. A memcpy() can make things look nicer, but IMHO there are more important things to do at this stage. All the best, Ahmed