* [PATCH v2] cpufreq: intel_pstate: Override parameters if HWP forced by BIOS
@ 2021-09-12 18:50 Doug Smythies
2021-09-13 17:27 ` Rafael J. Wysocki
0 siblings, 1 reply; 2+ messages in thread
From: Doug Smythies @ 2021-09-12 18:50 UTC (permalink / raw)
To: srinivas.pandruvada, rafael, len.brown
Cc: linux-kernel, linux-pm, Doug Smythies
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>
---
drivers/cpufreq/intel_pstate.c | 22 ++++++++++++++--------
1 file changed, 14 insertions(+), 8 deletions(-)
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index 1097f826ad70..8c176b7dae41 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -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,
@@ -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;
@@ -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");
@@ -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"))
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] cpufreq: intel_pstate: Override parameters if HWP forced by BIOS
2021-09-12 18:50 [PATCH v2] cpufreq: intel_pstate: Override parameters if HWP forced by BIOS Doug Smythies
@ 2021-09-13 17:27 ` Rafael J. Wysocki
0 siblings, 0 replies; 2+ messages in thread
From: Rafael J. Wysocki @ 2021-09-13 17:27 UTC (permalink / raw)
To: Doug Smythies
Cc: Srinivas Pandruvada, Rafael J. Wysocki, Len Brown,
Linux Kernel Mailing List, Linux PM, Doug Smythies
On Sun, Sep 12, 2021 at 8:51 PM Doug Smythies <doug.smythies@gmail.com> wrote:
>
> 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>
> ---
> drivers/cpufreq/intel_pstate.c | 22 ++++++++++++++--------
> 1 file changed, 14 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
> index 1097f826ad70..8c176b7dae41 100644
> --- a/drivers/cpufreq/intel_pstate.c
> +++ b/drivers/cpufreq/intel_pstate.c
> @@ -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,
> @@ -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;
> @@ -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");
> @@ -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"))
> --
Applied as 5.15-rc material, thanks!
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-09-13 17:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-12 18:50 [PATCH v2] cpufreq: intel_pstate: Override parameters if HWP forced by BIOS Doug Smythies
2021-09-13 17:27 ` Rafael J. Wysocki
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.