Skip to content

Commit caf4427

Browse files
committed
Merge branch 'pm-cpufreq'
Merge cpufreq updates for 6.17-rc1: - Fix two initialization ordering issues in the cpufreq core and a governor initialization error path in it, and clean it up (Lifeng Zheng) - Add Granite Rapids support in no-HWP mode to the intel_pstate cpufreq driver (Li RongQing) - Make intel_pstate always use HWP_DESIRED_PERF in passive mode (Rafael Wysocki) - Allow building the tegra124 cpufreq driver as a module (Aaron Kling) - Do minor cleanups for Rust cpufreq and cpumask APIs and fix MAINTAINERS entry for cpu.rs (Abhinav Ananthu, Ritvik Gupta, Lukas Bulwahn) - Clean up assorted cpufreq drivers (Arnd Bergmann, Dan Carpenter, Krzysztof Kozlowski, Sven Peter, Svyatoslav Ryhel, Lifeng Zheng) - Add the NEED_UPDATE_LIMITS flag to the CPPC cpufreq driver (Prashant Malani) - Fix minimum performance state label error in the amd-pstate driver documentation (Shouye Liu) - Add the CPUFREQ_GOV_STRICT_TARGET flag to the userspace cpufreq governor and explain HW coordination influence on it in the documentation (Shashank Balaji) * pm-cpufreq: (27 commits) cpufreq: CPPC: Mark driver with NEED_UPDATE_LIMITS flag Documentation: amd-pstate:fix minimum performance state label error drivers: cpufreq: add Tegra114 support rust: cpumask: Replace `MaybeUninit` and `mem::zeroed` with `Opaque` APIs cpufreq: Exit governor when failed to start old governor cpufreq: Move the check of cpufreq_driver->get into cpufreq_verify_current_freq() cpufreq: Init policy->rwsem before it may be possibly used cpufreq: Initialize cpufreq-based frequency-invariance later cpufreq: Remove duplicate check in __cpufreq_offline() cpufreq: Contain scaling_cur_freq.attr in cpufreq_attrs cpufreq: intel_pstate: Add Granite Rapids support in no-HWP mode cpufreq: intel_pstate: Always use HWP_DESIRED_PERF in passive mode cpufreq: tegra124: Allow building as a module cpufreq: dt: Add register helper cpufreq: Export disable_cpufreq() cpufreq: armada-8k: Fix off by one in armada_8k_cpufreq_free_table() cpufreq: armada-8k: make both cpu masks static rust: cpufreq: use c_ types from kernel prelude rust: cpufreq: Ensure C ABI compatibility in all unsafe cpufreq: brcmstb-avs: Fully open-code compatible for grepping ...
2 parents ebd6884 + 0a1416a commit caf4427

17 files changed

Lines changed: 137 additions & 142 deletions

Documentation/admin-guide/pm/amd-pstate.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ to manage each performance update behavior. ::
7272
Lowest non- | | | |
7373
linear perf ------>+-----------------------+ +-----------------------+
7474
| | | |
75-
| | Lowest perf ---->| |
75+
| | Min perf ---->| |
7676
| | | |
7777
Lowest perf ------>+-----------------------+ +-----------------------+
7878
| | | |

Documentation/admin-guide/pm/cpufreq.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,9 @@ policy limits change after that.
398398

399399
This governor does not do anything by itself. Instead, it allows user space
400400
to set the CPU frequency for the policy it is attached to by writing to the
401-
``scaling_setspeed`` attribute of that policy.
401+
``scaling_setspeed`` attribute of that policy. Though the intention may be to
402+
set an exact frequency for the policy, the actual frequency may vary depending
403+
on hardware coordination, thermal and power limits, and other factors.
402404

403405
``schedutil``
404406
-------------

MAINTAINERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6256,7 +6256,7 @@ F: include/linux/cpuhotplug.h
62566256
F: include/linux/smpboot.h
62576257
F: kernel/cpu.c
62586258
F: kernel/smpboot.*
6259-
F: rust/helper/cpu.c
6259+
F: rust/helpers/cpu.c
62606260
F: rust/kernel/cpu.rs
62616261

62626262
CPU IDLE TIME MANAGEMENT FRAMEWORK

drivers/cpufreq/Kconfig.arm

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ config ARM_APPLE_SOC_CPUFREQ
2828
tristate "Apple Silicon SoC CPUFreq support"
2929
depends on ARCH_APPLE || (COMPILE_TEST && 64BIT)
3030
select PM_OPP
31-
default ARCH_APPLE
3231
help
3332
This adds the CPUFreq driver for Apple Silicon machines
3433
(e.g. Apple M1).
@@ -238,7 +237,7 @@ config ARM_TEGRA20_CPUFREQ
238237
This adds the CPUFreq driver support for Tegra20/30 SOCs.
239238

240239
config ARM_TEGRA124_CPUFREQ
241-
bool "Tegra124 CPUFreq support"
240+
tristate "Tegra124 CPUFreq support"
242241
depends on ARCH_TEGRA || COMPILE_TEST
243242
depends on CPUFREQ_DT
244243
default ARCH_TEGRA

drivers/cpufreq/armada-8k-cpufreq.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ static void armada_8k_cpufreq_free_table(struct freq_table *freq_tables)
103103
{
104104
int opps_index, nb_cpus = num_possible_cpus();
105105

106-
for (opps_index = 0 ; opps_index <= nb_cpus; opps_index++) {
106+
for (opps_index = 0 ; opps_index < nb_cpus; opps_index++) {
107107
int i;
108108

109109
/* If cpu_dev is NULL then we reached the end of the array */
@@ -132,7 +132,7 @@ static int __init armada_8k_cpufreq_init(void)
132132
int ret = 0, opps_index = 0, cpu, nb_cpus;
133133
struct freq_table *freq_tables;
134134
struct device_node *node;
135-
static struct cpumask cpus;
135+
static struct cpumask cpus, shared_cpus;
136136

137137
node = of_find_matching_node_and_match(NULL, armada_8k_cpufreq_of_match,
138138
NULL);
@@ -154,7 +154,6 @@ static int __init armada_8k_cpufreq_init(void)
154154
* divisions of it).
155155
*/
156156
for_each_cpu(cpu, &cpus) {
157-
struct cpumask shared_cpus;
158157
struct device *cpu_dev;
159158
struct clk *clk;
160159

drivers/cpufreq/brcmstb-avs-cpufreq.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -765,7 +765,7 @@ static void brcm_avs_cpufreq_remove(struct platform_device *pdev)
765765
}
766766

767767
static const struct of_device_id brcm_avs_cpufreq_match[] = {
768-
{ .compatible = BRCM_AVS_CPU_DATA },
768+
{ .compatible = "brcm,avs-cpu-data-mem" },
769769
{ }
770770
};
771771
MODULE_DEVICE_TABLE(of, brcm_avs_cpufreq_match);

drivers/cpufreq/cppc_cpufreq.c

Lines changed: 16 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,6 @@
2626

2727
#include <acpi/cppc_acpi.h>
2828

29-
/*
30-
* This list contains information parsed from per CPU ACPI _CPC and _PSD
31-
* structures: e.g. the highest and lowest supported performance, capabilities,
32-
* desired performance, level requested etc. Depending on the share_type, not
33-
* all CPUs will have an entry in the list.
34-
*/
35-
static LIST_HEAD(cpu_data_list);
36-
3729
static struct cpufreq_driver cppc_cpufreq_driver;
3830

3931
#ifdef CONFIG_ACPI_CPPC_CPUFREQ_FIE
@@ -352,7 +344,6 @@ static unsigned int cppc_cpufreq_get_transition_delay_us(unsigned int cpu)
352344
#if defined(CONFIG_ARM64) && defined(CONFIG_ENERGY_MODEL)
353345

354346
static DEFINE_PER_CPU(unsigned int, efficiency_class);
355-
static void cppc_cpufreq_register_em(struct cpufreq_policy *policy);
356347

357348
/* Create an artificial performance state every CPPC_EM_CAP_STEP capacity unit. */
358349
#define CPPC_EM_CAP_STEP (20)
@@ -488,7 +479,19 @@ static int cppc_get_cpu_cost(struct device *cpu_dev, unsigned long KHz,
488479
return 0;
489480
}
490481

491-
static int populate_efficiency_class(void)
482+
static void cppc_cpufreq_register_em(struct cpufreq_policy *policy)
483+
{
484+
struct cppc_cpudata *cpu_data;
485+
struct em_data_callback em_cb =
486+
EM_ADV_DATA_CB(cppc_get_cpu_power, cppc_get_cpu_cost);
487+
488+
cpu_data = policy->driver_data;
489+
em_dev_register_perf_domain(get_cpu_device(policy->cpu),
490+
get_perf_level_count(policy), &em_cb,
491+
cpu_data->shared_cpu_map, 0);
492+
}
493+
494+
static void populate_efficiency_class(void)
492495
{
493496
struct acpi_madt_generic_interrupt *gicc;
494497
DECLARE_BITMAP(used_classes, 256) = {};
@@ -503,7 +506,7 @@ static int populate_efficiency_class(void)
503506
if (bitmap_weight(used_classes, 256) <= 1) {
504507
pr_debug("Efficiency classes are all equal (=%d). "
505508
"No EM registered", class);
506-
return -EINVAL;
509+
return;
507510
}
508511

509512
/*
@@ -520,26 +523,11 @@ static int populate_efficiency_class(void)
520523
index++;
521524
}
522525
cppc_cpufreq_driver.register_em = cppc_cpufreq_register_em;
523-
524-
return 0;
525-
}
526-
527-
static void cppc_cpufreq_register_em(struct cpufreq_policy *policy)
528-
{
529-
struct cppc_cpudata *cpu_data;
530-
struct em_data_callback em_cb =
531-
EM_ADV_DATA_CB(cppc_get_cpu_power, cppc_get_cpu_cost);
532-
533-
cpu_data = policy->driver_data;
534-
em_dev_register_perf_domain(get_cpu_device(policy->cpu),
535-
get_perf_level_count(policy), &em_cb,
536-
cpu_data->shared_cpu_map, 0);
537526
}
538527

539528
#else
540-
static int populate_efficiency_class(void)
529+
static void populate_efficiency_class(void)
541530
{
542-
return 0;
543531
}
544532
#endif
545533

@@ -567,8 +555,6 @@ static struct cppc_cpudata *cppc_cpufreq_get_cpu_data(unsigned int cpu)
567555
goto free_mask;
568556
}
569557

570-
list_add(&cpu_data->node, &cpu_data_list);
571-
572558
return cpu_data;
573559

574560
free_mask:
@@ -583,7 +569,6 @@ static void cppc_cpufreq_put_cpu_data(struct cpufreq_policy *policy)
583569
{
584570
struct cppc_cpudata *cpu_data = policy->driver_data;
585571

586-
list_del(&cpu_data->node);
587572
free_cpumask_var(cpu_data->shared_cpu_map);
588573
kfree(cpu_data);
589574
policy->driver_data = NULL;
@@ -925,7 +910,7 @@ static struct freq_attr *cppc_cpufreq_attr[] = {
925910
};
926911

927912
static struct cpufreq_driver cppc_cpufreq_driver = {
928-
.flags = CPUFREQ_CONST_LOOPS,
913+
.flags = CPUFREQ_CONST_LOOPS | CPUFREQ_NEED_UPDATE_LIMITS,
929914
.verify = cppc_verify_policy,
930915
.target = cppc_cpufreq_set_target,
931916
.get = cppc_cpufreq_get_rate,
@@ -954,24 +939,10 @@ static int __init cppc_cpufreq_init(void)
954939
return ret;
955940
}
956941

957-
static inline void free_cpu_data(void)
958-
{
959-
struct cppc_cpudata *iter, *tmp;
960-
961-
list_for_each_entry_safe(iter, tmp, &cpu_data_list, node) {
962-
free_cpumask_var(iter->shared_cpu_map);
963-
list_del(&iter->node);
964-
kfree(iter);
965-
}
966-
967-
}
968-
969942
static void __exit cppc_cpufreq_exit(void)
970943
{
971944
cpufreq_unregister_driver(&cppc_cpufreq_driver);
972945
cppc_freq_invariance_exit();
973-
974-
free_cpu_data();
975946
}
976947

977948
module_exit(cppc_cpufreq_exit);

drivers/cpufreq/cpufreq-dt-platdev.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ static const struct of_device_id blocklist[] __initconst = {
143143

144144
{ .compatible = "nvidia,tegra20", },
145145
{ .compatible = "nvidia,tegra30", },
146+
{ .compatible = "nvidia,tegra114", },
146147
{ .compatible = "nvidia,tegra124", },
147148
{ .compatible = "nvidia,tegra210", },
148149
{ .compatible = "nvidia,tegra234", },

drivers/cpufreq/cpufreq-dt.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,17 @@ static struct platform_driver dt_cpufreq_platdrv = {
329329
};
330330
module_platform_driver(dt_cpufreq_platdrv);
331331

332+
struct platform_device *cpufreq_dt_pdev_register(struct device *dev)
333+
{
334+
struct platform_device_info cpufreq_dt_devinfo = {};
335+
336+
cpufreq_dt_devinfo.name = "cpufreq-dt";
337+
cpufreq_dt_devinfo.parent = dev;
338+
339+
return platform_device_register_full(&cpufreq_dt_devinfo);
340+
}
341+
EXPORT_SYMBOL_GPL(cpufreq_dt_pdev_register);
342+
332343
MODULE_ALIAS("platform:cpufreq-dt");
333344
MODULE_AUTHOR("Viresh Kumar <viresh.kumar@linaro.org>");
334345
MODULE_AUTHOR("Shawn Guo <shawn.guo@linaro.org>");

drivers/cpufreq/cpufreq-dt.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,6 @@ struct cpufreq_dt_platform_data {
2222
int (*resume)(struct cpufreq_policy *policy);
2323
};
2424

25+
struct platform_device *cpufreq_dt_pdev_register(struct device *dev);
26+
2527
#endif /* __CPUFREQ_DT_H__ */

0 commit comments

Comments
 (0)