mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-28 04:35:17 +07:00
a20b7053b5
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>
77 lines
2.1 KiB
C
77 lines
2.1 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
/*
|
|
* include/linux/arch_topology.h - arch specific cpu topology information
|
|
*/
|
|
#ifndef _LINUX_ARCH_TOPOLOGY_H_
|
|
#define _LINUX_ARCH_TOPOLOGY_H_
|
|
|
|
#include <linux/types.h>
|
|
#include <linux/percpu.h>
|
|
|
|
void topology_normalize_cpu_scale(void);
|
|
int topology_update_cpu_topology(void);
|
|
|
|
struct device_node;
|
|
bool topology_parse_cpu_capacity(struct device_node *cpu_node, int cpu);
|
|
|
|
DECLARE_PER_CPU(unsigned long, cpu_scale);
|
|
|
|
static inline unsigned long topology_get_cpu_scale(int cpu)
|
|
{
|
|
return per_cpu(cpu_scale, cpu);
|
|
}
|
|
|
|
void topology_set_cpu_scale(unsigned int cpu, unsigned long capacity);
|
|
|
|
DECLARE_PER_CPU(unsigned long, freq_scale);
|
|
|
|
static inline unsigned long topology_get_freq_scale(int cpu)
|
|
{
|
|
return per_cpu(freq_scale, cpu);
|
|
}
|
|
|
|
void topology_set_freq_scale(const struct cpumask *cpus, unsigned long cur_freq,
|
|
unsigned long max_freq);
|
|
bool topology_scale_freq_invariant(void);
|
|
|
|
bool arch_freq_counters_available(const struct cpumask *cpus);
|
|
|
|
DECLARE_PER_CPU(unsigned long, thermal_pressure);
|
|
|
|
static inline unsigned long topology_get_thermal_pressure(int cpu)
|
|
{
|
|
return per_cpu(thermal_pressure, cpu);
|
|
}
|
|
|
|
void topology_set_thermal_pressure(const struct cpumask *cpus,
|
|
unsigned long th_pressure);
|
|
|
|
struct cpu_topology {
|
|
int thread_id;
|
|
int core_id;
|
|
int package_id;
|
|
int llc_id;
|
|
cpumask_t thread_sibling;
|
|
cpumask_t core_sibling;
|
|
cpumask_t llc_sibling;
|
|
};
|
|
|
|
#ifdef CONFIG_GENERIC_ARCH_TOPOLOGY
|
|
extern struct cpu_topology cpu_topology[NR_CPUS];
|
|
|
|
#define topology_physical_package_id(cpu) (cpu_topology[cpu].package_id)
|
|
#define topology_core_id(cpu) (cpu_topology[cpu].core_id)
|
|
#define topology_core_cpumask(cpu) (&cpu_topology[cpu].core_sibling)
|
|
#define topology_sibling_cpumask(cpu) (&cpu_topology[cpu].thread_sibling)
|
|
#define topology_llc_cpumask(cpu) (&cpu_topology[cpu].llc_sibling)
|
|
void init_cpu_topology(void);
|
|
void store_cpu_topology(unsigned int cpuid);
|
|
const struct cpumask *cpu_coregroup_mask(int cpu);
|
|
void update_siblings_masks(unsigned int cpu);
|
|
void remove_cpu_topology(unsigned int cpuid);
|
|
void reset_cpu_topology(void);
|
|
int parse_acpi_topology(void);
|
|
#endif
|
|
|
|
#endif /* _LINUX_ARCH_TOPOLOGY_H_ */
|