Re: [PATCH 2/2] x86/tsc: set LAPIC timer frequency to crystal clock frequency

From: Ingo Molnar
Date: Mon Apr 22 2019 - 08:04:58 EST



* Daniel Drake <drake@xxxxxxxxxxxx> wrote:

> +#ifdef CONFIG_X86_LOCAL_APIC
> + /*
> + * The local APIC appears to be fed by the core crystal clock
> + * (which sounds entirely sensible). We can set the global
> + * lapic_timer_frequency here to avoid having to calibrate the APIC
> + * timer later.
> + */
> + lapic_timer_frequency = (crystal_khz * 1000) / HZ;
> +#endif

Minor style nit: the parentheses are unnecessary, integer expressions
like this are evaluated left to right and multiplication and division has
the same precedence.

But it might also make sense to actually store crystal_mhz instead of
crystal_khz, because both CPUID 15H and 16H provides MHz values.

That way the above expression would simplify to:

lapic_timer_frequency = crystal_mhz / HZ;

Thanks,

Ingo