Skip to content

Commit 5cd9b47

Browse files
author
CKI KWF Bot
committed
Merge: update drivers/cpufreq to match upstream v6.15
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-10/-/merge_requests/596 Resolves: 83800 JIRA: https://issues.redhat.com/browse/RHEL-83800 Regular update to v6.15 to simplify maintenance and resolve known bugs. Signed-off-by: Mark Langsdorf <mlangsdo@redhat.com> Approved-by: Steve Best <sbest@redhat.com> Approved-by: David Arcari <darcari@redhat.com> Approved-by: Eric Chanudet <echanude@redhat.com> Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com> Merged-by: CKI GitLab Kmaint Pipeline Bot <26919896-cki-kmaint-pipeline-bot@users.noreply.gitlab.com>
2 parents afa5f49 + 7f3aa74 commit 5cd9b47

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+1352
-1760
lines changed

Documentation/admin-guide/kernel-parameters.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2310,6 +2310,9 @@
23102310
per_cpu_perf_limits
23112311
Allow per-logical-CPU P-State performance control limits using
23122312
cpufreq sysfs interface
2313+
no_cas
2314+
Do not enable capacity-aware scheduling (CAS) on
2315+
hybrid systems
23132316

23142317
intremap= [X86-64,Intel-IOMMU,EARLY]
23152318
on enable Interrupt Remapping (default)

Documentation/admin-guide/pm/intel_pstate.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -696,6 +696,9 @@ of them have to be prepended with the ``intel_pstate=`` prefix.
696696
Use per-logical-CPU P-State limits (see `Coordination of P-state
697697
Limits`_ for details).
698698

699+
``no_cas``
700+
Do not enable capacity-aware scheduling (CAS) which is enabled by
701+
default on hybrid systems.
699702

700703
Diagnostics and Tuning
701704
======================

arch/x86/include/asm/msr-index.h

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -706,15 +706,17 @@
706706
#define MSR_AMD_CPPC_REQ 0xc00102b3
707707
#define MSR_AMD_CPPC_STATUS 0xc00102b4
708708

709-
#define AMD_CPPC_LOWEST_PERF(x) (((x) >> 0) & 0xff)
710-
#define AMD_CPPC_LOWNONLIN_PERF(x) (((x) >> 8) & 0xff)
711-
#define AMD_CPPC_NOMINAL_PERF(x) (((x) >> 16) & 0xff)
712-
#define AMD_CPPC_HIGHEST_PERF(x) (((x) >> 24) & 0xff)
713-
714-
#define AMD_CPPC_MAX_PERF(x) (((x) & 0xff) << 0)
715-
#define AMD_CPPC_MIN_PERF(x) (((x) & 0xff) << 8)
716-
#define AMD_CPPC_DES_PERF(x) (((x) & 0xff) << 16)
717-
#define AMD_CPPC_ENERGY_PERF_PREF(x) (((x) & 0xff) << 24)
709+
/* Masks for use with MSR_AMD_CPPC_CAP1 */
710+
#define AMD_CPPC_LOWEST_PERF_MASK GENMASK(7, 0)
711+
#define AMD_CPPC_LOWNONLIN_PERF_MASK GENMASK(15, 8)
712+
#define AMD_CPPC_NOMINAL_PERF_MASK GENMASK(23, 16)
713+
#define AMD_CPPC_HIGHEST_PERF_MASK GENMASK(31, 24)
714+
715+
/* Masks for use with MSR_AMD_CPPC_REQ */
716+
#define AMD_CPPC_MAX_PERF_MASK GENMASK(7, 0)
717+
#define AMD_CPPC_MIN_PERF_MASK GENMASK(15, 8)
718+
#define AMD_CPPC_DES_PERF_MASK GENMASK(23, 16)
719+
#define AMD_CPPC_EPP_PERF_MASK GENMASK(31, 24)
718720

719721
/* AMD Performance Counter Global Status and Control MSRs */
720722
#define MSR_AMD64_PERF_CNTR_GLOBAL_STATUS 0xc0000300

arch/x86/kernel/acpi/cppc.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
* Copyright (c) 2016, Intel Corporation.
55
*/
66

7+
#include <linux/bitfield.h>
8+
79
#include <acpi/cppc_acpi.h>
810
#include <asm/msr.h>
911
#include <asm/processor.h>
@@ -149,7 +151,7 @@ int amd_get_highest_perf(unsigned int cpu, u32 *highest_perf)
149151
if (ret)
150152
goto out;
151153

152-
val = AMD_CPPC_HIGHEST_PERF(val);
154+
val = FIELD_GET(AMD_CPPC_HIGHEST_PERF_MASK, val);
153155
} else {
154156
ret = cppc_get_highest_perf(cpu, &val);
155157
if (ret)

drivers/cpufreq/Kconfig

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -217,8 +217,22 @@ config CPUFREQ_DT
217217

218218
If in doubt, say N.
219219

220+
config CPUFREQ_VIRT
221+
tristate "Virtual cpufreq driver"
222+
depends on GENERIC_ARCH_TOPOLOGY
223+
help
224+
This adds a virtualized cpufreq driver for guest kernels that
225+
read/writes to a MMIO region for a virtualized cpufreq device to
226+
communicate with the host. It sends performance requests to the host
227+
which gets used as a hint to schedule vCPU threads and select CPU
228+
frequency. If a VM does not support a virtualized FIE such as AMUs,
229+
it updates the frequency scaling factor by polling host CPU frequency
230+
to enable accurate Per-Entity Load Tracking for tasks running in the guest.
231+
232+
If in doubt, say N.
233+
220234
config CPUFREQ_DT_PLATDEV
221-
tristate "Generic DT based cpufreq platdev driver"
235+
bool "Generic DT based cpufreq platdev driver"
222236
depends on OF
223237
help
224238
This adds a generic DT based cpufreq platdev driver for frequency
@@ -311,8 +325,6 @@ config QORIQ_CPUFREQ
311325
This adds the CPUFreq driver support for Freescale QorIQ SoCs
312326
which are capable of changing the CPU's frequency dynamically.
313327

314-
endif
315-
316328
config ACPI_CPPC_CPUFREQ
317329
tristate "CPUFreq driver based on the ACPI CPPC spec"
318330
depends on ACPI_PROCESSOR
@@ -341,4 +353,6 @@ config ACPI_CPPC_CPUFREQ_FIE
341353

342354
If in doubt, say N.
343355

356+
endif
357+
344358
endmenu

drivers/cpufreq/Kconfig.arm

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ config ARM_VEXPRESS_SPC_CPUFREQ
6767
config ARM_BRCMSTB_AVS_CPUFREQ
6868
tristate "Broadcom STB AVS CPUfreq driver"
6969
depends on (ARCH_BRCMSTB && !ARM_SCMI_CPUFREQ) || COMPILE_TEST
70-
default y
70+
default y if ARCH_BRCMSTB && !ARM_SCMI_CPUFREQ
7171
help
7272
Some Broadcom STB SoCs use a co-processor running proprietary firmware
7373
("AVS") to handle voltage and frequency scaling. This driver provides
@@ -79,7 +79,7 @@ config ARM_HIGHBANK_CPUFREQ
7979
tristate "Calxeda Highbank-based"
8080
depends on ARCH_HIGHBANK || COMPILE_TEST
8181
depends on CPUFREQ_DT && REGULATOR && PL320_MBOX
82-
default m
82+
default m if ARCH_HIGHBANK
8383
help
8484
This adds the CPUFreq driver for Calxeda Highbank SoC
8585
based boards.
@@ -124,7 +124,7 @@ config ARM_MEDIATEK_CPUFREQ
124124
config ARM_MEDIATEK_CPUFREQ_HW
125125
tristate "MediaTek CPUFreq HW driver"
126126
depends on ARCH_MEDIATEK || COMPILE_TEST
127-
default m
127+
default m if ARCH_MEDIATEK
128128
help
129129
Support for the CPUFreq HW driver.
130130
Some MediaTek chipsets have a HW engine to offload the steps
@@ -172,7 +172,7 @@ config ARM_RASPBERRYPI_CPUFREQ
172172
config ARM_S3C64XX_CPUFREQ
173173
bool "Samsung S3C64XX"
174174
depends on CPU_S3C6410 || COMPILE_TEST
175-
default y
175+
default CPU_S3C6410
176176
help
177177
This adds the CPUFreq driver for Samsung S3C6410 SoC.
178178

@@ -181,7 +181,7 @@ config ARM_S3C64XX_CPUFREQ
181181
config ARM_S5PV210_CPUFREQ
182182
bool "Samsung S5PV210 and S5PC110"
183183
depends on CPU_S5PV210 || COMPILE_TEST
184-
default y
184+
default CPU_S5PV210
185185
help
186186
This adds the CPUFreq driver for Samsung S5PV210 and
187187
S5PC110 SoCs.
@@ -205,7 +205,7 @@ config ARM_SCMI_CPUFREQ
205205
config ARM_SPEAR_CPUFREQ
206206
bool "SPEAr CPUFreq support"
207207
depends on PLAT_SPEAR || COMPILE_TEST
208-
default y
208+
default PLAT_SPEAR
209209
help
210210
This adds the CPUFreq driver support for SPEAr SOCs.
211211

@@ -224,15 +224,15 @@ config ARM_TEGRA20_CPUFREQ
224224
tristate "Tegra20/30 CPUFreq support"
225225
depends on ARCH_TEGRA || COMPILE_TEST
226226
depends on CPUFREQ_DT
227-
default y
227+
default ARCH_TEGRA
228228
help
229229
This adds the CPUFreq driver support for Tegra20/30 SOCs.
230230

231231
config ARM_TEGRA124_CPUFREQ
232232
bool "Tegra124 CPUFreq support"
233233
depends on ARCH_TEGRA || COMPILE_TEST
234234
depends on CPUFREQ_DT
235-
default y
235+
default ARCH_TEGRA
236236
help
237237
This adds the CPUFreq driver support for Tegra124 SOCs.
238238

@@ -245,16 +245,16 @@ config ARM_TEGRA186_CPUFREQ
245245

246246
config ARM_TEGRA194_CPUFREQ
247247
tristate "Tegra194 CPUFreq support"
248-
depends on ARCH_TEGRA_194_SOC || (64BIT && COMPILE_TEST)
248+
depends on ARCH_TEGRA_194_SOC || ARCH_TEGRA_234_SOC || (64BIT && COMPILE_TEST)
249249
depends on TEGRA_BPMP
250-
default y
250+
default ARCH_TEGRA_194_SOC || ARCH_TEGRA_234_SOC
251251
help
252252
This adds CPU frequency driver support for Tegra194 SOCs.
253253

254254
config ARM_TI_CPUFREQ
255255
bool "Texas Instruments CPUFreq support"
256256
depends on ARCH_OMAP2PLUS || ARCH_K3 || COMPILE_TEST
257-
default y
257+
default ARCH_OMAP2PLUS || ARCH_K3
258258
help
259259
This driver enables valid OPPs on the running platform based on
260260
values contained within the SoC in use. Enable this in order to

drivers/cpufreq/Kconfig.powerpc

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,4 @@
11
# SPDX-License-Identifier: GPL-2.0-only
2-
config CPU_FREQ_CBE
3-
tristate "CBE frequency scaling"
4-
depends on CBE_RAS && PPC_CELL
5-
default m
6-
help
7-
This adds the cpufreq driver for Cell BE processors.
8-
For details, take a look at <file:Documentation/cpu-freq/>.
9-
If you don't have such processor, say N
10-
11-
config CPU_FREQ_CBE_PMI
12-
bool "CBE frequency scaling using PMI interface"
13-
depends on CPU_FREQ_CBE
14-
default n
15-
help
16-
Select this, if you want to use the PMI interface to switch
17-
frequencies. Using PMI, the processor will not only be able to run at
18-
lower speed, but also at lower core voltage.
19-
20-
config CPU_FREQ_MAPLE
21-
bool "Support for Maple 970FX Evaluation Board"
22-
depends on PPC_MAPLE
23-
help
24-
This adds support for frequency switching on Maple 970FX
25-
Evaluation Board and compatible boards (IBM JS2x blades).
26-
272
config CPU_FREQ_PMAC
283
bool "Support for Apple PowerBooks"
294
depends on ADB_PMU && PPC32

drivers/cpufreq/Makefile

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ obj-$(CONFIG_CPU_FREQ_GOV_ATTR_SET) += cpufreq_governor_attr_set.o
1616

1717
obj-$(CONFIG_CPUFREQ_DT) += cpufreq-dt.o
1818
obj-$(CONFIG_CPUFREQ_DT_PLATDEV) += cpufreq-dt-platdev.o
19+
obj-$(CONFIG_CPUFREQ_VIRT) += virtual-cpufreq.o
1920

2021
# Traces
2122
CFLAGS_amd-pstate-trace.o := -I$(src)
@@ -89,10 +90,6 @@ obj-$(CONFIG_ARM_VEXPRESS_SPC_CPUFREQ) += vexpress-spc-cpufreq.o
8990

9091
##################################################################################
9192
# PowerPC platform drivers
92-
obj-$(CONFIG_CPU_FREQ_CBE) += ppc-cbe-cpufreq.o
93-
ppc-cbe-cpufreq-y += ppc_cbe_cpufreq_pervasive.o ppc_cbe_cpufreq.o
94-
obj-$(CONFIG_CPU_FREQ_CBE_PMI) += ppc_cbe_cpufreq_pmi.o
95-
obj-$(CONFIG_CPU_FREQ_MAPLE) += maple-cpufreq.o
9693
obj-$(CONFIG_QORIQ_CPUFREQ) += qoriq-cpufreq.o
9794
obj-$(CONFIG_CPU_FREQ_PMAC) += pmac32-cpufreq.o
9895
obj-$(CONFIG_CPU_FREQ_PMAC64) += pmac64-cpufreq.o

drivers/cpufreq/acpi-cpufreq.c

Lines changed: 41 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -73,20 +73,17 @@ static unsigned int acpi_pstate_strict;
7373

7474
static bool boost_state(unsigned int cpu)
7575
{
76-
u32 lo, hi;
7776
u64 msr;
7877

7978
switch (boot_cpu_data.x86_vendor) {
8079
case X86_VENDOR_INTEL:
8180
case X86_VENDOR_CENTAUR:
8281
case X86_VENDOR_ZHAOXIN:
83-
rdmsr_on_cpu(cpu, MSR_IA32_MISC_ENABLE, &lo, &hi);
84-
msr = lo | ((u64)hi << 32);
82+
rdmsrl_on_cpu(cpu, MSR_IA32_MISC_ENABLE, &msr);
8583
return !(msr & MSR_IA32_MISC_ENABLE_TURBO_DISABLE);
8684
case X86_VENDOR_HYGON:
8785
case X86_VENDOR_AMD:
88-
rdmsr_on_cpu(cpu, MSR_K7_HWCR, &lo, &hi);
89-
msr = lo | ((u64)hi << 32);
86+
rdmsrl_on_cpu(cpu, MSR_K7_HWCR, &msr);
9087
return !(msr & MSR_K7_HWCR_CPB_DIS);
9188
}
9289
return false;
@@ -626,7 +623,14 @@ static int acpi_cpufreq_blacklist(struct cpuinfo_x86 *c)
626623
#endif
627624

628625
#ifdef CONFIG_ACPI_CPPC_LIB
629-
static u64 get_max_boost_ratio(unsigned int cpu)
626+
/*
627+
* get_max_boost_ratio: Computes the max_boost_ratio as the ratio
628+
* between the highest_perf and the nominal_perf.
629+
*
630+
* Returns the max_boost_ratio for @cpu. Returns the CPPC nominal
631+
* frequency via @nominal_freq if it is non-NULL pointer.
632+
*/
633+
static u64 get_max_boost_ratio(unsigned int cpu, u64 *nominal_freq)
630634
{
631635
struct cppc_perf_caps perf_caps;
632636
u64 highest_perf, nominal_perf;
@@ -655,6 +659,9 @@ static u64 get_max_boost_ratio(unsigned int cpu)
655659

656660
nominal_perf = perf_caps.nominal_perf;
657661

662+
if (nominal_freq)
663+
*nominal_freq = perf_caps.nominal_freq * 1000;
664+
658665
if (!highest_perf || !nominal_perf) {
659666
pr_debug("CPU%d: highest or nominal performance missing\n", cpu);
660667
return 0;
@@ -667,8 +674,12 @@ static u64 get_max_boost_ratio(unsigned int cpu)
667674

668675
return div_u64(highest_perf << SCHED_CAPACITY_SHIFT, nominal_perf);
669676
}
677+
670678
#else
671-
static inline u64 get_max_boost_ratio(unsigned int cpu) { return 0; }
679+
static inline u64 get_max_boost_ratio(unsigned int cpu, u64 *nominal_freq)
680+
{
681+
return 0;
682+
}
672683
#endif
673684

674685
static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)
@@ -678,9 +689,9 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)
678689
struct acpi_cpufreq_data *data;
679690
unsigned int cpu = policy->cpu;
680691
struct cpuinfo_x86 *c = &cpu_data(cpu);
692+
u64 max_boost_ratio, nominal_freq = 0;
681693
unsigned int valid_states = 0;
682694
unsigned int result = 0;
683-
u64 max_boost_ratio;
684695
unsigned int i;
685696
#ifdef CONFIG_SMP
686697
static int blacklisted;
@@ -830,16 +841,20 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)
830841
}
831842
freq_table[valid_states].frequency = CPUFREQ_TABLE_END;
832843

833-
max_boost_ratio = get_max_boost_ratio(cpu);
844+
max_boost_ratio = get_max_boost_ratio(cpu, &nominal_freq);
834845
if (max_boost_ratio) {
835-
unsigned int freq = freq_table[0].frequency;
846+
unsigned int freq = nominal_freq;
836847

837848
/*
838-
* Because the loop above sorts the freq_table entries in the
839-
* descending order, freq is the maximum frequency in the table.
840-
* Assume that it corresponds to the CPPC nominal frequency and
841-
* use it to set cpuinfo.max_freq.
849+
* The loop above sorts the freq_table entries in the
850+
* descending order. If ACPI CPPC has not advertised
851+
* the nominal frequency (this is possible in CPPC
852+
* revisions prior to 3), then use the first entry in
853+
* the pstate table as a proxy for nominal frequency.
842854
*/
855+
if (!freq)
856+
freq = freq_table[0].frequency;
857+
843858
policy->cpuinfo.max_freq = freq * max_boost_ratio >> SCHED_CAPACITY_SHIFT;
844859
} else {
845860
/*
@@ -895,8 +910,17 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)
895910
pr_warn(FW_WARN "P-state 0 is not max freq\n");
896911

897912
if (acpi_cpufreq_driver.set_boost) {
898-
set_boost(policy, acpi_cpufreq_driver.boost_enabled);
899-
policy->boost_enabled = acpi_cpufreq_driver.boost_enabled;
913+
if (policy->boost_supported) {
914+
/*
915+
* The firmware may have altered boost state while the
916+
* CPU was offline (for example during a suspend-resume
917+
* cycle).
918+
*/
919+
if (policy->boost_enabled != boost_state(cpu))
920+
set_boost(policy, policy->boost_enabled);
921+
} else {
922+
policy->boost_supported = true;
923+
}
900924
}
901925

902926
return result;
@@ -939,7 +963,6 @@ static int acpi_cpufreq_resume(struct cpufreq_policy *policy)
939963
}
940964

941965
static struct freq_attr *acpi_cpufreq_attr[] = {
942-
&cpufreq_freq_attr_scaling_available_freqs,
943966
&freqdomain_cpus,
944967
#ifdef CONFIG_X86_ACPI_CPUFREQ_CPB
945968
&cpb,
@@ -1028,7 +1051,7 @@ static struct platform_driver acpi_cpufreq_platdrv = {
10281051
.driver = {
10291052
.name = "acpi-cpufreq",
10301053
},
1031-
.remove_new = acpi_cpufreq_remove,
1054+
.remove = acpi_cpufreq_remove,
10321055
};
10331056

10341057
static int __init acpi_cpufreq_init(void)

0 commit comments

Comments
 (0)