topology_64.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #ifndef _ASM_X86_64_TOPOLOGY_H
  2. #define _ASM_X86_64_TOPOLOGY_H
  3. #ifdef CONFIG_NUMA
  4. #include <asm/mpspec.h>
  5. #include <linux/bitops.h>
  6. extern unsigned char cpu_to_node[];
  7. extern cpumask_t node_to_cpumask[];
  8. #ifdef CONFIG_ACPI_NUMA
  9. extern int __node_distance(int, int);
  10. #define node_distance(a,b) __node_distance(a,b)
  11. /* #else fallback version */
  12. #endif
  13. #define cpu_to_node(cpu) (cpu_to_node[cpu])
  14. #define parent_node(node) (node)
  15. #define node_to_first_cpu(node) (first_cpu(node_to_cpumask[node]))
  16. #define node_to_cpumask(node) (node_to_cpumask[node])
  17. #define pcibus_to_node(bus) ((struct pci_sysdata *)((bus)->sysdata))->node
  18. #define pcibus_to_cpumask(bus) node_to_cpumask(pcibus_to_node(bus));
  19. #define numa_node_id() read_pda(nodenumber)
  20. /* sched_domains SD_NODE_INIT for x86_64 machines */
  21. #define SD_NODE_INIT (struct sched_domain) { \
  22. .span = CPU_MASK_NONE, \
  23. .parent = NULL, \
  24. .child = NULL, \
  25. .groups = NULL, \
  26. .min_interval = 8, \
  27. .max_interval = 32, \
  28. .busy_factor = 32, \
  29. .imbalance_pct = 125, \
  30. .cache_nice_tries = 2, \
  31. .busy_idx = 3, \
  32. .idle_idx = 2, \
  33. .newidle_idx = 0, \
  34. .wake_idx = 1, \
  35. .forkexec_idx = 1, \
  36. .flags = SD_LOAD_BALANCE \
  37. | SD_BALANCE_FORK \
  38. | SD_BALANCE_EXEC \
  39. | SD_SERIALIZE \
  40. | SD_WAKE_BALANCE, \
  41. .last_balance = jiffies, \
  42. .balance_interval = 1, \
  43. .nr_balance_failed = 0, \
  44. }
  45. #endif
  46. #ifdef CONFIG_SMP
  47. #define topology_physical_package_id(cpu) (cpu_data(cpu).phys_proc_id)
  48. #define topology_core_id(cpu) (cpu_data(cpu).cpu_core_id)
  49. #define topology_core_siblings(cpu) (per_cpu(cpu_core_map, cpu))
  50. #define topology_thread_siblings(cpu) (per_cpu(cpu_sibling_map, cpu))
  51. #define mc_capable() (boot_cpu_data.x86_max_cores > 1)
  52. #define smt_capable() (smp_num_siblings > 1)
  53. #endif
  54. #include <asm-generic/topology.h>
  55. extern cpumask_t cpu_coregroup_map(int cpu);
  56. #endif