Summary: Intel x86_64 cpuid(0x15) "Time Stamp Counter and Nominal Core
Crystal Clock Information Leaf" is not working as expected.
When a KVM guest (RTOS) issues a cpuid(eax=0x15) the results are:
cpuid(0x15): eax=0x207, ebx=0x240, ecx=0xa88
cpuid(0x15): eax=519, ebx=576, ecx=2696
According to the description of cpuid(0x15):
- EAX Bits 31-00: An unsigned integer which is the denominator of the
TSC/”core crystal clock” ratio.
- EBX Bits 31-00: An unsigned integer which is the numerator of the TSC/”core
crystal clock” ratio.
- ECX Bits 31-00: An unsigned integer which is the nominal frequency of the
core crystal clock in Hz.
A core crystal clock frequency (ECX) of 2696 Hz is not reasonable. The host is
38.4Mhz.
Curiously cpuid(0x16) is reporting very similar numbers as cpuid(0x15):
cpuid(0x16): eax=0x207, ebx=0x240, ecx=0xa88
cpuid(0x16): eax=519, ebx=576, ecx=2696
I verified that IA32_MISC_ENABLE bit 22 is zero.
The host (ubuntu linux 24.04) reports:
$ cpuid -1 --leaf=0x15
CPU:
Time Stamp Counter/Core Crystal Clock Information (0x15):
TSC/clock ratio = 140/2
nominal core crystal clock = 38400000 Hz
$ cpuid -1 --leaf=0x16
CPU:
Processor Frequency Information (0x16):
Core Base Frequency (MHz) = 0xa8c (2700)
Core Maximum Frequency (MHz) = 0x125c (4700)
Bus (Reference) Frequency (MHz) = 0x64 (100)
$ for leaf in 0x15 0x16; do cpuid -1 --raw --leaf=$leaf | grep -v ^CPU;
done
0x00000015 0x00: eax=0x00000002 ebx=0x0000008c ecx=0x0249f000
edx=0x00000000
0x00000016 0x00: eax=0x00000a8c ebx=0x00000dac ecx=0x00000064
edx=0x00000000
I tried to identify the root cause, but the cpuid source code eluded me.
Any pointers/guidance would be appreciated.
The qemu command line is:
qemu-system-x86_64 -m 1024 -cdrom boot.qemu -boot d -enable-kvm -cpu
Icelake-Server-v6
The boot.qemu is a custom RTOS image booted via grub.