Skip to content

Commit a20b705

Browse files
ionela-voinescurafaeljw
authored andcommitted
cpufreq,arm,arm64: restructure definitions of arch_set_freq_scale()
Compared to other arch_* functions, arch_set_freq_scale() has an atypical weak definition that can be replaced by a strong architecture specific implementation. The more typical support for architectural functions involves defining an empty stub in a header file if the symbol is not already defined in architecture code. Some examples involve: - #define arch_scale_freq_capacity topology_get_freq_scale - #define arch_scale_freq_invariant topology_scale_freq_invariant - #define arch_scale_cpu_capacity topology_get_cpu_scale - #define arch_update_cpu_topology topology_update_cpu_topology - #define arch_scale_thermal_pressure topology_get_thermal_pressure - #define arch_set_thermal_pressure topology_set_thermal_pressure Bring arch_set_freq_scale() in line with these functions by renaming it to topology_set_freq_scale() in the arch topology driver, and by defining the arch_set_freq_scale symbol to point to the new function for arm and arm64. While there are other users of the arch_topology driver, this patch defines arch_set_freq_scale for arm and arm64 only, due to their existing definitions of arch_scale_freq_capacity. This is the getter function of the frequency invariance scale factor and without a getter function, the setter function - arch_set_freq_scale() has not purpose. Signed-off-by: Ionela Voinescu <ionela.voinescu@arm.com> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Acked-by: Catalin Marinas <catalin.marinas@arm.com> Acked-by: Sudeep Holla <sudeep.holla@arm.com> (BL_SWITCHER and topology parts) Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent efad424 commit a20b705

6 files changed

Lines changed: 14 additions & 12 deletions

File tree

arch/arm/include/asm/topology.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include <linux/arch_topology.h>
99

1010
/* Replace task scheduler's default frequency-invariant accounting */
11+
#define arch_set_freq_scale topology_set_freq_scale
1112
#define arch_scale_freq_capacity topology_get_freq_scale
1213
#define arch_scale_freq_invariant topology_scale_freq_invariant
1314

arch/arm64/include/asm/topology.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ 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
3031
#define arch_scale_freq_invariant topology_scale_freq_invariant
3132

drivers/base/arch_topology.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ __weak bool arch_freq_counters_available(const struct cpumask *cpus)
3333
}
3434
DEFINE_PER_CPU(unsigned long, freq_scale) = SCHED_CAPACITY_SCALE;
3535

36-
void arch_set_freq_scale(const struct cpumask *cpus, unsigned long cur_freq,
37-
unsigned long max_freq)
36+
void topology_set_freq_scale(const struct cpumask *cpus, unsigned long cur_freq,
37+
unsigned long max_freq)
3838
{
3939
unsigned long scale;
4040
int i;

drivers/cpufreq/cpufreq.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -160,13 +160,6 @@ u64 get_cpu_idle_time(unsigned int cpu, u64 *wall, int io_busy)
160160
}
161161
EXPORT_SYMBOL_GPL(get_cpu_idle_time);
162162

163-
__weak void arch_set_freq_scale(const struct cpumask *cpus,
164-
unsigned long cur_freq,
165-
unsigned long max_freq)
166-
{
167-
}
168-
EXPORT_SYMBOL_GPL(arch_set_freq_scale);
169-
170163
/*
171164
* This is a generic cpufreq init() routine which can be used by cpufreq
172165
* drivers of SMP systems. It will do following:

include/linux/arch_topology.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ static inline unsigned long topology_get_freq_scale(int cpu)
3030
return per_cpu(freq_scale, cpu);
3131
}
3232

33+
void topology_set_freq_scale(const struct cpumask *cpus, unsigned long cur_freq,
34+
unsigned long max_freq);
3335
bool topology_scale_freq_invariant(void);
3436

3537
bool arch_freq_counters_available(const struct cpumask *cpus);

include/linux/cpufreq.h

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1011,9 +1011,14 @@ static inline void sched_cpufreq_governor_change(struct cpufreq_policy *policy,
10111011
extern void arch_freq_prepare_all(void);
10121012
extern unsigned int arch_freq_get_on_cpu(int cpu);
10131013

1014-
extern void arch_set_freq_scale(const struct cpumask *cpus,
1015-
unsigned long cur_freq,
1016-
unsigned long max_freq);
1014+
#ifndef arch_set_freq_scale
1015+
static __always_inline
1016+
void arch_set_freq_scale(const struct cpumask *cpus,
1017+
unsigned long cur_freq,
1018+
unsigned long max_freq)
1019+
{
1020+
}
1021+
#endif
10171022

10181023
/* the following are really really optional */
10191024
extern struct freq_attr cpufreq_freq_attr_scaling_available_freqs;

0 commit comments

Comments
 (0)