From c65b550185706ddcc7d1dfaa25d389196032ef51 Mon Sep 17 00:00:00 2001 From: Quentin Perret Date: Mon, 6 Apr 2020 16:44:16 +0100 Subject: [PATCH] Revert "ANDROID: cpufreq: arch_topology: implement max frequency capping" This reverts commit 0cfe39fe403ea6dbe2fdfb38edd36022b35d4d66. Upstream has an equivalent feature now, drop the Android-specific version. Bug: 120440300 Signed-off-by: Quentin Perret Change-Id: Id1b2ad9249fb3441082cad34872d237b32b19b82 --- drivers/base/arch_topology.c | 25 +------------------------ drivers/cpufreq/cpufreq.c | 8 -------- include/linux/arch_topology.h | 9 --------- include/linux/cpufreq.h | 2 -- 4 files changed, 1 insertion(+), 43 deletions(-) diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c index 31b4c2d9584b..4d0a0038b476 100644 --- a/drivers/base/arch_topology.c +++ b/drivers/base/arch_topology.c @@ -26,8 +26,6 @@ __weak bool arch_freq_counters_available(struct cpumask *cpus) return false; } DEFINE_PER_CPU(unsigned long, freq_scale) = SCHED_CAPACITY_SCALE; -DEFINE_PER_CPU(unsigned long, max_cpu_freq); -DEFINE_PER_CPU(unsigned long, max_freq_scale) = SCHED_CAPACITY_SCALE; void arch_set_freq_scale(struct cpumask *cpus, unsigned long cur_freq, unsigned long max_freq) @@ -45,29 +43,8 @@ void arch_set_freq_scale(struct cpumask *cpus, unsigned long cur_freq, scale = (cur_freq << SCHED_CAPACITY_SHIFT) / max_freq; - for_each_cpu(i, cpus) { + for_each_cpu(i, cpus) per_cpu(freq_scale, i) = scale; - per_cpu(max_cpu_freq, i) = max_freq; - } -} - -void arch_set_max_freq_scale(struct cpumask *cpus, - unsigned long policy_max_freq) -{ - unsigned long scale, max_freq; - int cpu = cpumask_first(cpus); - - if (cpu > nr_cpu_ids) - return; - - max_freq = per_cpu(max_cpu_freq, cpu); - if (!max_freq) - return; - - scale = (policy_max_freq << SCHED_CAPACITY_SHIFT) / max_freq; - - for_each_cpu(cpu, cpus) - per_cpu(max_freq_scale, cpu) = scale; } DEFINE_PER_CPU(unsigned long, cpu_scale) = SCHED_CAPACITY_SCALE; diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index efeb59bbe0ec..e427ae930042 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -161,12 +161,6 @@ __weak void arch_set_freq_scale(struct cpumask *cpus, unsigned long cur_freq, } EXPORT_SYMBOL_GPL(arch_set_freq_scale); -__weak void arch_set_max_freq_scale(struct cpumask *cpus, - unsigned long policy_max_freq) -{ -} -EXPORT_SYMBOL_GPL(arch_set_max_freq_scale); - /* * This is a generic cpufreq init() routine which can be used by cpufreq * drivers of SMP systems. It will do following: @@ -2444,8 +2438,6 @@ static int cpufreq_set_policy(struct cpufreq_policy *policy, policy->max = new_data.max; trace_cpu_frequency_limits(policy); - arch_set_max_freq_scale(policy->cpus, policy->max); - policy->cached_target_freq = UINT_MAX; pr_debug("new min and max freqs are %u - %u kHz\n", diff --git a/include/linux/arch_topology.h b/include/linux/arch_topology.h index 5a341b8c4ae4..0566cb3314ef 100644 --- a/include/linux/arch_topology.h +++ b/include/linux/arch_topology.h @@ -30,15 +30,6 @@ static inline unsigned long topology_get_freq_scale(int cpu) return per_cpu(freq_scale, cpu); } -DECLARE_PER_CPU(unsigned long, max_freq_scale); - -struct sched_domain; -static inline -unsigned long topology_get_max_freq_scale(struct sched_domain *sd, int cpu) -{ - return per_cpu(max_freq_scale, cpu); -} - bool arch_freq_counters_available(struct cpumask *cpus); DECLARE_PER_CPU(unsigned long, thermal_pressure); diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index 34015742376b..f7240251a949 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h @@ -992,8 +992,6 @@ extern unsigned int arch_freq_get_on_cpu(int cpu); extern void arch_set_freq_scale(struct cpumask *cpus, unsigned long cur_freq, unsigned long max_freq); -extern void arch_set_max_freq_scale(struct cpumask *cpus, - unsigned long policy_max_freq); /* the following are really really optional */ extern struct freq_attr cpufreq_freq_attr_scaling_available_freqs;