Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/roland...
[sfrench/cifs-2.6.git] / arch / tile / include / asm / topology.h
1 /*
2  * Copyright 2010 Tilera Corporation. All Rights Reserved.
3  *
4  *   This program is free software; you can redistribute it and/or
5  *   modify it under the terms of the GNU General Public License
6  *   as published by the Free Software Foundation, version 2.
7  *
8  *   This program is distributed in the hope that it will be useful, but
9  *   WITHOUT ANY WARRANTY; without even the implied warranty of
10  *   MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
11  *   NON INFRINGEMENT.  See the GNU General Public License for
12  *   more details.
13  */
14
15 #ifndef _ASM_TILE_TOPOLOGY_H
16 #define _ASM_TILE_TOPOLOGY_H
17
18 #ifdef CONFIG_NUMA
19
20 #include <linux/cpumask.h>
21
22 /* Mappings between logical cpu number and node number. */
23 extern struct cpumask node_2_cpu_mask[];
24 extern char cpu_2_node[];
25
26 /* Returns the number of the node containing CPU 'cpu'. */
27 static inline int cpu_to_node(int cpu)
28 {
29         return cpu_2_node[cpu];
30 }
31
32 /*
33  * Returns the number of the node containing Node 'node'.
34  * This architecture is flat, so it is a pretty simple function!
35  */
36 #define parent_node(node) (node)
37
38 /* Returns a bitmask of CPUs on Node 'node'. */
39 static inline const struct cpumask *cpumask_of_node(int node)
40 {
41         return &node_2_cpu_mask[node];
42 }
43
44 /* For now, use numa node -1 for global allocation. */
45 #define pcibus_to_node(bus)             ((void)(bus), -1)
46
47 /* sched_domains SD_NODE_INIT for TILE architecture */
48 #define SD_NODE_INIT (struct sched_domain) {            \
49         .min_interval           = 8,                    \
50         .max_interval           = 32,                   \
51         .busy_factor            = 32,                   \
52         .imbalance_pct          = 125,                  \
53         .cache_nice_tries       = 1,                    \
54         .busy_idx               = 3,                    \
55         .idle_idx               = 1,                    \
56         .newidle_idx            = 2,                    \
57         .wake_idx               = 1,                    \
58         .flags                  = SD_LOAD_BALANCE       \
59                                 | SD_BALANCE_NEWIDLE    \
60                                 | SD_BALANCE_EXEC       \
61                                 | SD_BALANCE_FORK       \
62                                 | SD_WAKE_AFFINE        \
63                                 | SD_SERIALIZE,         \
64         .last_balance           = jiffies,              \
65         .balance_interval       = 1,                    \
66 }
67
68 /* By definition, we create nodes based on online memory. */
69 #define node_has_online_mem(nid) 1
70
71 #endif /* CONFIG_NUMA */
72
73 #include <asm-generic/topology.h>
74
75 #ifdef CONFIG_SMP
76 #define topology_physical_package_id(cpu)       ((void)(cpu), 0)
77 #define topology_core_id(cpu)                   (cpu)
78 #define topology_core_cpumask(cpu)              ((void)(cpu), cpu_online_mask)
79 #define topology_thread_cpumask(cpu)            cpumask_of(cpu)
80
81 /* indicates that pointers to the topology struct cpumask maps are valid */
82 #define arch_provides_topology_pointers         yes
83 #endif
84
85 #endif /* _ASM_TILE_TOPOLOGY_H */