blob: 2b709416de051989c56b916f1c8e6a3b02b4b3c7 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Juri Lelli615ffd62017-05-31 17:59:30 +01002/*
3 * include/linux/arch_topology.h - arch specific cpu topology information
4 */
5#ifndef _LINUX_ARCH_TOPOLOGY_H_
6#define _LINUX_ARCH_TOPOLOGY_H_
7
Viresh Kumar805df292017-06-23 14:55:32 +05308#include <linux/types.h>
Dietmar Eggemann0e27c562017-09-26 17:41:10 +01009#include <linux/percpu.h>
Viresh Kumar805df292017-06-23 14:55:32 +053010
Juri Lelli4ca4f262017-05-31 17:59:31 +010011void topology_normalize_cpu_scale(void);
Juri Lelli615ffd62017-05-31 17:59:30 +010012
13struct device_node;
Viresh Kumar805df292017-06-23 14:55:32 +053014bool topology_parse_cpu_capacity(struct device_node *cpu_node, int cpu);
Juri Lelli615ffd62017-05-31 17:59:30 +010015
Dietmar Eggemann8216f582017-09-26 17:41:11 +010016DECLARE_PER_CPU(unsigned long, cpu_scale);
17
Juri Lelli615ffd62017-05-31 17:59:30 +010018struct sched_domain;
Dietmar Eggemann8216f582017-09-26 17:41:11 +010019static inline
20unsigned long topology_get_cpu_scale(struct sched_domain *sd, int cpu)
21{
22 return per_cpu(cpu_scale, cpu);
23}
Juri Lelli615ffd62017-05-31 17:59:30 +010024
Juri Lelli4ca4f262017-05-31 17:59:31 +010025void topology_set_cpu_scale(unsigned int cpu, unsigned long capacity);
Juri Lelli615ffd62017-05-31 17:59:30 +010026
Dietmar Eggemann0e27c562017-09-26 17:41:10 +010027DECLARE_PER_CPU(unsigned long, freq_scale);
28
29static inline
Juri Lelli7673c8a2017-12-04 11:23:23 +010030unsigned long topology_get_freq_scale(int cpu)
Dietmar Eggemann0e27c562017-09-26 17:41:10 +010031{
32 return per_cpu(freq_scale, cpu);
33}
34
Juri Lelli615ffd62017-05-31 17:59:30 +010035#endif /* _LINUX_ARCH_TOPOLOGY_H_ */