blob: 39624abb6a48f0b23a75880cd4314b9796ec9de3 [file] [log] [blame]
Sam Ravnborgf5e706a2008-07-17 21:55:51 -07001#ifndef _ASM_SPARC64_TOPOLOGY_H
2#define _ASM_SPARC64_TOPOLOGY_H
3
4#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}
Rusty Russell96d76a72008-12-26 22:23:38 +103019#define cpumask_of_node(node) (&numa_cpumask_lookup_table[node])
Sam Ravnborgf5e706a2008-07-17 21:55:51 -070020
Rusty Russell96d76a72008-12-26 22:23:38 +103021/*
22 * Returns a pointer to the cpumask of CPUs on Node 'node'.
23 * Deprecated: use "const struct cpumask *mask = cpumask_of_node(node)"
24 */
Sam Ravnborgf5e706a2008-07-17 21:55:51 -070025#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
31static inline int node_to_first_cpu(int node)
32{
Rusty Russell96d76a72008-12-26 22:23:38 +103033 return cpumask_first(cpumask_of_node(node));
Sam Ravnborgf5e706a2008-07-17 21:55:51 -070034}
35
36struct pci_bus;
37#ifdef CONFIG_PCI
38extern int pcibus_to_node(struct pci_bus *pbus);
39#else
40static inline int pcibus_to_node(struct pci_bus *pbus)
41{
42 return -1;
43}
44#endif
45
David Miller9d079332009-01-11 04:06:40 -080046#define cpumask_of_pcibus(bus) \
47 (pcibus_to_node(bus) == -1 ? \
Rusty Russelle9b37512009-03-16 14:40:38 +103048 cpu_all_mask : \
David Miller9d079332009-01-11 04:06:40 -080049 cpumask_of_node(pcibus_to_node(bus)))
Sam Ravnborgf5e706a2008-07-17 21:55:51 -070050
51#define SD_NODE_INIT (struct sched_domain) { \
52 .min_interval = 8, \
53 .max_interval = 32, \
54 .busy_factor = 32, \
55 .imbalance_pct = 125, \
56 .cache_nice_tries = 2, \
57 .busy_idx = 3, \
58 .idle_idx = 2, \
59 .newidle_idx = 0, \
60 .wake_idx = 1, \
61 .forkexec_idx = 1, \
62 .flags = SD_LOAD_BALANCE \
63 | SD_BALANCE_FORK \
64 | SD_BALANCE_EXEC \
65 | SD_SERIALIZE \
66 | SD_WAKE_BALANCE, \
67 .last_balance = jiffies, \
68 .balance_interval = 1, \
69}
70
71#else /* CONFIG_NUMA */
72
73#include <asm-generic/topology.h>
74
75#endif /* !(CONFIG_NUMA) */
76
77#ifdef CONFIG_SMP
78#define topology_physical_package_id(cpu) (cpu_data(cpu).proc_id)
79#define topology_core_id(cpu) (cpu_data(cpu).core_id)
80#define topology_core_siblings(cpu) (cpu_core_map[cpu])
81#define topology_thread_siblings(cpu) (per_cpu(cpu_sibling_map, cpu))
Rusty Russell78fd7442009-01-01 10:12:20 +103082#define topology_core_cpumask(cpu) (&cpu_core_map[cpu])
83#define topology_thread_cpumask(cpu) (&per_cpu(cpu_sibling_map, cpu))
Sam Ravnborgf5e706a2008-07-17 21:55:51 -070084#define mc_capable() (sparc64_multi_core)
85#define smt_capable() (sparc64_multi_core)
86#endif /* CONFIG_SMP */
87
Rusty Russella0ae09b2008-12-26 22:23:42 +103088#define cpu_coregroup_mask(cpu) (&cpu_core_map[cpu])
Sam Ravnborgf5e706a2008-07-17 21:55:51 -070089
90#endif /* _ASM_SPARC64_TOPOLOGY_H */