Sam Ravnborg | f5e706a | 2008-07-17 21:55:51 -0700 | [diff] [blame] | 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 | } |
Rusty Russell | 96d76a7 | 2008-12-26 22:23:38 +1030 | [diff] [blame] | 19 | #define cpumask_of_node(node) (&numa_cpumask_lookup_table[node]) |
Sam Ravnborg | f5e706a | 2008-07-17 21:55:51 -0700 | [diff] [blame] | 20 | |
Rusty Russell | 96d76a7 | 2008-12-26 22:23:38 +1030 | [diff] [blame] | 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 | */ |
Sam Ravnborg | f5e706a | 2008-07-17 21:55:51 -0700 | [diff] [blame] | 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 | static inline int node_to_first_cpu(int node) |
| 32 | { |
Rusty Russell | 96d76a7 | 2008-12-26 22:23:38 +1030 | [diff] [blame] | 33 | return cpumask_first(cpumask_of_node(node)); |
Sam Ravnborg | f5e706a | 2008-07-17 21:55:51 -0700 | [diff] [blame] | 34 | } |
| 35 | |
| 36 | struct pci_bus; |
| 37 | #ifdef CONFIG_PCI |
| 38 | extern int pcibus_to_node(struct pci_bus *pbus); |
| 39 | #else |
| 40 | static inline int pcibus_to_node(struct pci_bus *pbus) |
| 41 | { |
| 42 | return -1; |
| 43 | } |
| 44 | #endif |
| 45 | |
| 46 | #define pcibus_to_cpumask(bus) \ |
| 47 | (pcibus_to_node(bus) == -1 ? \ |
| 48 | CPU_MASK_ALL : \ |
| 49 | node_to_cpumask(pcibus_to_node(bus))) |
David Miller | 9d07933 | 2009-01-11 04:06:40 -0800 | [diff] [blame] | 50 | #define cpumask_of_pcibus(bus) \ |
| 51 | (pcibus_to_node(bus) == -1 ? \ |
| 52 | CPU_MASK_ALL_PTR : \ |
| 53 | cpumask_of_node(pcibus_to_node(bus))) |
Sam Ravnborg | f5e706a | 2008-07-17 21:55:51 -0700 | [diff] [blame] | 54 | |
| 55 | #define SD_NODE_INIT (struct sched_domain) { \ |
| 56 | .min_interval = 8, \ |
| 57 | .max_interval = 32, \ |
| 58 | .busy_factor = 32, \ |
| 59 | .imbalance_pct = 125, \ |
| 60 | .cache_nice_tries = 2, \ |
| 61 | .busy_idx = 3, \ |
| 62 | .idle_idx = 2, \ |
| 63 | .newidle_idx = 0, \ |
| 64 | .wake_idx = 1, \ |
| 65 | .forkexec_idx = 1, \ |
| 66 | .flags = SD_LOAD_BALANCE \ |
| 67 | | SD_BALANCE_FORK \ |
| 68 | | SD_BALANCE_EXEC \ |
| 69 | | SD_SERIALIZE \ |
| 70 | | SD_WAKE_BALANCE, \ |
| 71 | .last_balance = jiffies, \ |
| 72 | .balance_interval = 1, \ |
| 73 | } |
| 74 | |
| 75 | #else /* CONFIG_NUMA */ |
| 76 | |
| 77 | #include <asm-generic/topology.h> |
| 78 | |
| 79 | #endif /* !(CONFIG_NUMA) */ |
| 80 | |
| 81 | #ifdef CONFIG_SMP |
| 82 | #define topology_physical_package_id(cpu) (cpu_data(cpu).proc_id) |
| 83 | #define topology_core_id(cpu) (cpu_data(cpu).core_id) |
| 84 | #define topology_core_siblings(cpu) (cpu_core_map[cpu]) |
| 85 | #define topology_thread_siblings(cpu) (per_cpu(cpu_sibling_map, cpu)) |
Rusty Russell | 78fd744 | 2009-01-01 10:12:20 +1030 | [diff] [blame] | 86 | #define topology_core_cpumask(cpu) (&cpu_core_map[cpu]) |
| 87 | #define topology_thread_cpumask(cpu) (&per_cpu(cpu_sibling_map, cpu)) |
Sam Ravnborg | f5e706a | 2008-07-17 21:55:51 -0700 | [diff] [blame] | 88 | #define mc_capable() (sparc64_multi_core) |
| 89 | #define smt_capable() (sparc64_multi_core) |
| 90 | #endif /* CONFIG_SMP */ |
| 91 | |
| 92 | #define cpu_coregroup_map(cpu) (cpu_core_map[cpu]) |
Rusty Russell | a0ae09b | 2008-12-26 22:23:42 +1030 | [diff] [blame] | 93 | #define cpu_coregroup_mask(cpu) (&cpu_core_map[cpu]) |
Sam Ravnborg | f5e706a | 2008-07-17 21:55:51 -0700 | [diff] [blame] | 94 | |
| 95 | #endif /* _ASM_SPARC64_TOPOLOGY_H */ |