Re: [PATCH 01/16] x86/tsc: Add a standalone helpers for getting TSC info from CPUID.0x15
From: Sean Christopherson
Date: Wed Feb 05 2025 - 17:13:32 EST
On Fri, Jan 31, 2025, Sean Christopherson wrote:
> +static inline int cpuid_get_tsc_freq(unsigned int *tsc_khz,
> + unsigned int *crystal_khz)
> +{
> + unsigned int denominator, numerator;
> +
> + if (cpuid_get_tsc_info(tsc_khz, &denominator, &numerator))
As pointed out by Dan, this is broken. It should be crystal_khz, not tsc_khz.
I fixed the bug in my test build but clobbered it before posting.
> + return -ENOENT;
> +
> + if (!*crystal_khz)
> + return -ENOENT;
> +
> + *tsc_khz = *crystal_khz * numerator / denominator;
> + return 0;
> +}