topology_64.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef _ASM_SPARC64_TOPOLOGY_H
  3. #define _ASM_SPARC64_TOPOLOGY_H
  4. #ifdef CONFIG_NUMA
  5. #include <asm/mmzone.h>
  6. static inline int cpu_to_node(int cpu)
  7. {
  8. return numa_cpu_lookup_table[cpu];
  9. }
  10. #define cpumask_of_node(node) ((node) == -1 ? \
  11. cpu_all_mask : \
  12. &numa_cpumask_lookup_table[node])
  13. struct pci_bus;
  14. #ifdef CONFIG_PCI
  15. int pcibus_to_node(struct pci_bus *pbus);
  16. #else
  17. static inline int pcibus_to_node(struct pci_bus *pbus)
  18. {
  19. return -1;
  20. }
  21. #endif
  22. #define cpumask_of_pcibus(bus) \
  23. (pcibus_to_node(bus) == -1 ? \
  24. cpu_all_mask : \
  25. cpumask_of_node(pcibus_to_node(bus)))
  26. int __node_distance(int, int);
  27. #define node_distance(a, b) __node_distance(a, b)
  28. #else /* CONFIG_NUMA */
  29. #include <asm-generic/topology.h>
  30. #endif /* !(CONFIG_NUMA) */
  31. #ifdef CONFIG_SMP
  32. #include <asm/cpudata.h>
  33. #define topology_physical_package_id(cpu) (cpu_data(cpu).proc_id)
  34. #define topology_core_id(cpu) (cpu_data(cpu).core_id)
  35. #define topology_core_cpumask(cpu) (&cpu_core_sib_map[cpu])
  36. #define topology_core_cache_cpumask(cpu) (&cpu_core_sib_cache_map[cpu])
  37. #define topology_sibling_cpumask(cpu) (&per_cpu(cpu_sibling_map, cpu))
  38. #endif /* CONFIG_SMP */
  39. extern cpumask_t cpu_core_map[NR_CPUS];
  40. extern cpumask_t cpu_core_sib_map[NR_CPUS];
  41. extern cpumask_t cpu_core_sib_cache_map[NR_CPUS];
  42. /**
  43. * Return cores that shares the last level cache.
  44. */
  45. static inline const struct cpumask *cpu_coregroup_mask(int cpu)
  46. {
  47. return &cpu_core_sib_cache_map[cpu];
  48. }
  49. #endif /* _ASM_SPARC64_TOPOLOGY_H */