topology.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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. static inline cpumask_t node_to_cpumask(int node)
  14. {
  15. return numa_cpumask_lookup_table[node];
  16. }
  17. static inline int node_to_first_cpu(int node)
  18. {
  19. cpumask_t tmp;
  20. tmp = node_to_cpumask(node);
  21. return first_cpu(tmp);
  22. }
  23. int of_node_to_nid(struct device_node *device);
  24. #define pcibus_to_node(node) (-1)
  25. #define pcibus_to_cpumask(bus) (cpu_online_map)
  26. /* sched_domains SD_NODE_INIT for PPC64 machines */
  27. #define SD_NODE_INIT (struct sched_domain) { \
  28. .span = CPU_MASK_NONE, \
  29. .parent = NULL, \
  30. .groups = NULL, \
  31. .min_interval = 8, \
  32. .max_interval = 32, \
  33. .busy_factor = 32, \
  34. .imbalance_pct = 125, \
  35. .cache_nice_tries = 1, \
  36. .per_cpu_gain = 100, \
  37. .busy_idx = 3, \
  38. .idle_idx = 1, \
  39. .newidle_idx = 2, \
  40. .wake_idx = 1, \
  41. .flags = SD_LOAD_BALANCE \
  42. | SD_BALANCE_EXEC \
  43. | SD_BALANCE_NEWIDLE \
  44. | SD_WAKE_IDLE \
  45. | SD_WAKE_BALANCE, \
  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. #include <asm-generic/topology.h>
  68. #endif /* CONFIG_NUMA */
  69. #endif /* __KERNEL__ */
  70. #endif /* _ASM_POWERPC_TOPOLOGY_H */