Re: [PATCH linux-next 2/2] x86/xen/time: cleanup xen_tsc_safe_clocksource

From: Thomas Gleixner
Date: Mon Feb 20 2023 - 17:01:24 EST


On Mon, Feb 20 2023 at 09:17, Krister Johansen wrote:
> @@ -495,8 +496,7 @@ static int __init xen_tsc_safe_clocksource(void)
> /* Leaf 4, sub-leaf 0 (0x40000x03) */
> cpuid_count(xen_cpuid_base() + 3, 0, &eax, &ebx, &ecx, &edx);
>
> - /* tsc_mode = no_emulate (2) */
> - if (ebx != 2)
> + if (ebx != XEN_CPUID_TSC_MODE_NEVER_EMULATE)
> return 0;
>
> return 1;

What about removing more stupidity from that function?

static bool __init xen_tsc_safe_clocksource(void)
{
u32 eax, ebx. ecx, edx;

/* Leaf 4, sub-leaf 0 (0x40000x03) */
cpuid_count(xen_cpuid_base() + 3, 0, &eax, &ebx, &ecx, &edx);

return ebx == XEN_CPUID_TSC_MODE_NEVER_EMULATE;
}

Thanks,

tglx