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 cpumask_of_node(node) ((node) == -1 ? \ 20 cpu_all_mask : \ 21 node_to_cpumask_map[node]) 22 23 struct pci_bus; 24 #ifdef CONFIG_PCI 25 extern int pcibus_to_node(struct pci_bus *bus); 26 #else 27 static inline int pcibus_to_node(struct pci_bus *bus) 28 { 29 return -1; 30 } 31 #endif 32 33 #define cpumask_of_pcibus(bus) (pcibus_to_node(bus) == -1 ? \ 34 cpu_all_mask : \ 35 cpumask_of_node(pcibus_to_node(bus))) 36 37 extern int __node_distance(int, int); 38 #define node_distance(a, b) __node_distance(a, b) 39 40 extern void __init dump_numa_cpu_topology(void); 41 42 extern int sysfs_add_device_to_node(struct device *dev, int nid); 43 extern void sysfs_remove_device_from_node(struct device *dev, int nid); 44 extern int numa_update_cpu_topology(bool cpus_locked); 45 46 static inline int early_cpu_to_node(int cpu) 47 { 48 int nid; 49 50 nid = numa_cpu_lookup_table[cpu]; 51 52 /* 53 * Fall back to node 0 if nid is unset (it should be, except bugs). 54 * This allows callers to safely do NODE_DATA(early_cpu_to_node(cpu)). 55 */ 56 return (nid < 0) ? 0 : nid; 57 } 58 #else 59 60 static inline int early_cpu_to_node(int cpu) { return 0; } 61 62 static inline void dump_numa_cpu_topology(void) {} 63 64 static inline int sysfs_add_device_to_node(struct device *dev, int nid) 65 { 66 return 0; 67 } 68 69 static inline void sysfs_remove_device_from_node(struct device *dev, 70 int nid) 71 { 72 } 73 74 static inline int numa_update_cpu_topology(bool cpus_locked) 75 { 76 return 0; 77 } 78 #endif /* CONFIG_NUMA */ 79 80 #if defined(CONFIG_NUMA) && defined(CONFIG_PPC_SPLPAR) 81 extern int start_topology_update(void); 82 extern int stop_topology_update(void); 83 extern int prrn_is_enabled(void); 84 #else 85 static inline int start_topology_update(void) 86 { 87 return 0; 88 } 89 static inline int stop_topology_update(void) 90 { 91 return 0; 92 } 93 static inline int prrn_is_enabled(void) 94 { 95 return 0; 96 } 97 #endif /* CONFIG_NUMA && CONFIG_PPC_SPLPAR */ 98 99 #include <asm-generic/topology.h> 100 101 #ifdef CONFIG_SMP 102 #include <asm/cputable.h> 103 104 #ifdef CONFIG_PPC64 105 #include <asm/smp.h> 106 107 #define topology_physical_package_id(cpu) (cpu_to_chip_id(cpu)) 108 #define topology_sibling_cpumask(cpu) (per_cpu(cpu_sibling_map, cpu)) 109 #define topology_core_cpumask(cpu) (per_cpu(cpu_core_map, cpu)) 110 #define topology_core_id(cpu) (cpu_to_core_id(cpu)) 111 #endif 112 #endif 113 114 #endif /* __KERNEL__ */ 115 #endif /* _ASM_POWERPC_TOPOLOGY_H */ 116