Skip to content

Commit d9a7e9d

Browse files
Doug Smythiesrafaeljw
authored andcommitted
cpufreq: intel_pstate: Override parameters if HWP forced by BIOS
If HWP has been already been enabled by BIOS, it may be necessary to override some kernel command line parameters. Once it has been enabled it requires a reset to be disabled. Suggested-by: Rafael J. Wysocki <rafael@kernel.org> Signed-off-by: Doug Smythies <dsmythies@telus.net> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 6880fa6 commit d9a7e9d

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

drivers/cpufreq/intel_pstate.c

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3205,11 +3205,15 @@ static int __init intel_pstate_init(void)
32053205
if (boot_cpu_data.x86_vendor != X86_VENDOR_INTEL)
32063206
return -ENODEV;
32073207

3208-
if (no_load)
3209-
return -ENODEV;
3210-
32113208
id = x86_match_cpu(hwp_support_ids);
32123209
if (id) {
3210+
bool hwp_forced = intel_pstate_hwp_is_enabled();
3211+
3212+
if (hwp_forced)
3213+
pr_info("HWP enabled by BIOS\n");
3214+
else if (no_load)
3215+
return -ENODEV;
3216+
32133217
copy_cpu_funcs(&core_funcs);
32143218
/*
32153219
* Avoid enabling HWP for processors without EPP support,
@@ -3219,8 +3223,7 @@ static int __init intel_pstate_init(void)
32193223
* If HWP is enabled already, though, there is no choice but to
32203224
* deal with it.
32213225
*/
3222-
if ((!no_hwp && boot_cpu_has(X86_FEATURE_HWP_EPP)) ||
3223-
intel_pstate_hwp_is_enabled()) {
3226+
if ((!no_hwp && boot_cpu_has(X86_FEATURE_HWP_EPP)) || hwp_forced) {
32243227
hwp_active++;
32253228
hwp_mode_bdw = id->driver_data;
32263229
intel_pstate.attr = hwp_cpufreq_attrs;
@@ -3235,7 +3238,11 @@ static int __init intel_pstate_init(void)
32353238

32363239
goto hwp_cpu_matched;
32373240
}
3241+
pr_info("HWP not enabled\n");
32383242
} else {
3243+
if (no_load)
3244+
return -ENODEV;
3245+
32393246
id = x86_match_cpu(intel_pstate_cpu_ids);
32403247
if (!id) {
32413248
pr_info("CPU model not supported\n");
@@ -3314,10 +3321,9 @@ static int __init intel_pstate_setup(char *str)
33143321
else if (!strcmp(str, "passive"))
33153322
default_driver = &intel_cpufreq;
33163323

3317-
if (!strcmp(str, "no_hwp")) {
3318-
pr_info("HWP disabled\n");
3324+
if (!strcmp(str, "no_hwp"))
33193325
no_hwp = 1;
3320-
}
3326+
33213327
if (!strcmp(str, "force"))
33223328
force_load = 1;
33233329
if (!strcmp(str, "hwp_only"))

0 commit comments

Comments
 (0)