topology.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*
  2. * Copyright 2010 Tilera Corporation. All Rights Reserved.
  3. *
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License
  6. * as published by the Free Software Foundation, version 2.
  7. *
  8. * This program is distributed in the hope that it will be useful, but
  9. * WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  11. * NON INFRINGEMENT. See the GNU General Public License for
  12. * more details.
  13. */
  14. #ifndef _ASM_TILE_TOPOLOGY_H
  15. #define _ASM_TILE_TOPOLOGY_H
  16. #ifdef CONFIG_NUMA
  17. #include <linux/cpumask.h>
  18. /* Mappings between logical cpu number and node number. */
  19. extern struct cpumask node_2_cpu_mask[];
  20. extern char cpu_2_node[];
  21. /* Returns the number of the node containing CPU 'cpu'. */
  22. static inline int cpu_to_node(int cpu)
  23. {
  24. return cpu_2_node[cpu];
  25. }
  26. /*
  27. * Returns the number of the node containing Node 'node'.
  28. * This architecture is flat, so it is a pretty simple function!
  29. */
  30. #define parent_node(node) (node)
  31. /* Returns a bitmask of CPUs on Node 'node'. */
  32. static inline const struct cpumask *cpumask_of_node(int node)
  33. {
  34. return &node_2_cpu_mask[node];
  35. }
  36. /* For now, use numa node -1 for global allocation. */
  37. #define pcibus_to_node(bus) ((void)(bus), -1)
  38. /* sched_domains SD_NODE_INIT for TILE architecture */
  39. #define SD_NODE_INIT (struct sched_domain) { \
  40. .min_interval = 8, \
  41. .max_interval = 32, \
  42. .busy_factor = 32, \
  43. .imbalance_pct = 125, \
  44. .cache_nice_tries = 1, \
  45. .busy_idx = 3, \
  46. .idle_idx = 1, \
  47. .newidle_idx = 2, \
  48. .wake_idx = 1, \
  49. .flags = SD_LOAD_BALANCE \
  50. | SD_BALANCE_NEWIDLE \
  51. | SD_BALANCE_EXEC \
  52. | SD_BALANCE_FORK \
  53. | SD_WAKE_AFFINE \
  54. | SD_SERIALIZE, \
  55. .last_balance = jiffies, \
  56. .balance_interval = 1, \
  57. }
  58. /* By definition, we create nodes based on online memory. */
  59. #define node_has_online_mem(nid) 1
  60. #endif /* CONFIG_NUMA */
  61. #include <asm-generic/topology.h>
  62. #ifdef CONFIG_SMP
  63. #define topology_physical_package_id(cpu) ((void)(cpu), 0)
  64. #define topology_core_id(cpu) (cpu)
  65. #define topology_core_cpumask(cpu) ((void)(cpu), cpu_online_mask)
  66. #define topology_thread_cpumask(cpu) cpumask_of(cpu)
  67. /* indicates that pointers to the topology struct cpumask maps are valid */
  68. #define arch_provides_topology_pointers yes
  69. #endif
  70. #endif /* _ASM_TILE_TOPOLOGY_H */