xref: /openbmc/linux/arch/ia64/include/asm/topology.h (revision 2874c5fd)
12874c5fdSThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-or-later */
27f30491cSTony Luck /*
37f30491cSTony Luck  * Copyright (C) 2002, Erich Focht, NEC
47f30491cSTony Luck  *
57f30491cSTony Luck  * All rights reserved.
67f30491cSTony Luck  */
77f30491cSTony Luck #ifndef _ASM_IA64_TOPOLOGY_H
87f30491cSTony Luck #define _ASM_IA64_TOPOLOGY_H
97f30491cSTony Luck 
107f30491cSTony Luck #include <asm/acpi.h>
117f30491cSTony Luck #include <asm/numa.h>
127f30491cSTony Luck #include <asm/smp.h>
137f30491cSTony Luck 
147f30491cSTony Luck #ifdef CONFIG_NUMA
157f30491cSTony Luck 
167f30491cSTony Luck /* Nodes w/o CPUs are preferred for memory allocations, see build_zonelists */
177f30491cSTony Luck #define PENALTY_FOR_NODE_WITH_CPUS 255
187f30491cSTony Luck 
197f30491cSTony Luck /*
204f9b16a6SMel Gorman  * Nodes within this distance are eligible for reclaim by zone_reclaim() when
214f9b16a6SMel Gorman  * zone_reclaim_mode is enabled.
227f30491cSTony Luck  */
237f30491cSTony Luck #define RECLAIM_DISTANCE 15
247f30491cSTony Luck 
257f30491cSTony Luck /*
267f30491cSTony Luck  * Returns a bitmask of CPUs on Node 'node'.
277f30491cSTony Luck  */
281d1e9f04SAnton Blanchard #define cpumask_of_node(node) ((node) == -1 ?				\
291d1e9f04SAnton Blanchard 			       cpu_all_mask :				\
301d1e9f04SAnton Blanchard 			       &node_to_cpu_mask[node])
317f30491cSTony Luck 
327f30491cSTony Luck /*
337f30491cSTony Luck  * Determines the node for a given pci bus
347f30491cSTony Luck  */
357f30491cSTony Luck #define pcibus_to_node(bus) PCI_CONTROLLER(bus)->node
367f30491cSTony Luck 
377f30491cSTony Luck void build_cpu_to_node_map(void);
387f30491cSTony Luck 
397f30491cSTony Luck #endif /* CONFIG_NUMA */
407f30491cSTony Luck 
417f30491cSTony Luck #ifdef CONFIG_SMP
427f30491cSTony Luck #define topology_physical_package_id(cpu)	(cpu_data(cpu)->socket_id)
437f30491cSTony Luck #define topology_core_id(cpu)			(cpu_data(cpu)->core_id)
44333af153SRusty Russell #define topology_core_cpumask(cpu)		(&cpu_core_map[cpu])
4506931e62SBartosz Golaszewski #define topology_sibling_cpumask(cpu)		(&per_cpu(cpu_sibling_map, cpu))
467f30491cSTony Luck #endif
477f30491cSTony Luck 
487f30491cSTony Luck extern void arch_fix_phys_package_id(int num, u32 slot);
497f30491cSTony Luck 
50fbb776c3SRusty Russell #define cpumask_of_pcibus(bus)	(pcibus_to_node(bus) == -1 ?		\
51fbb776c3SRusty Russell 				 cpu_all_mask :				\
5236c401a4SIngo Molnar 				 cpumask_of_node(pcibus_to_node(bus)))
53fbb776c3SRusty Russell 
547f30491cSTony Luck #include <asm-generic/topology.h>
557f30491cSTony Luck 
567f30491cSTony Luck #endif /* _ASM_IA64_TOPOLOGY_H */
57