[PATCH v7 065/120] x86/hpet: Use parsed CPUID(0x5)
"Ahmed S. Darwish" <[email protected]> Thu, 28 May 2026 17:38:27 +0200
| Newsgroups | dev.linux.lists.x86-cpuid,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
Use parsed CPUID(0x5) instead of doing ugly bitwise operations and a direct CPUID query. Signed-off-by: Ahmed S. Darwish <[email protected]> --- arch/x86/kernel/hpet.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c index 8dc7b710e125..6f6f4e5072f2 100644 --- a/arch/x86/kernel/hpet.c +++ b/arch/x86/kernel/hpet.c @@ -11,7 +11,6 @@ #include <asm/irq_remapping.h> #include <asm/hpet.h> #include <asm/time.h> -#include <asm/mwait.h> #include <asm/msr.h> #undef pr_fmt @@ -913,19 +912,15 @@ static bool __init hpet_counting(void) static bool __init mwait_pc10_supported(void) { - unsigned int eax, ebx, ecx, mwait_substates; + const struct leaf_0x5_0 *l5 = cpuid_leaf(&boot_cpu_data, 0x5); if (boot_cpu_data.x86_vendor != X86_VENDOR_INTEL) return false; - if (!cpu_feature_enabled(X86_FEATURE_MWAIT)) + if (!l5 || !cpu_feature_enabled(X86_FEATURE_MWAIT)) return false; - cpuid(CPUID_LEAF_MWAIT, &eax, &ebx, &ecx, &mwait_substates); - - return (ecx & CPUID5_ECX_EXTENSIONS_SUPPORTED) && - (ecx & CPUID5_ECX_INTERRUPT_BREAK) && - (mwait_substates & (0xF << 28)); + return l5->mwait_ext && l5->mwait_irq_break && l5->n_c7_substates; } /* -- 2.54.0