topology_32.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. /*
  2. * linux/include/asm-i386/topology.h
  3. *
  4. * Written by: Matthew Dobson, IBM Corporation
  5. *
  6. * Copyright (C) 2002, IBM Corp.
  7. *
  8. * All rights reserved.
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License as published by
  12. * the Free Software Foundation; either version 2 of the License, or
  13. * (at your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful, but
  16. * WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  18. * NON INFRINGEMENT. See the GNU General Public License for more
  19. * details.
  20. *
  21. * You should have received a copy of the GNU General Public License
  22. * along with this program; if not, write to the Free Software
  23. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  24. *
  25. * Send feedback to <colpatch@us.ibm.com>
  26. */
  27. #ifndef _ASM_I386_TOPOLOGY_H
  28. #define _ASM_I386_TOPOLOGY_H
  29. #ifdef CONFIG_X86_HT
  30. #define topology_physical_package_id(cpu) (cpu_data[cpu].phys_proc_id)
  31. #define topology_core_id(cpu) (cpu_data[cpu].cpu_core_id)
  32. #define topology_core_siblings(cpu) (cpu_core_map[cpu])
  33. #define topology_thread_siblings(cpu) (cpu_sibling_map[cpu])
  34. #endif
  35. #ifdef CONFIG_NUMA
  36. #include <asm/mpspec.h>
  37. #include <linux/cpumask.h>
  38. /* Mappings between logical cpu number and node number */
  39. extern cpumask_t node_2_cpu_mask[];
  40. extern int cpu_2_node[];
  41. /* Returns the number of the node containing CPU 'cpu' */
  42. static inline int cpu_to_node(int cpu)
  43. {
  44. return cpu_2_node[cpu];
  45. }
  46. /* Returns the number of the node containing Node 'node'. This architecture is flat,
  47. so it is a pretty simple function! */
  48. #define parent_node(node) (node)
  49. /* Returns a bitmask of CPUs on Node 'node'. */
  50. static inline cpumask_t node_to_cpumask(int node)
  51. {
  52. return node_2_cpu_mask[node];
  53. }
  54. /* Returns the number of the first CPU on Node 'node'. */
  55. static inline int node_to_first_cpu(int node)
  56. {
  57. cpumask_t mask = node_to_cpumask(node);
  58. return first_cpu(mask);
  59. }
  60. #define pcibus_to_node(bus) ((struct pci_sysdata *)((bus)->sysdata))->node
  61. #define pcibus_to_cpumask(bus) node_to_cpumask(pcibus_to_node(bus))
  62. /* sched_domains SD_NODE_INIT for NUMAQ machines */
  63. #define SD_NODE_INIT (struct sched_domain) { \
  64. .span = CPU_MASK_NONE, \
  65. .parent = NULL, \
  66. .child = NULL, \
  67. .groups = NULL, \
  68. .min_interval = 8, \
  69. .max_interval = 32, \
  70. .busy_factor = 32, \
  71. .imbalance_pct = 125, \
  72. .cache_nice_tries = 1, \
  73. .busy_idx = 3, \
  74. .idle_idx = 1, \
  75. .newidle_idx = 2, \
  76. .wake_idx = 1, \
  77. .flags = SD_LOAD_BALANCE \
  78. | SD_BALANCE_EXEC \
  79. | SD_BALANCE_FORK \
  80. | SD_SERIALIZE \
  81. | SD_WAKE_BALANCE, \
  82. .last_balance = jiffies, \
  83. .balance_interval = 1, \
  84. .nr_balance_failed = 0, \
  85. }
  86. extern unsigned long node_start_pfn[];
  87. extern unsigned long node_end_pfn[];
  88. extern unsigned long node_remap_size[];
  89. #define node_has_online_mem(nid) (node_start_pfn[nid] != node_end_pfn[nid])
  90. #else /* !CONFIG_NUMA */
  91. /*
  92. * Other i386 platforms should define their own version of the
  93. * above macros here.
  94. */
  95. #include <asm-generic/topology.h>
  96. #endif /* CONFIG_NUMA */
  97. extern cpumask_t cpu_coregroup_map(int cpu);
  98. #ifdef CONFIG_SMP
  99. #define mc_capable() (boot_cpu_data.x86_max_cores > 1)
  100. #define smt_capable() (smp_num_siblings > 1)
  101. #endif
  102. #endif /* _ASM_I386_TOPOLOGY_H */