blob: 001c04027c82b3f774a8c4aaeed12f5eff8c8835 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#ifndef _ASM_SPARC64_TOPOLOGY_H
2#define _ASM_SPARC64_TOPOLOGY_H
3
David S. Miller919ee672008-04-23 05:40:25 -07004#ifdef CONFIG_NUMA
5
6#include <asm/mmzone.h>
7
8static inline int cpu_to_node(int cpu)
9{
10 return numa_cpu_lookup_table[cpu];
11}
12
13#define parent_node(node) (node)
14
15static inline cpumask_t node_to_cpumask(int node)
16{
17 return numa_cpumask_lookup_table[node];
18}
19
20/* Returns a pointer to the cpumask of CPUs on Node 'node'. */
21#define node_to_cpumask_ptr(v, node) \
22 cpumask_t *v = &(numa_cpumask_lookup_table[node])
23
24#define node_to_cpumask_ptr_next(v, node) \
25 v = &(numa_cpumask_lookup_table[node])
26
27static inline int node_to_first_cpu(int node)
28{
29 cpumask_t tmp;
30 tmp = node_to_cpumask(node);
31 return first_cpu(tmp);
32}
33
34struct pci_bus;
35#ifdef CONFIG_PCI
36extern int pcibus_to_node(struct pci_bus *pbus);
37#else
38static inline int pcibus_to_node(struct pci_bus *pbus)
39{
40 return -1;
41}
42#endif
43
44#define pcibus_to_cpumask(bus) \
45 (pcibus_to_node(bus) == -1 ? \
46 CPU_MASK_ALL : \
47 node_to_cpumask(pcibus_to_node(bus)))
48
49#define SD_NODE_INIT (struct sched_domain) { \
50 .min_interval = 8, \
51 .max_interval = 32, \
52 .busy_factor = 32, \
53 .imbalance_pct = 125, \
54 .cache_nice_tries = 2, \
55 .busy_idx = 3, \
56 .idle_idx = 2, \
57 .newidle_idx = 0, \
58 .wake_idx = 1, \
59 .forkexec_idx = 1, \
60 .flags = SD_LOAD_BALANCE \
61 | SD_BALANCE_FORK \
62 | SD_BALANCE_EXEC \
63 | SD_SERIALIZE \
64 | SD_WAKE_BALANCE, \
65 .last_balance = jiffies, \
66 .balance_interval = 1, \
67}
68
69#else /* CONFIG_NUMA */
70
71#include <asm-generic/topology.h>
72
73#endif /* !(CONFIG_NUMA) */
74
David S. Millerf78eae22007-06-04 17:01:39 -070075#ifdef CONFIG_SMP
David S. Millerf78eae22007-06-04 17:01:39 -070076#define topology_physical_package_id(cpu) (cpu_data(cpu).proc_id)
77#define topology_core_id(cpu) (cpu_data(cpu).core_id)
78#define topology_core_siblings(cpu) (cpu_core_map[cpu])
Mike Travisd5a74302007-10-16 01:24:05 -070079#define topology_thread_siblings(cpu) (per_cpu(cpu_sibling_map, cpu))
David S. Millera2f9f6b2007-06-04 21:48:33 -070080#define mc_capable() (sparc64_multi_core)
81#define smt_capable() (sparc64_multi_core)
David S. Millerf78eae22007-06-04 17:01:39 -070082#endif /* CONFIG_SMP */
Siddha, Suresh B5c45bf22006-06-27 02:54:42 -070083
David S. Millerf78eae22007-06-04 17:01:39 -070084#define cpu_coregroup_map(cpu) (cpu_core_map[cpu])
David S. Miller5cbc3072007-05-25 15:49:59 -070085
Linus Torvalds1da177e2005-04-16 15:20:36 -070086#endif /* _ASM_SPARC64_TOPOLOGY_H */