Skip to content

Commit 9c2ff66

Browse files
committed
Merge branch 'pm-cpufreq'
* pm-cpufreq: (30 commits) cpufreq: stats: Fix string format specifier mismatch arm: disable frequency invariance for CONFIG_BL_SWITCHER cpufreq,arm,arm64: restructure definitions of arch_set_freq_scale() cpufreq: stats: Add memory barrier to store_reset() cpufreq: schedutil: Simplify sugov_fast_switch() cpufreq: Move traces and update to policy->cur to cpufreq core cpufreq: stats: Enable stats for fast-switch as well cpufreq: stats: Mark few conditionals with unlikely() cpufreq: stats: Remove locking cpufreq: stats: Defer stats update to cpufreq_stats_record_transition() arch_topology, arm, arm64: define arch_scale_freq_invariant() arch_topology, cpufreq: constify arch_* cpumasks cpufreq: report whether cpufreq supports Frequency Invariance (FI) cpufreq: move invariance setter calls in cpufreq core arch_topology: validate input frequencies to arch_set_freq_scale() cpufreq: qcom: Don't add frequencies without an OPP cpufreq: qcom-hw: Add cpufreq support for SM8250 SoC cpufreq: qcom-hw: Use of_device_get_match_data for offsets and row size cpufreq: qcom-hw: Use devm_platform_ioremap_resource() to simplify code dt-bindings: cpufreq: cpufreq-qcom-hw: Document Qcom EPSS compatible ...
2 parents 757e282 + b7af608 commit 9c2ff66

22 files changed

Lines changed: 453 additions & 325 deletions

Documentation/devicetree/bindings/cpufreq/cpufreq-qcom-hw.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Properties:
88
- compatible
99
Usage: required
1010
Value type: <string>
11-
Definition: must be "qcom,cpufreq-hw".
11+
Definition: must be "qcom,cpufreq-hw" or "qcom,cpufreq-epss".
1212

1313
- clocks
1414
Usage: required

arch/arm/include/asm/topology.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,13 @@
77
#include <linux/cpumask.h>
88
#include <linux/arch_topology.h>
99

10+
/* big.LITTLE switcher is incompatible with frequency invariance */
11+
#ifndef CONFIG_BL_SWITCHER
1012
/* Replace task scheduler's default frequency-invariant accounting */
13+
#define arch_set_freq_scale topology_set_freq_scale
1114
#define arch_scale_freq_capacity topology_get_freq_scale
15+
#define arch_scale_freq_invariant topology_scale_freq_invariant
16+
#endif
1217

1318
/* Replace task scheduler's default cpu-invariant accounting */
1419
#define arch_scale_cpu_capacity topology_get_cpu_scale

arch/arm64/include/asm/topology.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ void topology_scale_freq_tick(void);
2626
#endif /* CONFIG_ARM64_AMU_EXTN */
2727

2828
/* Replace task scheduler's default frequency-invariant accounting */
29+
#define arch_set_freq_scale topology_set_freq_scale
2930
#define arch_scale_freq_capacity topology_get_freq_scale
31+
#define arch_scale_freq_invariant topology_scale_freq_invariant
3032

3133
/* Replace task scheduler's default cpu-invariant accounting */
3234
#define arch_scale_cpu_capacity topology_get_cpu_scale

arch/arm64/kernel/topology.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,14 +246,21 @@ static int __init init_amu_fie(void)
246246
static_branch_enable(&amu_fie_key);
247247
}
248248

249+
/*
250+
* If the system is not fully invariant after AMU init, disable
251+
* partial use of counters for frequency invariance.
252+
*/
253+
if (!topology_scale_freq_invariant())
254+
static_branch_disable(&amu_fie_key);
255+
249256
free_valid_mask:
250257
free_cpumask_var(valid_cpus);
251258

252259
return ret;
253260
}
254261
late_initcall_sync(init_amu_fie);
255262

256-
bool arch_freq_counters_available(struct cpumask *cpus)
263+
bool arch_freq_counters_available(const struct cpumask *cpus)
257264
{
258265
return amu_freq_invariant() &&
259266
cpumask_subset(cpus, amu_fie_cpus);

drivers/base/arch_topology.c

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,27 @@
2121
#include <linux/sched.h>
2222
#include <linux/smp.h>
2323

24-
__weak bool arch_freq_counters_available(struct cpumask *cpus)
24+
bool topology_scale_freq_invariant(void)
25+
{
26+
return cpufreq_supports_freq_invariance() ||
27+
arch_freq_counters_available(cpu_online_mask);
28+
}
29+
30+
__weak bool arch_freq_counters_available(const struct cpumask *cpus)
2531
{
2632
return false;
2733
}
2834
DEFINE_PER_CPU(unsigned long, freq_scale) = SCHED_CAPACITY_SCALE;
2935

30-
void arch_set_freq_scale(struct cpumask *cpus, unsigned long cur_freq,
31-
unsigned long max_freq)
36+
void topology_set_freq_scale(const struct cpumask *cpus, unsigned long cur_freq,
37+
unsigned long max_freq)
3238
{
3339
unsigned long scale;
3440
int i;
3541

42+
if (WARN_ON_ONCE(!cur_freq || !max_freq))
43+
return;
44+
3645
/*
3746
* If the use of counters for FIE is enabled, just return as we don't
3847
* want to update the scale factor with information from CPUFREQ.

drivers/cpufreq/Kconfig.arm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ config ARM_SPEAR_CPUFREQ
283283

284284
config ARM_STI_CPUFREQ
285285
tristate "STi CPUFreq support"
286-
depends on SOC_STIH407
286+
depends on CPUFREQ_DT && SOC_STIH407
287287
help
288288
This driver uses the generic OPP framework to match the running
289289
platform with a predefined set of suitable values. If not provided

drivers/cpufreq/armada-37xx-cpufreq.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -484,6 +484,12 @@ static int __init armada37xx_cpufreq_driver_init(void)
484484
/* late_initcall, to guarantee the driver is loaded after A37xx clock driver */
485485
late_initcall(armada37xx_cpufreq_driver_init);
486486

487+
static const struct of_device_id __maybe_unused armada37xx_cpufreq_of_match[] = {
488+
{ .compatible = "marvell,armada-3700-nb-pm" },
489+
{ },
490+
};
491+
MODULE_DEVICE_TABLE(of, armada37xx_cpufreq_of_match);
492+
487493
MODULE_AUTHOR("Gregory CLEMENT <gregory.clement@free-electrons.com>");
488494
MODULE_DESCRIPTION("Armada 37xx cpufreq driver");
489495
MODULE_LICENSE("GPL");

drivers/cpufreq/cpufreq-dt-platdev.c

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

138138
{ .compatible = "st,stih407", },
139139
{ .compatible = "st,stih410", },
140+
{ .compatible = "st,stih418", },
140141

141142
{ .compatible = "sigma,tango4", },
142143

0 commit comments

Comments
 (0)