Re: [PATCH v1 10/12] tools/x86/kcpuid: Update bitfields to x86-cpuid-db v2.0

From: Ahmed S. Darwish
Date: Mon Mar 10 2025 - 10:47:29 EST


Hi!

On Fri, 07 Mar 2025, H. Peter Anvin wrote:
>
> On Fri, 07 Mar 2025, Ahmed S. Darwish wrote
> >
> > Thanks, I missed that Pentium III can provide leaf 0x3 as well.
> >
> > It seems that leaf 0x3's format differs between Intel and Transmeta.
> > On Intel, PSN is at ECX:EDX, while on Transmeta, the PSN is at
> > EAX:EBX, and ECX:EDX on non-evaluation models provide the rest. [*]
> >
> > Unfortunately, so far, x86-cpuid-db does not support having a CPUID
> > bitfield with different interpretations across vendors.
> >
> > Given that Linux force disables PSN at early boot, I'll just remove
> > that leaf from the database — for now. (Time wise, finishing the new
> > linux/arch/x86/ CPUID data model for mainline submission is a much
> > higher priority.)
> >
>
> You can simply output the 128 bits as is. Some vendors will have zeroes
> in some of the fields, but it doesn't matter.
>

The x86-cpuid-db schema works on a register-by-register basis. For
example, here is db/xml/leaf_03.xml (with Intel added as a vendor):

| <leaf id="0x3">
| <desc>Processor Serial Number (PSN)</desc>
| <text>
| If PSN is disabled, the returned register values are zero.
| </text>
| <vendors>
| <vendor>Intel</vendor>
| <vendor>Transmeta</vendor>
| </vendors>
| <subleaf id="0">
| <eax>...</eax>
| <ebx>...</ebx>
| <ecx>...</ecx>
| <edx>...</edx>
| </subleaf>
| </leaf>

Adding support for a one-shot EAX-EBX-ECX-EDX 128-bit range is definitely
doable, but it will require changes to the project's XML schema. And
given the output format change, the kcpuid CSV file generator and the C99
bitfields header file generator will also need to be changed.

It is doable of course: in no way I'd like to set the project "in stone."
But it's more work than what meets the eye, for a very low-priority leaf.

Thanks!

--
Ahmed S. Darwish
Linutronix GmbH