Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef _ASM_SPARC64_TOPOLOGY_H
0003 #define _ASM_SPARC64_TOPOLOGY_H
0004 
0005 #ifdef CONFIG_NUMA
0006 
0007 #include <asm/mmzone.h>
0008 
0009 static inline int cpu_to_node(int cpu)
0010 {
0011     return numa_cpu_lookup_table[cpu];
0012 }
0013 
0014 #define cpumask_of_node(node) ((node) == -1 ?               \
0015                    cpu_all_mask :               \
0016                    &numa_cpumask_lookup_table[node])
0017 
0018 struct pci_bus;
0019 #ifdef CONFIG_PCI
0020 int pcibus_to_node(struct pci_bus *pbus);
0021 #else
0022 static inline int pcibus_to_node(struct pci_bus *pbus)
0023 {
0024     return -1;
0025 }
0026 #endif
0027 
0028 #define cpumask_of_pcibus(bus)  \
0029     (pcibus_to_node(bus) == -1 ? \
0030      cpu_all_mask : \
0031      cpumask_of_node(pcibus_to_node(bus)))
0032 
0033 int __node_distance(int, int);
0034 #define node_distance(a, b) __node_distance(a, b)
0035 
0036 #else /* CONFIG_NUMA */
0037 
0038 #include <asm-generic/topology.h>
0039 
0040 #endif /* !(CONFIG_NUMA) */
0041 
0042 #ifdef CONFIG_SMP
0043 
0044 #include <asm/cpudata.h>
0045 
0046 #define topology_physical_package_id(cpu)   (cpu_data(cpu).proc_id)
0047 #define topology_core_id(cpu)           (cpu_data(cpu).core_id)
0048 #define topology_core_cpumask(cpu)      (&cpu_core_sib_map[cpu])
0049 #define topology_core_cache_cpumask(cpu)    (&cpu_core_sib_cache_map[cpu])
0050 #define topology_sibling_cpumask(cpu)       (&per_cpu(cpu_sibling_map, cpu))
0051 #endif /* CONFIG_SMP */
0052 
0053 extern cpumask_t cpu_core_map[NR_CPUS];
0054 extern cpumask_t cpu_core_sib_map[NR_CPUS];
0055 extern cpumask_t cpu_core_sib_cache_map[NR_CPUS];
0056 
0057 /**
0058  * Return cores that shares the last level cache.
0059  */
0060 static inline const struct cpumask *cpu_coregroup_mask(int cpu)
0061 {
0062     return &cpu_core_sib_cache_map[cpu];
0063 }
0064 
0065 #endif /* _ASM_SPARC64_TOPOLOGY_H */