Skip to content

Commit 262fba5

Browse files
committed
x86/cpu: Remove unnecessary MwAIT leaf checks
The CPUID leaf dependency checker will remove X86_FEATURE_MWAIT if the CPUID level is below the required level (CPUID_MWAIT_LEAF). Thus, if you check X86_FEATURE_MWAIT you do not need to also check the CPUID level. Signed-off-by: Dave Hansen <[email protected]> Link: https://lore.kernel.org/all/20241213205030.9B42B458%40davehans-spike.ostc.intel.com
1 parent 8bd6821 commit 262fba5

File tree

4 files changed

+0
-10
lines changed

4 files changed

+0
-10
lines changed

arch/x86/kernel/hpet.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -928,9 +928,6 @@ static bool __init mwait_pc10_supported(void)
928928
if (!cpu_feature_enabled(X86_FEATURE_MWAIT))
929929
return false;
930930

931-
if (boot_cpu_data.cpuid_level < CPUID_MWAIT_LEAF)
932-
return false;
933-
934931
cpuid(CPUID_MWAIT_LEAF, &eax, &ebx, &ecx, &mwait_substates);
935932

936933
return (ecx & CPUID5_ECX_EXTENSIONS_SUPPORTED) &&

arch/x86/kernel/smpboot.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1292,8 +1292,6 @@ static inline void mwait_play_dead(void)
12921292
return;
12931293
if (!this_cpu_has(X86_FEATURE_CLFLUSH))
12941294
return;
1295-
if (__this_cpu_read(cpu_info.cpuid_level) < CPUID_MWAIT_LEAF)
1296-
return;
12971295

12981296
eax = CPUID_MWAIT_LEAF;
12991297
ecx = 0;

drivers/acpi/acpi_pad.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@ static void power_saving_mwait_init(void)
4747

4848
if (!boot_cpu_has(X86_FEATURE_MWAIT))
4949
return;
50-
if (boot_cpu_data.cpuid_level < CPUID_MWAIT_LEAF)
51-
return;
5250

5351
cpuid(CPUID_MWAIT_LEAF, &eax, &ebx, &ecx, &edx);
5452

drivers/idle/intel_idle.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2317,9 +2317,6 @@ static int __init intel_idle_init(void)
23172317
return -ENODEV;
23182318
}
23192319

2320-
if (boot_cpu_data.cpuid_level < CPUID_MWAIT_LEAF)
2321-
return -ENODEV;
2322-
23232320
cpuid(CPUID_MWAIT_LEAF, &eax, &ebx, &ecx, &mwait_substates);
23242321

23252322
if (!(ecx & CPUID5_ECX_EXTENSIONS_SUPPORTED) ||

0 commit comments

Comments
 (0)