Re: [RFC PATCH v3] tools/x86: add kcpuid tool to show raw CPU features

From: Borislav Petkov
Date: Thu Nov 19 2020 - 09:15:49 EST


On Thu, Nov 19, 2020 at 09:50:10PM +0800, Feng Tang wrote:
> That's really odd. I tried on 3 baremetal machines: one Skylake NUC device,
> one Xeon E5-2699 and one Xeon E5-2680.

Ah, sorry, not virt, virt is 0x4000_0000. Yeah, I remember now. It is
function 4 which AMD doesn't implement and I'm running this on AMD:

$ cpuid -1r
CPU:
0x00000000 0x00: eax=0x0000000d ebx=0x68747541 ecx=0x444d4163 edx=0x69746e65
0x00000001 0x00: eax=0x00800f82 ebx=0x0c100800 ecx=0x7ed8320b edx=0x178bfbff
0x00000002 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
0x00000003 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000

<-- no function 4.

0x00000005 0x00: eax=0x00000040 ebx=0x00000040 ecx=0x00000003 edx=0x00000011
...

That's why. :-)

Btw, there are other funny ranges on Intel:

./cpuid -1r
CPU:
0x20000000 0x00: eax=0x00000000 ebx=0x00000001 ecx=0x00000001 edx=0x00000000

That one has 2 bits set.

0x80860000 0x00: eax=0x00000000 ebx=0x00000001 ecx=0x00000001 edx=0x00000000
0xc0000000 0x00: eax=0x00000000 ebx=0x00000001 ecx=0x00000001 edx=0x00000000

And those too.

Fun.

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette