topology.h 957 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef _ASM_ALPHA_TOPOLOGY_H
  3. #define _ASM_ALPHA_TOPOLOGY_H
  4. #include <linux/smp.h>
  5. #include <linux/threads.h>
  6. #include <asm/machvec.h>
  7. #ifdef CONFIG_NUMA
  8. static inline int cpu_to_node(int cpu)
  9. {
  10. int node;
  11. if (!alpha_mv.cpuid_to_nid)
  12. return 0;
  13. node = alpha_mv.cpuid_to_nid(cpu);
  14. #ifdef DEBUG_NUMA
  15. BUG_ON(node < 0);
  16. #endif
  17. return node;
  18. }
  19. extern struct cpumask node_to_cpumask_map[];
  20. /* FIXME: This is dumb, recalculating every time. But simple. */
  21. static const struct cpumask *cpumask_of_node(int node)
  22. {
  23. int cpu;
  24. if (node == -1)
  25. return cpu_all_mask;
  26. cpumask_clear(&node_to_cpumask_map[node]);
  27. for_each_online_cpu(cpu) {
  28. if (cpu_to_node(cpu) == node)
  29. cpumask_set_cpu(cpu, node_to_cpumask_map[node]);
  30. }
  31. return &node_to_cpumask_map[node];
  32. }
  33. #define cpumask_of_pcibus(bus) (cpu_online_mask)
  34. #endif /* !CONFIG_NUMA */
  35. # include <asm-generic/topology.h>
  36. #endif /* _ASM_ALPHA_TOPOLOGY_H */