lkml.org 
[lkml]   [2021]   [Sep]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] cpufreq: intel_pstate: Override parameters if HWP forced by BIOS
Date
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.

Signed-off-by: Doug Smythies <dsmythies@telus.net>
---
drivers/cpufreq/intel_pstate.c | 22 ++++++++++++++++------
1 file changed, 16 insertions(+), 6 deletions(-)

diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index bb4549959b11..073bae5d4498 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -3267,7 +3267,7 @@ static int __init intel_pstate_init(void)
*/
if ((!no_hwp && boot_cpu_has(X86_FEATURE_HWP_EPP)) ||
intel_pstate_hwp_is_enabled()) {
- hwp_active++;
+ hwp_active = 1;
hwp_mode_bdw = id->driver_data;
intel_pstate.attr = hwp_cpufreq_attrs;
intel_cpufreq.attr = hwp_cpufreq_attrs;
@@ -3347,17 +3347,27 @@ device_initcall(intel_pstate_init);

static int __init intel_pstate_setup(char *str)
{
+ /*
+ * If BIOS is forcing HWP, then parameter
+ * overrides might be needed. Only print
+ * the message once, and regardless of
+ * any overrides.
+ */
+ if(!hwp_active && boot_cpu_has(X86_FEATURE_HWP))
+ if(intel_pstate_hwp_is_enabled()){
+ pr_info("HWP enabled by BIOS\n");
+ hwp_active = 1;
+ }
if (!str)
return -EINVAL;

- if (!strcmp(str, "disable"))
+ if (!strcmp(str, "disable") && !hwp_active)
no_load = 1;
- else if (!strcmp(str, "active"))
+ if (!strcmp(str, "active"))
default_driver = &intel_pstate;
- else if (!strcmp(str, "passive"))
+ if (!strcmp(str, "passive"))
default_driver = &intel_cpufreq;
-
- if (!strcmp(str, "no_hwp")) {
+ if (!strcmp(str, "no_hwp") && !hwp_active) {
pr_info("HWP disabled\n");
no_hwp = 1;
}
--
2.25.1
\
 
 \ /
  Last update: 2021-09-09 05:50    [W:1.556 / U:0.372 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site