Re: [PATCH v2] Add hardcoded crystal clock for KabyLake

From: Thomas Gleixner
Date: Mon Nov 14 2022 - 17:59:02 EST


On Thu, Oct 20 2022 at 10:18, Dave Hansen wrote:
> On 10/20/22 10:13, Peter Zijlstra wrote:
>> And why, pray *WHY* can't Intel simply write the correct information in
>> CPUID leaf 15h. I mean, they defined the leaf, might as well use it, no?
>
> Is the data that's in the leaf just wrong? Doesn't that mean that the
> CPUID leaf on these models is violating the architecture contract? That
> sounds like something that deserves an erratum.
>
> Is there a documented erratum?

I don't know. The code has this comment:

/*
* Some Intel SoCs like Skylake and Kabylake don't report the crystal
* clock, but we can easily calculate it to a high degree of accuracy
* by considering the crystal ratio and the CPU speed.
*/

so those SoCs fail to expose clock in leaf 15h and then the information
in leaf 16h is so inaccurate that the calculation is off.

Sigh. It's 2022 and we are still relying on crystalball mechanisms to
figure out the damned crystal frequency.

The specification of leaf 15h is:

15H Time Stamp Counter and Nominal Core Crystal Clock Information Leaf
NOTES:
If EBX[31:0] is 0, the TSC/”core crystal clock” ratio is not enumerated.
If ECX is 0, the nominal core crystal clock frequency is not enumerated.

IOW, this CPUID leaf is defined to be useless and leaves it up to the
SoC integration to provide this information or not. It needs even two
fields to chose from to make it useless...

I'm sure this took 10+ draft versions and consumed a non-quantifiable
amount of work hours to come up with this joke.

Thanks,

tglx