topology.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. #ifndef _ASM_POWERPC_TOPOLOGY_H
  2. #define _ASM_POWERPC_TOPOLOGY_H
  3. #ifdef __KERNEL__
  4. struct sys_device;
  5. struct device_node;
  6. #ifdef CONFIG_NUMA
  7. #include <asm/mmzone.h>
  8. static inline int cpu_to_node(int cpu)
  9. {
  10. return numa_cpu_lookup_table[cpu];
  11. }
  12. #define parent_node(node) (node)
  13. #define cpumask_of_node(node) (&numa_cpumask_lookup_table[node])
  14. int of_node_to_nid(struct device_node *device);
  15. struct pci_bus;
  16. #ifdef CONFIG_PCI
  17. extern int pcibus_to_node(struct pci_bus *bus);
  18. #else
  19. static inline int pcibus_to_node(struct pci_bus *bus)
  20. {
  21. return -1;
  22. }
  23. #endif
  24. #define cpumask_of_pcibus(bus) (pcibus_to_node(bus) == -1 ? \
  25. cpu_all_mask : \
  26. cpumask_of_node(pcibus_to_node(bus)))
  27. /* sched_domains SD_NODE_INIT for PPC64 machines */
  28. #define SD_NODE_INIT (struct sched_domain) { \
  29. .parent = NULL, \
  30. .child = NULL, \
  31. .groups = NULL, \
  32. .min_interval = 8, \
  33. .max_interval = 32, \
  34. .busy_factor = 32, \
  35. .imbalance_pct = 125, \
  36. .cache_nice_tries = 1, \
  37. .busy_idx = 3, \
  38. .idle_idx = 1, \
  39. .newidle_idx = 0, \
  40. .wake_idx = 0, \
  41. .flags = SD_LOAD_BALANCE \
  42. | SD_BALANCE_EXEC \
  43. | SD_BALANCE_FORK \
  44. | SD_BALANCE_NEWIDLE \
  45. | SD_SERIALIZE, \
  46. .last_balance = jiffies, \
  47. .balance_interval = 1, \
  48. .nr_balance_failed = 0, \
  49. }
  50. extern void __init dump_numa_cpu_topology(void);
  51. extern int sysfs_add_device_to_node(struct sys_device *dev, int nid);
  52. extern void sysfs_remove_device_from_node(struct sys_device *dev, int nid);
  53. #else
  54. static inline int of_node_to_nid(struct device_node *device)
  55. {
  56. return 0;
  57. }
  58. static inline void dump_numa_cpu_topology(void) {}
  59. static inline int sysfs_add_device_to_node(struct sys_device *dev, int nid)
  60. {
  61. return 0;
  62. }
  63. static inline void sysfs_remove_device_from_node(struct sys_device *dev,
  64. int nid)
  65. {
  66. }
  67. #endif /* CONFIG_NUMA */
  68. #include <asm-generic/topology.h>
  69. #ifdef CONFIG_SMP
  70. #include <asm/cputable.h>
  71. #define smt_capable() (cpu_has_feature(CPU_FTR_SMT))
  72. #ifdef CONFIG_PPC64
  73. #include <asm/smp.h>
  74. #define topology_thread_cpumask(cpu) (&per_cpu(cpu_sibling_map, cpu))
  75. #define topology_core_cpumask(cpu) (&per_cpu(cpu_core_map, cpu))
  76. #define topology_core_id(cpu) (cpu_to_core_id(cpu))
  77. #endif
  78. #endif
  79. #endif /* __KERNEL__ */
  80. #endif /* _ASM_POWERPC_TOPOLOGY_H */