Skip to content

Commit

Permalink
cpufreq: intel_pstate: Override parameters if HWP forced by BIOS
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Doug Smythies authored and Rafael J. Wysocki committed Sep 13, 2021
1 parent 6880fa6 commit d9a7e9d
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions drivers/cpufreq/intel_pstate.c
Original file line number Diff line number Diff line change
Expand Up @@ -3205,11 +3205,15 @@ static int __init intel_pstate_init(void)
if (boot_cpu_data.x86_vendor != X86_VENDOR_INTEL)
return -ENODEV;

if (no_load)
return -ENODEV;

id = x86_match_cpu(hwp_support_ids);
if (id) {
bool hwp_forced = intel_pstate_hwp_is_enabled();

if (hwp_forced)
pr_info("HWP enabled by BIOS\n");
else if (no_load)
return -ENODEV;

copy_cpu_funcs(&core_funcs);
/*
* Avoid enabling HWP for processors without EPP support,
Expand All @@ -3219,8 +3223,7 @@ static int __init intel_pstate_init(void)
* If HWP is enabled already, though, there is no choice but to
* deal with it.
*/
if ((!no_hwp && boot_cpu_has(X86_FEATURE_HWP_EPP)) ||
intel_pstate_hwp_is_enabled()) {
if ((!no_hwp && boot_cpu_has(X86_FEATURE_HWP_EPP)) || hwp_forced) {
hwp_active++;
hwp_mode_bdw = id->driver_data;
intel_pstate.attr = hwp_cpufreq_attrs;
Expand All @@ -3235,7 +3238,11 @@ static int __init intel_pstate_init(void)

goto hwp_cpu_matched;
}
pr_info("HWP not enabled\n");
} else {
if (no_load)
return -ENODEV;

id = x86_match_cpu(intel_pstate_cpu_ids);
if (!id) {
pr_info("CPU model not supported\n");
Expand Down Expand Up @@ -3314,10 +3321,9 @@ static int __init intel_pstate_setup(char *str)
else if (!strcmp(str, "passive"))
default_driver = &intel_cpufreq;

if (!strcmp(str, "no_hwp")) {
pr_info("HWP disabled\n");
if (!strcmp(str, "no_hwp"))
no_hwp = 1;
}

if (!strcmp(str, "force"))
force_load = 1;
if (!strcmp(str, "hwp_only"))
Expand Down

0 comments on commit d9a7e9d

Please sign in to comment.