xref: /openbmc/linux/arch/sparc/include/asm/topology_64.h (revision b8bb76713ec50df2f11efee386e16f93d51e1076)
1 #ifndef _ASM_SPARC64_TOPOLOGY_H
2 #define _ASM_SPARC64_TOPOLOGY_H
3 
4 #ifdef CONFIG_NUMA
5 
6 #include <asm/mmzone.h>
7 
8 static inline int cpu_to_node(int cpu)
9 {
10 	return numa_cpu_lookup_table[cpu];
11 }
12 
13 #define parent_node(node)	(node)
14 
15 static inline cpumask_t node_to_cpumask(int node)
16 {
17 	return numa_cpumask_lookup_table[node];
18 }
19 #define cpumask_of_node(node) (&numa_cpumask_lookup_table[node])
20 
21 /*
22  * Returns a pointer to the cpumask of CPUs on Node 'node'.
23  * Deprecated: use "const struct cpumask *mask = cpumask_of_node(node)"
24  */
25 #define node_to_cpumask_ptr(v, node)		\
26 		cpumask_t *v = &(numa_cpumask_lookup_table[node])
27 
28 #define node_to_cpumask_ptr_next(v, node)	\
29 			   v = &(numa_cpumask_lookup_table[node])
30 
31 struct pci_bus;
32 #ifdef CONFIG_PCI
33 extern int pcibus_to_node(struct pci_bus *pbus);
34 #else
35 static inline int pcibus_to_node(struct pci_bus *pbus)
36 {
37 	return -1;
38 }
39 #endif
40 
41 #define cpumask_of_pcibus(bus)	\
42 	(pcibus_to_node(bus) == -1 ? \
43 	 cpu_all_mask : \
44 	 cpumask_of_node(pcibus_to_node(bus)))
45 
46 #define SD_NODE_INIT (struct sched_domain) {		\
47 	.min_interval		= 8,			\
48 	.max_interval		= 32,			\
49 	.busy_factor		= 32,			\
50 	.imbalance_pct		= 125,			\
51 	.cache_nice_tries	= 2,			\
52 	.busy_idx		= 3,			\
53 	.idle_idx		= 2,			\
54 	.newidle_idx		= 0, 			\
55 	.wake_idx		= 1,			\
56 	.forkexec_idx		= 1,			\
57 	.flags			= SD_LOAD_BALANCE	\
58 				| SD_BALANCE_FORK	\
59 				| SD_BALANCE_EXEC	\
60 				| SD_SERIALIZE		\
61 				| SD_WAKE_BALANCE,	\
62 	.last_balance		= jiffies,		\
63 	.balance_interval	= 1,			\
64 }
65 
66 #else /* CONFIG_NUMA */
67 
68 #include <asm-generic/topology.h>
69 
70 #endif /* !(CONFIG_NUMA) */
71 
72 #ifdef CONFIG_SMP
73 #define topology_physical_package_id(cpu)	(cpu_data(cpu).proc_id)
74 #define topology_core_id(cpu)			(cpu_data(cpu).core_id)
75 #define topology_core_siblings(cpu)		(cpu_core_map[cpu])
76 #define topology_thread_siblings(cpu)		(per_cpu(cpu_sibling_map, cpu))
77 #define topology_core_cpumask(cpu)		(&cpu_core_map[cpu])
78 #define topology_thread_cpumask(cpu)		(&per_cpu(cpu_sibling_map, cpu))
79 #define mc_capable()				(sparc64_multi_core)
80 #define smt_capable()				(sparc64_multi_core)
81 #endif /* CONFIG_SMP */
82 
83 #define cpu_coregroup_mask(cpu)			(&cpu_core_map[cpu])
84 
85 #endif /* _ASM_SPARC64_TOPOLOGY_H */
86