kernel: intel_pstate: Support newer CPUs

This commit cherry-picks commits from the mainline kernel tree to let
the intel_pstate support the following newer CPUs in certain cases:

* Ice Lake
* Sapphire Rapids

Support for the following cases are added:

* When hardware P-states (HWP) is disabled in the BIOS/firmware, then
  the intel_pstate driver will still get enabled (albeit in 'passive'
  mode) for these CPUs, as opposed to the intel_pstate driver reporting
  that the CPU is not supported.

* When out-of-band (OOB) P-state management is enabled with Ice Lake and
  Sapphire Rapids CPUs, then the intel_pstate driver gracefully disables
  itself, as the BIOS/platform firmware is responsible for managing the
  HWP in such cases.

The following bullet point list depicts the commits that have been
cherry-picked, along with the output of "git describe --contains" for
each commit, to provide a sense of how recent each commit is:

* commit fbdc21e9b038 ("cpufreq: intel_pstate: Add Icelake servers
  support in no-HWP mode") (v5.14-rc1~144^2~1^2~1^2~6)

* commit cd23f02f1668 ("cpufreq: intel_pstate: Add Ice Lake server to
  out-of-band IDs") (v5.16-rc3~24^2~3)

* commit bbd67f1b5a94 ("cpufreq: intel_pstate: Support Sapphire Rapids
  OOB mode") (v5.19-rc1~182^2~2^2~11)

* commit df51f287b5de ("cpufreq: intel_pstate: Add Sapphire Rapids
  support in no-HWP mode") (v6.2-rc1~189^2~3^2~4)

We should note that we considered cherry-picking the following commits
too, but we opted to not do that due to the reasons discussed below:

* commit 706c5328851d ("cpufreq: intel_pstate: Add Cometlake support in
  no-HWP mode") (v5.14-rc1~144^2~1^2~1^2~5)

* commit b6e6f8beec98 ("cpufreq: intel_pstate: Update EPP for AlderLake
  mobile") (v5.17-rc1~167^2~2^2~21)

* commit 71bb5c82aaae ("cpufreq: intel_pstate: Add Tigerlake support in
  no-HWP mode") (v6.1-rc1~205^2~1^2~1)

* commit 60675225ebee ("cpufreq: intel_pstate: Adjust
  balance_performance EPP for Sapphire Rapids") (v6.3-rc1~21^2~6)

The commits related to Comet Lake and Tiger Lake were skipped, because
they refer to non-server class CPUs to the best of our knowledge, and
StarlingX is usually run on server-class hardware.

The commit for Alder Lake mobile CPUs is a dependency for the commit
that adjusts the Energy/Performance Preference (EPP) setting for
Sapphire Rapids CPUs. The latter commit improves performance when the
'powersave' governor is used, or when balance_performance setting is
used in the BIOS. While it is possible to cherry-pick both of these
commits (which was done in an earlier iteration of this commit), we
opted to not do that, mainly to keep the scope of this commit smaller,
and also because the two commits appeared optional (as opposed to
necessary) to us.

Verification

- The standard and real-time kernel packages were successfully built
  with this commit.

- An ISO image, built with a slightly different version of this commit
  for an older CentOS-based StarlingX version, containing Ice Lake
  CPU-related changes only, was installed onto a server that has an Ice
  Lake Xeon CPU, with HWP disabled and with out-of-band hardware P-state
  management enabled in the BIOS. This resulted in the intel_pstate
  driver being disabled, as expected.

- A StarlingX ISO image based on the StarlingX master branch with this
  commit included was successfully installed onto a server with a
  Sapphire Rapids Xeon CPU, in low-latency All-in-One simplex mode.
  (Please note that the server was not Ansible-bootstrapped due to
  unrelated difficulties.)

  The intel_pstate driver was successfully initialized for the case
  where HWP was enabled ("Native Mode") in the BIOS settings, and for
  the case where HWP was turned off ("Disabled") in the BIOS settings.
  For the former case, intel_pstate's status was reported as "active",
  and for the latter case, intel_pstate's status was reported as
  "passive", as indicated by
  "/sys/devices/system/cpu/intel_pstate/status".

  Prior to this commit, with HWP disabled in the BIOS, intel_pstate
  would not load due to the CPU not being recognized.

- On the same server with a Sapphire Rapids CPU, enabling out-of-band
  HWP management caused the intel_pstate driver to disable itself by
  printing out "P-states controlled by the platform" and returning
  -ENODEV, as expected.

Partial-Bug: 2016028
Change-Id: I55384c2239d6543662eeef62e86a4b8951887fd7
Signed-off-by: M. Vefa Bicakci <vefa.bicakci@windriver.com>
This commit is contained in:
M. Vefa Bicakci 2023-04-25 00:44:49 +00:00
parent d5db2760ab
commit 8829ae9ffa
10 changed files with 318 additions and 0 deletions

View File

@ -0,0 +1,39 @@
From 71c5dda28cd1b6e2e4257a7ed511abd74b6bd46f Mon Sep 17 00:00:00 2001
From: Giovanni Gherdovich <ggherdovich@suse.cz>
Date: Tue, 18 May 2021 14:34:12 +0200
Subject: [PATCH] cpufreq: intel_pstate: Add Icelake servers support in no-HWP
mode
Users may disable HWP in firmware, in which case intel_pstate wouldn't load
unless the CPU model is explicitly supported.
Add ICELAKE_X to the list of CPUs that can register intel_pstate while not
advertising the HWP capability. Without this change, an ICELAKE_X in no-HWP
mode could only use the acpi_cpufreq frequency scaling driver.
See also commit d8de7a44e11f ("cpufreq: intel_pstate: Add Skylake servers
support").
Signed-off-by: Giovanni Gherdovich <ggherdovich@suse.cz>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit fbdc21e9b038d00d0d56fa4e0f7701d42ae08f00)
Signed-off-by: M. Vefa Bicakci <vefa.bicakci@windriver.com>
---
drivers/cpufreq/intel_pstate.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index 1686705bee7b..14504c761588 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -2100,6 +2100,7 @@ static const struct x86_cpu_id intel_pstate_cpu_ids[] = {
X86_MATCH(ATOM_GOLDMONT, core_funcs),
X86_MATCH(ATOM_GOLDMONT_PLUS, core_funcs),
X86_MATCH(SKYLAKE_X, core_funcs),
+ X86_MATCH(ICELAKE_X, core_funcs),
{}
};
MODULE_DEVICE_TABLE(x86cpu, intel_pstate_cpu_ids);
--
2.25.1

View File

@ -0,0 +1,39 @@
From 701f897e8c760bfa30013c152a783a7bd5ee0cf6 Mon Sep 17 00:00:00 2001
From: Adamos Ttofari <attofari@amazon.de>
Date: Fri, 12 Nov 2021 09:16:57 +0000
Subject: [PATCH] cpufreq: intel_pstate: Add Ice Lake server to out-of-band IDs
Commit fbdc21e9b038 ("cpufreq: intel_pstate: Add Icelake servers
support in no-HWP mode") enabled the use of Intel P-State driver
for Ice Lake servers.
But it doesn't cover the case when OS can't control P-States.
Therefore, for Ice Lake server, if MSR_MISC_PWR_MGMT bits 8 or 18
are enabled, then the Intel P-State driver should exit as OS can't
control P-States.
Fixes: fbdc21e9b038 ("cpufreq: intel_pstate: Add Icelake servers support in no-HWP mode")
Signed-off-by: Adamos Ttofari <attofari@amazon.de>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit cd23f02f166892603eb9f2d488152b975872b682)
Signed-off-by: M. Vefa Bicakci <vefa.bicakci@windriver.com>
---
drivers/cpufreq/intel_pstate.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index 14504c761588..1bf7ae2ec8cd 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -2109,6 +2109,7 @@ static const struct x86_cpu_id intel_pstate_cpu_oob_ids[] __initconst = {
X86_MATCH(BROADWELL_D, core_funcs),
X86_MATCH(BROADWELL_X, core_funcs),
X86_MATCH(SKYLAKE_X, core_funcs),
+ X86_MATCH(ICELAKE_X, core_funcs),
{}
};
--
2.25.1

View File

@ -0,0 +1,33 @@
From d657b378a206105f0b84348f22aa913c5383fccb Mon Sep 17 00:00:00 2001
From: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Date: Mon, 2 May 2022 13:50:52 -0700
Subject: [PATCH] cpufreq: intel_pstate: Support Sapphire Rapids OOB mode
Prevent intel_pstate to load when OOB (Out Of Band) P-states mode is
enabled in Sapphire Rapids. The OOB identifying bits are same as the
prior generation CPUs like Ice Lake servers. So, also add Sapphire
Rapids to intel_pstate_cpu_oob_ids list.
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit bbd67f1b5a9449b090560ca5288aef0cfe623275)
Signed-off-by: M. Vefa Bicakci <vefa.bicakci@windriver.com>
---
drivers/cpufreq/intel_pstate.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index 1bf7ae2ec8cd..3f894834fdee 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -2110,6 +2110,7 @@ static const struct x86_cpu_id intel_pstate_cpu_oob_ids[] __initconst = {
X86_MATCH(BROADWELL_X, core_funcs),
X86_MATCH(SKYLAKE_X, core_funcs),
X86_MATCH(ICELAKE_X, core_funcs),
+ X86_MATCH(SAPPHIRERAPIDS_X, core_funcs),
{}
};
--
2.25.1

View File

@ -0,0 +1,44 @@
From 829bfd11150f073c93c2f07188843ae6ad6bdb3b Mon Sep 17 00:00:00 2001
From: Giovanni Gherdovich <ggherdovich@suse.cz>
Date: Mon, 21 Nov 2022 16:35:40 +0100
Subject: [PATCH] cpufreq: intel_pstate: Add Sapphire Rapids support in no-HWP
mode
Users may disable HWP in firmware, in which case intel_pstate wouldn't load
unless the CPU model is explicitly supported.
See also the following past commits:
commit d8de7a44e11f ("cpufreq: intel_pstate: Add Skylake servers support")
commit 706c5328851d ("cpufreq: intel_pstate: Add Cometlake support in
no-HWP mode")
commit fbdc21e9b038 ("cpufreq: intel_pstate: Add Icelake servers support in
no-HWP mode")
commit 71bb5c82aaae ("cpufreq: intel_pstate: Add Tigerlake support in
no-HWP mode")
Signed-off-by: Giovanni Gherdovich <ggherdovich@suse.cz>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit df51f287b5de3b9d4fd39593eafd1f8298d711c7)
[ mvb: Fix a minor merge conflict involving missing Tiger Lake CPU
support in StarlingX. ]
Signed-off-by: M. Vefa Bicakci <vefa.bicakci@windriver.com>
---
drivers/cpufreq/intel_pstate.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index 3f894834fdee..431c4068b62d 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -2101,6 +2101,7 @@ static const struct x86_cpu_id intel_pstate_cpu_ids[] = {
X86_MATCH(ATOM_GOLDMONT_PLUS, core_funcs),
X86_MATCH(SKYLAKE_X, core_funcs),
X86_MATCH(ICELAKE_X, core_funcs),
+ X86_MATCH(SAPPHIRERAPIDS_X, core_funcs),
{}
};
MODULE_DEVICE_TABLE(x86cpu, intel_pstate_cpu_ids);
--
2.25.1

View File

@ -48,3 +48,7 @@
0050-kernfs-prevent-early-freeing-of-root-node.patch
0051-kernfs-remove-redundant-kernfs_rwsem-declaration.patch
0052-kernfs-fix-NULL-dereferencing-in-kernfs_remove.patch
0053-cpufreq-intel_pstate-Add-Icelake-servers-support-in-.patch
0054-cpufreq-intel_pstate-Add-Ice-Lake-server-to-out-of-b.patch
0055-cpufreq-intel_pstate-Support-Sapphire-Rapids-OOB-mod.patch
0056-cpufreq-intel_pstate-Add-Sapphire-Rapids-support-in-.patch

View File

@ -0,0 +1,39 @@
From d92d4ffc712f4782e5bc022d99d45c463966e41a Mon Sep 17 00:00:00 2001
From: Giovanni Gherdovich <ggherdovich@suse.cz>
Date: Tue, 18 May 2021 14:34:12 +0200
Subject: [PATCH] cpufreq: intel_pstate: Add Icelake servers support in no-HWP
mode
Users may disable HWP in firmware, in which case intel_pstate wouldn't load
unless the CPU model is explicitly supported.
Add ICELAKE_X to the list of CPUs that can register intel_pstate while not
advertising the HWP capability. Without this change, an ICELAKE_X in no-HWP
mode could only use the acpi_cpufreq frequency scaling driver.
See also commit d8de7a44e11f ("cpufreq: intel_pstate: Add Skylake servers
support").
Signed-off-by: Giovanni Gherdovich <ggherdovich@suse.cz>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit fbdc21e9b038d00d0d56fa4e0f7701d42ae08f00)
Signed-off-by: M. Vefa Bicakci <vefa.bicakci@windriver.com>
---
drivers/cpufreq/intel_pstate.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index 1686705bee7b..14504c761588 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -2100,6 +2100,7 @@ static const struct x86_cpu_id intel_pstate_cpu_ids[] = {
X86_MATCH(ATOM_GOLDMONT, core_funcs),
X86_MATCH(ATOM_GOLDMONT_PLUS, core_funcs),
X86_MATCH(SKYLAKE_X, core_funcs),
+ X86_MATCH(ICELAKE_X, core_funcs),
{}
};
MODULE_DEVICE_TABLE(x86cpu, intel_pstate_cpu_ids);
--
2.25.1

View File

@ -0,0 +1,39 @@
From d72271f839550c054d93e797825bd749bd5a8f6a Mon Sep 17 00:00:00 2001
From: Adamos Ttofari <attofari@amazon.de>
Date: Fri, 12 Nov 2021 09:16:57 +0000
Subject: [PATCH] cpufreq: intel_pstate: Add Ice Lake server to out-of-band IDs
Commit fbdc21e9b038 ("cpufreq: intel_pstate: Add Icelake servers
support in no-HWP mode") enabled the use of Intel P-State driver
for Ice Lake servers.
But it doesn't cover the case when OS can't control P-States.
Therefore, for Ice Lake server, if MSR_MISC_PWR_MGMT bits 8 or 18
are enabled, then the Intel P-State driver should exit as OS can't
control P-States.
Fixes: fbdc21e9b038 ("cpufreq: intel_pstate: Add Icelake servers support in no-HWP mode")
Signed-off-by: Adamos Ttofari <attofari@amazon.de>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit cd23f02f166892603eb9f2d488152b975872b682)
Signed-off-by: M. Vefa Bicakci <vefa.bicakci@windriver.com>
---
drivers/cpufreq/intel_pstate.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index 14504c761588..1bf7ae2ec8cd 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -2109,6 +2109,7 @@ static const struct x86_cpu_id intel_pstate_cpu_oob_ids[] __initconst = {
X86_MATCH(BROADWELL_D, core_funcs),
X86_MATCH(BROADWELL_X, core_funcs),
X86_MATCH(SKYLAKE_X, core_funcs),
+ X86_MATCH(ICELAKE_X, core_funcs),
{}
};
--
2.25.1

View File

@ -0,0 +1,33 @@
From 3f316b2b3ee9ea147cd2392ff9580ec7cdd3ddce Mon Sep 17 00:00:00 2001
From: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Date: Mon, 2 May 2022 13:50:52 -0700
Subject: [PATCH] cpufreq: intel_pstate: Support Sapphire Rapids OOB mode
Prevent intel_pstate to load when OOB (Out Of Band) P-states mode is
enabled in Sapphire Rapids. The OOB identifying bits are same as the
prior generation CPUs like Ice Lake servers. So, also add Sapphire
Rapids to intel_pstate_cpu_oob_ids list.
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit bbd67f1b5a9449b090560ca5288aef0cfe623275)
Signed-off-by: M. Vefa Bicakci <vefa.bicakci@windriver.com>
---
drivers/cpufreq/intel_pstate.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index 1bf7ae2ec8cd..3f894834fdee 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -2110,6 +2110,7 @@ static const struct x86_cpu_id intel_pstate_cpu_oob_ids[] __initconst = {
X86_MATCH(BROADWELL_X, core_funcs),
X86_MATCH(SKYLAKE_X, core_funcs),
X86_MATCH(ICELAKE_X, core_funcs),
+ X86_MATCH(SAPPHIRERAPIDS_X, core_funcs),
{}
};
--
2.25.1

View File

@ -0,0 +1,44 @@
From 16e79a6cd1e512ee283a917a9ed54550ca56bc7d Mon Sep 17 00:00:00 2001
From: Giovanni Gherdovich <ggherdovich@suse.cz>
Date: Mon, 21 Nov 2022 16:35:40 +0100
Subject: [PATCH] cpufreq: intel_pstate: Add Sapphire Rapids support in no-HWP
mode
Users may disable HWP in firmware, in which case intel_pstate wouldn't load
unless the CPU model is explicitly supported.
See also the following past commits:
commit d8de7a44e11f ("cpufreq: intel_pstate: Add Skylake servers support")
commit 706c5328851d ("cpufreq: intel_pstate: Add Cometlake support in
no-HWP mode")
commit fbdc21e9b038 ("cpufreq: intel_pstate: Add Icelake servers support in
no-HWP mode")
commit 71bb5c82aaae ("cpufreq: intel_pstate: Add Tigerlake support in
no-HWP mode")
Signed-off-by: Giovanni Gherdovich <ggherdovich@suse.cz>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit df51f287b5de3b9d4fd39593eafd1f8298d711c7)
[ mvb: Fix a minor merge conflict involving missing Tiger Lake CPU
support in StarlingX. ]
Signed-off-by: M. Vefa Bicakci <vefa.bicakci@windriver.com>
---
drivers/cpufreq/intel_pstate.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index 3f894834fdee..431c4068b62d 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -2101,6 +2101,7 @@ static const struct x86_cpu_id intel_pstate_cpu_ids[] = {
X86_MATCH(ATOM_GOLDMONT_PLUS, core_funcs),
X86_MATCH(SKYLAKE_X, core_funcs),
X86_MATCH(ICELAKE_X, core_funcs),
+ X86_MATCH(SAPPHIRERAPIDS_X, core_funcs),
{}
};
MODULE_DEVICE_TABLE(x86cpu, intel_pstate_cpu_ids);
--
2.25.1

View File

@ -47,3 +47,7 @@
0049-kernfs-prevent-early-freeing-of-root-node.patch
0050-kernfs-remove-redundant-kernfs_rwsem-declaration.patch
0051-kernfs-fix-NULL-dereferencing-in-kernfs_remove.patch
0052-cpufreq-intel_pstate-Add-Icelake-servers-support-in-.patch
0053-cpufreq-intel_pstate-Add-Ice-Lake-server-to-out-of-b.patch
0054-cpufreq-intel_pstate-Support-Sapphire-Rapids-OOB-mod.patch
0055-cpufreq-intel_pstate-Add-Sapphire-Rapids-support-in-.patch