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
3333 return per_cpu(freq_scale, cpu);
3434 }
3535
36+struct 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
47+extern 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)
54+void init_cpu_topology(void);
55+void store_cpu_topology(unsigned int cpuid);
56+const struct cpumask *cpu_coregroup_mask(int cpu);
57+#endif
58+
59+#if defined(CONFIG_ARM64) || defined(CONFIG_RISCV)
60+void update_siblings_masks(unsigned int cpu);
61+#endif
62+void remove_cpu_topology(unsigned int cpuid);
63+
3664 #endif /* _LINUX_ARCH_TOPOLOGY_H_ */
include/linux/topology.h+1−0
@@ -27,6 +27,7 @@ · 26 unmodified lines
2727 #ifndef _LINUX_TOPOLOGY_H
2828 #define _LINUX_TOPOLOGY_H
2929
30+#include <linux/arch_topology.h>
3031 #include <linux/cpumask.h>
3132 #include <linux/bitops.h>
3233 #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