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
8#include <linux/smp.h>
9
10#ifdef CONFIG_NUMA
11
12extern cpumask_t cpus_on_node[];
13
14#define cpumask_of_node(node)  (&cpus_on_node[node])
15
16struct pci_bus;
17extern int pcibus_to_node(struct pci_bus *);
18
19#define cpumask_of_pcibus(bus)	(cpu_online_mask)
20
21extern unsigned char node_distances[MAX_NUMNODES][MAX_NUMNODES];
22
23void numa_set_distance(int from, int to, int distance);
24
25#define node_distance(from, to)	(node_distances[(from)][(to)])
26
27#else
28#define pcibus_to_node(bus)	0
29#endif
30
31#ifdef CONFIG_SMP
32#define topology_physical_package_id(cpu)	(cpu_data[cpu].package)
33#define topology_core_id(cpu)			(cpu_data[cpu].core)
34#define topology_core_cpumask(cpu)		(&cpu_core_map[cpu])
35#define topology_sibling_cpumask(cpu)		(&cpu_sibling_map[cpu])
36#endif
37
38#include <asm-generic/topology.h>
39
40static inline void arch_fix_phys_package_id(int num, u32 slot) { }
41#endif /* __ASM_TOPOLOGY_H */
42