topology_64.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. #ifndef _ASM_X86_TOPOLOGY_H
  2. #define _ASM_X86_TOPOLOGY_H
  3. #ifdef CONFIG_NUMA
  4. #include <linux/cpumask.h>
  5. #include <asm/mpspec.h>
  6. /* Mappings between logical cpu number and node number */
  7. extern int cpu_to_node_map[];
  8. extern cpumask_t node_to_cpumask_map[];
  9. #ifdef CONFIG_ACPI_NUMA
  10. extern int __node_distance(int, int);
  11. #define node_distance(a,b) __node_distance(a,b)
  12. #endif
  13. /* Returns the number of the node containing CPU 'cpu' */
  14. static inline int cpu_to_node(int cpu)
  15. {
  16. return cpu_to_node_map[cpu];
  17. }
  18. /*
  19. * Returns the number of the node containing Node 'node'. This
  20. * architecture is flat, so it is a pretty simple function!
  21. */
  22. #define parent_node(node) (node)
  23. /* Returns a bitmask of CPUs on Node 'node'. */
  24. static inline cpumask_t node_to_cpumask(int node)
  25. {
  26. return node_to_cpumask_map[node];
  27. }
  28. /* Returns the number of the first CPU on Node 'node'. */
  29. static inline int node_to_first_cpu(int node)
  30. {
  31. cpumask_t mask = node_to_cpumask(node);
  32. return first_cpu(mask);
  33. }
  34. #define pcibus_to_node(bus) __pcibus_to_node(bus)
  35. #define pcibus_to_cpumask(bus) __pcibus_to_cpumask(bus)
  36. #define numa_node_id() read_pda(nodenumber)
  37. /* sched_domains SD_NODE_INIT for x86_64 machines */
  38. #define SD_NODE_INIT (struct sched_domain) { \
  39. .span = CPU_MASK_NONE, \
  40. .parent = NULL, \
  41. .child = NULL, \
  42. .groups = NULL, \
  43. .min_interval = 8, \
  44. .max_interval = 32, \
  45. .busy_factor = 32, \
  46. .imbalance_pct = 125, \
  47. .cache_nice_tries = 2, \
  48. .busy_idx = 3, \
  49. .idle_idx = 2, \
  50. .newidle_idx = 0, \
  51. .wake_idx = 1, \
  52. .forkexec_idx = 1, \
  53. .flags = SD_LOAD_BALANCE \
  54. | SD_BALANCE_EXEC \
  55. | SD_BALANCE_FORK \
  56. | SD_SERIALIZE \
  57. | SD_WAKE_BALANCE, \
  58. .last_balance = jiffies, \
  59. .balance_interval = 1, \
  60. .nr_balance_failed = 0, \
  61. }
  62. #else /* CONFIG_NUMA */
  63. #include <asm-generic/topology.h>
  64. #endif
  65. extern cpumask_t cpu_coregroup_map(int cpu);
  66. #ifdef CONFIG_SMP
  67. #define topology_physical_package_id(cpu) (cpu_data(cpu).phys_proc_id)
  68. #define topology_core_id(cpu) (cpu_data(cpu).cpu_core_id)
  69. #define topology_core_siblings(cpu) (per_cpu(cpu_core_map, cpu))
  70. #define topology_thread_siblings(cpu) (per_cpu(cpu_sibling_map, cpu))
  71. #define mc_capable() (boot_cpu_data.x86_max_cores > 1)
  72. #define smt_capable() (smp_num_siblings > 1)
  73. #endif
  74. #endif