topology.h 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * Copyright (C) 2020-2022 Loongson Technology Corporation Limited
  4. */
  5. #ifndef __ASM_TOPOLOGY_H
  6. #define __ASM_TOPOLOGY_H
  7. #include <linux/smp.h>
  8. #ifdef CONFIG_NUMA
  9. extern cpumask_t cpus_on_node[];
  10. #define cpumask_of_node(node) (&cpus_on_node[node])
  11. struct pci_bus;
  12. extern int pcibus_to_node(struct pci_bus *);
  13. #define cpumask_of_pcibus(bus) (cpu_online_mask)
  14. extern unsigned char node_distances[MAX_NUMNODES][MAX_NUMNODES];
  15. void numa_set_distance(int from, int to, int distance);
  16. #define node_distance(from, to) (node_distances[(from)][(to)])
  17. #else
  18. #define pcibus_to_node(bus) 0
  19. #endif
  20. #ifdef CONFIG_SMP
  21. #define topology_physical_package_id(cpu) (cpu_data[cpu].package)
  22. #define topology_core_id(cpu) (cpu_data[cpu].core)
  23. #define topology_core_cpumask(cpu) (&cpu_core_map[cpu])
  24. #define topology_sibling_cpumask(cpu) (&cpu_sibling_map[cpu])
  25. #endif
  26. #include <asm-generic/topology.h>
  27. static inline void arch_fix_phys_package_id(int num, u32 slot) { }
  28. #endif /* __ASM_TOPOLOGY_H */