History

cpu-topology: Move cpu topology code to common code.

Both RISC-V & ARM64 are using cpu-map device tree to describe their cpu topology. It's better to move the relevant code to a common place instead of duplicate code.

Atish Patra committed 7 years ago

Commit 60c1b221 parent 124e46a5 files · +329 −322Browse files

Showing the changes to include/linux (2 of 5 files). Show all

Unified · Split

2 files
  1. include/linux/arch_topology.h +28 −0
  2. include/linux/topology.h +1 −0
include/linux/arch_topology.h+28−0
@@ -33,4 +33,32 @@ unsigned long topology_get_freq_scale(int cpu) · 32 unmodified lines
33 return per_cpu(freq_scale, cpu);33 return per_cpu(freq_scale, cpu);
34}34}
35 35
36struct cpu_topology {
37 int thread_id;
38 int core_id;
39 int package_id;
40 int llc_id;
41 cpumask_t thread_sibling;
42 cpumask_t core_sibling;
43 cpumask_t llc_sibling;
44};
45
46#ifdef CONFIG_GENERIC_ARCH_TOPOLOGY
47extern struct cpu_topology cpu_topology[NR_CPUS];
48
49#define topology_physical_package_id(cpu) (cpu_topology[cpu].package_id)
50#define topology_core_id(cpu) (cpu_topology[cpu].core_id)
51#define topology_core_cpumask(cpu) (&cpu_topology[cpu].core_sibling)
52#define topology_sibling_cpumask(cpu) (&cpu_topology[cpu].thread_sibling)
53#define topology_llc_cpumask(cpu) (&cpu_topology[cpu].llc_sibling)
54void init_cpu_topology(void);
55void store_cpu_topology(unsigned int cpuid);
56const struct cpumask *cpu_coregroup_mask(int cpu);
57#endif
58
59#if defined(CONFIG_ARM64) || defined(CONFIG_RISCV)
60void update_siblings_masks(unsigned int cpu);
61#endif
62void remove_cpu_topology(unsigned int cpuid);
63
36#endif /* _LINUX_ARCH_TOPOLOGY_H_ */64#endif /* _LINUX_ARCH_TOPOLOGY_H_ */
include/linux/topology.h+1−0
@@ -27,6 +27,7 @@ · 26 unmodified lines
27#ifndef _LINUX_TOPOLOGY_H27#ifndef _LINUX_TOPOLOGY_H
28#define _LINUX_TOPOLOGY_H28#define _LINUX_TOPOLOGY_H
29 29
30#include <linux/arch_topology.h>
30#include <linux/cpumask.h>31#include <linux/cpumask.h>
31#include <linux/bitops.h>32#include <linux/bitops.h>
32#include <linux/mmzone.h>33#include <linux/mmzone.h>

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t