Mark Brown | f6e763b | 2014-03-04 07:51:17 +0000 | [diff] [blame] | 1 | #ifndef __ASM_TOPOLOGY_H |
| 2 | #define __ASM_TOPOLOGY_H |
| 3 | |
Mark Brown | f6e763b | 2014-03-04 07:51:17 +0000 | [diff] [blame] | 4 | #include <linux/cpumask.h> |
| 5 | |
| 6 | struct cpu_topology { |
| 7 | int thread_id; |
| 8 | int core_id; |
| 9 | int cluster_id; |
| 10 | cpumask_t thread_sibling; |
| 11 | cpumask_t core_sibling; |
| 12 | }; |
| 13 | |
| 14 | extern struct cpu_topology cpu_topology[NR_CPUS]; |
| 15 | |
| 16 | #define topology_physical_package_id(cpu) (cpu_topology[cpu].cluster_id) |
| 17 | #define topology_core_id(cpu) (cpu_topology[cpu].core_id) |
| 18 | #define topology_core_cpumask(cpu) (&cpu_topology[cpu].core_sibling) |
Bartosz Golaszewski | 06931e6 | 2015-05-26 15:11:28 +0200 | [diff] [blame] | 19 | #define topology_sibling_cpumask(cpu) (&cpu_topology[cpu].thread_sibling) |
Mark Brown | f6e763b | 2014-03-04 07:51:17 +0000 | [diff] [blame] | 20 | |
Mark Brown | f6e763b | 2014-03-04 07:51:17 +0000 | [diff] [blame] | 21 | void init_cpu_topology(void); |
| 22 | void store_cpu_topology(unsigned int cpuid); |
| 23 | const struct cpumask *cpu_coregroup_mask(int cpu); |
| 24 | |
Ganapatrao Kulkarni | 1a2db30 | 2016-04-08 15:50:27 -0700 | [diff] [blame] | 25 | #ifdef CONFIG_NUMA |
| 26 | |
| 27 | struct pci_bus; |
| 28 | int pcibus_to_node(struct pci_bus *bus); |
| 29 | #define cpumask_of_pcibus(bus) (pcibus_to_node(bus) == -1 ? \ |
| 30 | cpu_all_mask : \ |
| 31 | cpumask_of_node(pcibus_to_node(bus))) |
| 32 | |
| 33 | #endif /* CONFIG_NUMA */ |
Juri Lelli | 5e900d4 | 2015-04-30 11:53:48 +0100 | [diff] [blame] | 34 | struct sched_domain; |
Dietmar Eggemann | ea31a3e | 2015-09-25 17:15:11 +0100 | [diff] [blame] | 35 | #ifdef CONFIG_CPU_FREQ |
| 36 | #define arch_scale_freq_capacity cpufreq_scale_freq_capacity |
Dietmar Eggemann | ea31a3e | 2015-09-25 17:15:11 +0100 | [diff] [blame] | 37 | extern unsigned long cpufreq_scale_freq_capacity(struct sched_domain *sd, int cpu); |
Dietmar Eggemann | bcf1c9d | 2017-07-14 14:30:31 +0100 | [diff] [blame] | 38 | #define arch_scale_max_freq_capacity cpufreq_scale_max_freq_capacity |
| 39 | extern unsigned long cpufreq_scale_max_freq_capacity(struct sched_domain *sd, int cpu); |
Chris Redpath | 55e95f99 | 2017-05-25 11:17:05 +0100 | [diff] [blame] | 40 | #define arch_scale_min_freq_capacity cpufreq_scale_min_freq_capacity |
| 41 | extern unsigned long cpufreq_scale_min_freq_capacity(struct sched_domain *sd, int cpu); |
Dietmar Eggemann | ea31a3e | 2015-09-25 17:15:11 +0100 | [diff] [blame] | 42 | #endif |
Juri Lelli | 5e900d4 | 2015-04-30 11:53:48 +0100 | [diff] [blame] | 43 | #define arch_scale_cpu_capacity scale_cpu_capacity |
| 44 | extern unsigned long scale_cpu_capacity(struct sched_domain *sd, int cpu); |
Ganapatrao Kulkarni | 1a2db30 | 2016-04-08 15:50:27 -0700 | [diff] [blame] | 45 | |
Mark Brown | f6e763b | 2014-03-04 07:51:17 +0000 | [diff] [blame] | 46 | #include <asm-generic/topology.h> |
| 47 | |
| 48 | #endif /* _ASM_ARM_TOPOLOGY_H */ |