topology.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. #ifndef _ASM_POWERPC_TOPOLOGY_H
  2. #define _ASM_POWERPC_TOPOLOGY_H
  3. #ifdef __KERNEL__
  4. struct device;
  5. struct device_node;
  6. #ifdef CONFIG_NUMA
  7. /*
  8. * Before going off node we want the VM to try and reclaim from the local
  9. * node. It does this if the remote distance is larger than RECLAIM_DISTANCE.
  10. * With the default REMOTE_DISTANCE of 20 and the default RECLAIM_DISTANCE of
  11. * 20, we never reclaim and go off node straight away.
  12. *
  13. * To fix this we choose a smaller value of RECLAIM_DISTANCE.
  14. */
  15. #define RECLAIM_DISTANCE 10
  16. #include <asm/mmzone.h>
  17. static inline int cpu_to_node(int cpu)
  18. {
  19. return numa_cpu_lookup_table[cpu];
  20. }
  21. #define parent_node(node) (node)
  22. #define cpumask_of_node(node) ((node) == -1 ? \
  23. cpu_all_mask : \
  24. node_to_cpumask_map[node])
  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. #define cpumask_of_pcibus(bus) (pcibus_to_node(bus) == -1 ? \
  35. cpu_all_mask : \
  36. cpumask_of_node(pcibus_to_node(bus)))
  37. extern int __node_distance(int, int);
  38. #define node_distance(a, b) __node_distance(a, b)
  39. extern void __init dump_numa_cpu_topology(void);
  40. extern int sysfs_add_device_to_node(struct device *dev, int nid);
  41. extern void sysfs_remove_device_from_node(struct device *dev, int nid);
  42. #else
  43. static inline void dump_numa_cpu_topology(void) {}
  44. static inline int sysfs_add_device_to_node(struct device *dev, int nid)
  45. {
  46. return 0;
  47. }
  48. static inline void sysfs_remove_device_from_node(struct device *dev,
  49. int nid)
  50. {
  51. }
  52. #endif /* CONFIG_NUMA */
  53. #if defined(CONFIG_NUMA) && defined(CONFIG_PPC_SPLPAR)
  54. extern int start_topology_update(void);
  55. extern int stop_topology_update(void);
  56. #else
  57. static inline int start_topology_update(void)
  58. {
  59. return 0;
  60. }
  61. static inline int stop_topology_update(void)
  62. {
  63. return 0;
  64. }
  65. #endif /* CONFIG_NUMA && CONFIG_PPC_SPLPAR */
  66. #include <asm-generic/topology.h>
  67. #ifdef CONFIG_SMP
  68. #include <asm/cputable.h>
  69. #define smt_capable() (cpu_has_feature(CPU_FTR_SMT))
  70. #ifdef CONFIG_PPC64
  71. #include <asm/smp.h>
  72. #define topology_thread_cpumask(cpu) (per_cpu(cpu_sibling_map, cpu))
  73. #define topology_core_cpumask(cpu) (per_cpu(cpu_core_map, cpu))
  74. #define topology_core_id(cpu) (cpu_to_core_id(cpu))
  75. #endif
  76. #endif
  77. #endif /* __KERNEL__ */
  78. #endif /* _ASM_POWERPC_TOPOLOGY_H */