]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blob - arch/powerpc/include/asm/topology.h
Merge remote-tracking branch 'regulator/fix/max77802' into regulator-linus
[mirror_ubuntu-artful-kernel.git] / arch / powerpc / include / asm / topology.h
1 #ifndef _ASM_POWERPC_TOPOLOGY_H
2 #define _ASM_POWERPC_TOPOLOGY_H
3 #ifdef __KERNEL__
4
5
6 struct device;
7 struct device_node;
8
9 #ifdef CONFIG_NUMA
10
11 /*
12 * If zone_reclaim_mode is enabled, a RECLAIM_DISTANCE of 10 will mean that
13 * all zones on all nodes will be eligible for zone_reclaim().
14 */
15 #define RECLAIM_DISTANCE 10
16
17 #include <asm/mmzone.h>
18
19 #define parent_node(node) (node)
20
21 #define cpumask_of_node(node) ((node) == -1 ? \
22 cpu_all_mask : \
23 node_to_cpumask_map[node])
24
25 struct pci_bus;
26 #ifdef CONFIG_PCI
27 extern int pcibus_to_node(struct pci_bus *bus);
28 #else
29 static inline int pcibus_to_node(struct pci_bus *bus)
30 {
31 return -1;
32 }
33 #endif
34
35 #define cpumask_of_pcibus(bus) (pcibus_to_node(bus) == -1 ? \
36 cpu_all_mask : \
37 cpumask_of_node(pcibus_to_node(bus)))
38
39 extern int __node_distance(int, int);
40 #define node_distance(a, b) __node_distance(a, b)
41
42 extern void __init dump_numa_cpu_topology(void);
43
44 extern int sysfs_add_device_to_node(struct device *dev, int nid);
45 extern void sysfs_remove_device_from_node(struct device *dev, int nid);
46
47 static inline int early_cpu_to_node(int cpu)
48 {
49 int nid;
50
51 nid = numa_cpu_lookup_table[cpu];
52
53 /*
54 * Fall back to node 0 if nid is unset (it should be, except bugs).
55 * This allows callers to safely do NODE_DATA(early_cpu_to_node(cpu)).
56 */
57 return (nid < 0) ? 0 : nid;
58 }
59 #else
60
61 static inline int early_cpu_to_node(int cpu) { return 0; }
62
63 static inline void dump_numa_cpu_topology(void) {}
64
65 static inline int sysfs_add_device_to_node(struct device *dev, int nid)
66 {
67 return 0;
68 }
69
70 static inline void sysfs_remove_device_from_node(struct device *dev,
71 int nid)
72 {
73 }
74 #endif /* CONFIG_NUMA */
75
76 #if defined(CONFIG_NUMA) && defined(CONFIG_PPC_SPLPAR)
77 extern int start_topology_update(void);
78 extern int stop_topology_update(void);
79 extern int prrn_is_enabled(void);
80 #else
81 static inline int start_topology_update(void)
82 {
83 return 0;
84 }
85 static inline int stop_topology_update(void)
86 {
87 return 0;
88 }
89 static inline int prrn_is_enabled(void)
90 {
91 return 0;
92 }
93 #endif /* CONFIG_NUMA && CONFIG_PPC_SPLPAR */
94
95 #include <asm-generic/topology.h>
96
97 #ifdef CONFIG_SMP
98 #include <asm/cputable.h>
99
100 #ifdef CONFIG_PPC64
101 #include <asm/smp.h>
102
103 #define topology_physical_package_id(cpu) (cpu_to_chip_id(cpu))
104 #define topology_sibling_cpumask(cpu) (per_cpu(cpu_sibling_map, cpu))
105 #define topology_core_cpumask(cpu) (per_cpu(cpu_core_map, cpu))
106 #define topology_core_id(cpu) (cpu_to_core_id(cpu))
107 #endif
108 #endif
109
110 #endif /* __KERNEL__ */
111 #endif /* _ASM_POWERPC_TOPOLOGY_H */