xref: /linux/arch/loongarch/include/asm/topology.h (revision 3a39d672e7f48b8d6b91a09afa4b55352773b4b5)
1b738c106SHuacai Chen /* SPDX-License-Identifier: GPL-2.0 */
2b738c106SHuacai Chen /*
3b738c106SHuacai Chen  * Copyright (C) 2020-2022 Loongson Technology Corporation Limited
4b738c106SHuacai Chen  */
5b738c106SHuacai Chen #ifndef __ASM_TOPOLOGY_H
6b738c106SHuacai Chen #define __ASM_TOPOLOGY_H
7b738c106SHuacai Chen 
8b738c106SHuacai Chen #include <linux/smp.h>
9b738c106SHuacai Chen 
10d4b6f156SHuacai Chen #ifdef CONFIG_NUMA
11*46bcce50SMike Rapoport (Microsoft) #include <asm/numa.h>
12d4b6f156SHuacai Chen 
13d4b6f156SHuacai Chen extern cpumask_t cpus_on_node[];
14d4b6f156SHuacai Chen 
15d4b6f156SHuacai Chen #define cpumask_of_node(node)  (&cpus_on_node[node])
16d4b6f156SHuacai Chen 
17d4b6f156SHuacai Chen struct pci_bus;
18d4b6f156SHuacai Chen extern int pcibus_to_node(struct pci_bus *);
19d4b6f156SHuacai Chen 
20d4b6f156SHuacai Chen #define cpumask_of_pcibus(bus)	(cpu_online_mask)
21d4b6f156SHuacai Chen 
22d4b6f156SHuacai Chen extern unsigned char node_distances[MAX_NUMNODES][MAX_NUMNODES];
23d4b6f156SHuacai Chen 
24d4b6f156SHuacai Chen void numa_set_distance(int from, int to, int distance);
25d4b6f156SHuacai Chen 
26d4b6f156SHuacai Chen #define node_distance(from, to)	(node_distances[(from)][(to)])
27d4b6f156SHuacai Chen 
28d4b6f156SHuacai Chen #else
29d4b6f156SHuacai Chen #define pcibus_to_node(bus)	0
30d4b6f156SHuacai Chen #endif
31d4b6f156SHuacai Chen 
3246859ac8SHuacai Chen #ifdef CONFIG_SMP
3346859ac8SHuacai Chen #define topology_physical_package_id(cpu)	(cpu_data[cpu].package)
3446859ac8SHuacai Chen #define topology_core_id(cpu)			(cpu_data[cpu].core)
3546859ac8SHuacai Chen #define topology_core_cpumask(cpu)		(&cpu_core_map[cpu])
3646859ac8SHuacai Chen #define topology_sibling_cpumask(cpu)		(&cpu_sibling_map[cpu])
3746859ac8SHuacai Chen #endif
38b738c106SHuacai Chen 
39b738c106SHuacai Chen #include <asm-generic/topology.h>
40b738c106SHuacai Chen 
arch_fix_phys_package_id(int num,u32 slot)41b738c106SHuacai Chen static inline void arch_fix_phys_package_id(int num, u32 slot) { }
42b738c106SHuacai Chen #endif /* __ASM_TOPOLOGY_H */
43