]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blame - arch/powerpc/include/asm/topology.h
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
[mirror_ubuntu-artful-kernel.git] / arch / powerpc / include / asm / topology.h
CommitLineData
dd56fdf2 1#ifndef _ASM_POWERPC_TOPOLOGY_H
2#define _ASM_POWERPC_TOPOLOGY_H
88ced031 3#ifdef __KERNEL__
1da177e4 4
1da177e4 5
8a25a2fd 6struct device;
953039c8
JK
7struct device_node;
8
1da177e4
LT
9#ifdef CONFIG_NUMA
10
56608209 11/*
4f9b16a6
MG
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().
56608209
AB
14 */
15#define RECLAIM_DISTANCE 10
16
dd56fdf2 17#include <asm/mmzone.h>
18
1da177e4
LT
19#define parent_node(node) (node)
20
c81b812a
AB
21#define cpumask_of_node(node) ((node) == -1 ? \
22 cpu_all_mask : \
25863de0 23 node_to_cpumask_map[node])
86c6f274 24
357518fa 25struct pci_bus;
11faa658 26#ifdef CONFIG_PCI
357518fa 27extern int pcibus_to_node(struct pci_bus *bus);
11faa658
AB
28#else
29static inline int pcibus_to_node(struct pci_bus *bus)
30{
31 return -1;
32}
33#endif
357518fa 34
86c6f274
RR
35#define cpumask_of_pcibus(bus) (pcibus_to_node(bus) == -1 ? \
36 cpu_all_mask : \
37 cpumask_of_node(pcibus_to_node(bus)))
38
41eab6f8
AB
39extern int __node_distance(int, int);
40#define node_distance(a, b) __node_distance(a, b)
41
4b703a23
AB
42extern void __init dump_numa_cpu_topology(void);
43
8a25a2fd
KS
44extern int sysfs_add_device_to_node(struct device *dev, int nid);
45extern void sysfs_remove_device_from_node(struct device *dev, int nid);
953039c8 46
ba4a648f
ME
47static 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}
39bf990e 59#else
1da177e4 60
ba4a648f
ME
61static inline int early_cpu_to_node(int cpu) { return 0; }
62
4b703a23
AB
63static inline void dump_numa_cpu_topology(void) {}
64
8a25a2fd 65static inline int sysfs_add_device_to_node(struct device *dev, int nid)
953039c8
JK
66{
67 return 0;
68}
69
8a25a2fd 70static inline void sysfs_remove_device_from_node(struct device *dev,
953039c8
JK
71 int nid)
72{
73}
aa6b5446 74#endif /* CONFIG_NUMA */
953039c8 75
5d7d8072
BH
76#if defined(CONFIG_NUMA) && defined(CONFIG_PPC_SPLPAR)
77extern int start_topology_update(void);
78extern int stop_topology_update(void);
e04fa612 79extern int prrn_is_enabled(void);
5d7d8072
BH
80#else
81static inline int start_topology_update(void)
82{
83 return 0;
84}
85static inline int stop_topology_update(void)
86{
87 return 0;
88}
e04fa612
NF
89static inline int prrn_is_enabled(void)
90{
91 return 0;
92}
5d7d8072
BH
93#endif /* CONFIG_NUMA && CONFIG_PPC_SPLPAR */
94
1da177e4
LT
95#include <asm-generic/topology.h>
96
5c45bf27
SS
97#ifdef CONFIG_SMP
98#include <asm/cputable.h>
056f4faa
SR
99
100#ifdef CONFIG_PPC64
101#include <asm/smp.h>
102
15863ff3 103#define topology_physical_package_id(cpu) (cpu_to_chip_id(cpu))
06931e62 104#define topology_sibling_cpumask(cpu) (per_cpu(cpu_sibling_map, cpu))
cc1ba8ea 105#define topology_core_cpumask(cpu) (per_cpu(cpu_core_map, cpu))
e9efed3b 106#define topology_core_id(cpu) (cpu_to_core_id(cpu))
056f4faa 107#endif
5c45bf27
SS
108#endif
109
88ced031 110#endif /* __KERNEL__ */
dd56fdf2 111#endif /* _ASM_POWERPC_TOPOLOGY_H */