blob: d9bdc1a7f4e7aa9874e60f3dd29ef3175f11ed6c [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);
Morten Rasmussenbb1fbdd2018-07-20 14:32:32 +010012int topology_update_cpu_topology(void);
Juri Lelli615ffd62017-05-31 17:59:30 +010013
14struct device_node;
Viresh Kumar805df292017-06-23 14:55:32 +053015bool topology_parse_cpu_capacity(struct device_node *cpu_node, int cpu);
Juri Lelli615ffd62017-05-31 17:59:30 +010016
Dietmar Eggemann8216f582017-09-26 17:41:11 +010017DECLARE_PER_CPU(unsigned long, cpu_scale);
18
Juri Lelli615ffd62017-05-31 17:59:30 +010019struct sched_domain;
Dietmar Eggemann8216f582017-09-26 17:41:11 +010020static inline
21unsigned long topology_get_cpu_scale(struct sched_domain *sd, int cpu)
22{
23 return per_cpu(cpu_scale, cpu);
24}
Juri Lelli615ffd62017-05-31 17:59:30 +010025
Juri Lelli4ca4f262017-05-31 17:59:31 +010026void topology_set_cpu_scale(unsigned int cpu, unsigned long capacity);
Juri Lelli615ffd62017-05-31 17:59:30 +010027
Dietmar Eggemann0e27c562017-09-26 17:41:10 +010028DECLARE_PER_CPU(unsigned long, freq_scale);
29
30static inline
Juri Lelli7673c8a2017-12-04 11:23:23 +010031unsigned long topology_get_freq_scale(int cpu)
Dietmar Eggemann0e27c562017-09-26 17:41:10 +010032{
33 return per_cpu(freq_scale, cpu);
34}
35
Juri Lelli615ffd62017-05-31 17:59:30 +010036#endif /* _LINUX_ARCH_TOPOLOGY_H_ */