xref: /openbmc/linux/arch/ia64/include/asm/topology.h (revision 7f30491c)
17f30491cSTony Luck /*
27f30491cSTony Luck  * Copyright (C) 2002, Erich Focht, NEC
37f30491cSTony Luck  *
47f30491cSTony Luck  * All rights reserved.
57f30491cSTony Luck  *
67f30491cSTony Luck  * This program is free software; you can redistribute it and/or modify
77f30491cSTony Luck  * it under the terms of the GNU General Public License as published by
87f30491cSTony Luck  * the Free Software Foundation; either version 2 of the License, or
97f30491cSTony Luck  * (at your option) any later version.
107f30491cSTony Luck  */
117f30491cSTony Luck #ifndef _ASM_IA64_TOPOLOGY_H
127f30491cSTony Luck #define _ASM_IA64_TOPOLOGY_H
137f30491cSTony Luck 
147f30491cSTony Luck #include <asm/acpi.h>
157f30491cSTony Luck #include <asm/numa.h>
167f30491cSTony Luck #include <asm/smp.h>
177f30491cSTony Luck 
187f30491cSTony Luck #ifdef CONFIG_NUMA
197f30491cSTony Luck 
207f30491cSTony Luck /* Nodes w/o CPUs are preferred for memory allocations, see build_zonelists */
217f30491cSTony Luck #define PENALTY_FOR_NODE_WITH_CPUS 255
227f30491cSTony Luck 
237f30491cSTony Luck /*
247f30491cSTony Luck  * Distance above which we begin to use zone reclaim
257f30491cSTony Luck  */
267f30491cSTony Luck #define RECLAIM_DISTANCE 15
277f30491cSTony Luck 
287f30491cSTony Luck /*
297f30491cSTony Luck  * Returns the number of the node containing CPU 'cpu'
307f30491cSTony Luck  */
317f30491cSTony Luck #define cpu_to_node(cpu) (int)(cpu_to_node_map[cpu])
327f30491cSTony Luck 
337f30491cSTony Luck /*
347f30491cSTony Luck  * Returns a bitmask of CPUs on Node 'node'.
357f30491cSTony Luck  */
367f30491cSTony Luck #define node_to_cpumask(node) (node_to_cpu_mask[node])
377f30491cSTony Luck 
387f30491cSTony Luck /*
397f30491cSTony Luck  * Returns the number of the node containing Node 'nid'.
407f30491cSTony Luck  * Not implemented here. Multi-level hierarchies detected with
417f30491cSTony Luck  * the help of node_distance().
427f30491cSTony Luck  */
437f30491cSTony Luck #define parent_node(nid) (nid)
447f30491cSTony Luck 
457f30491cSTony Luck /*
467f30491cSTony Luck  * Returns the number of the first CPU on Node 'node'.
477f30491cSTony Luck  */
487f30491cSTony Luck #define node_to_first_cpu(node) (first_cpu(node_to_cpumask(node)))
497f30491cSTony Luck 
507f30491cSTony Luck /*
517f30491cSTony Luck  * Determines the node for a given pci bus
527f30491cSTony Luck  */
537f30491cSTony Luck #define pcibus_to_node(bus) PCI_CONTROLLER(bus)->node
547f30491cSTony Luck 
557f30491cSTony Luck void build_cpu_to_node_map(void);
567f30491cSTony Luck 
577f30491cSTony Luck #define SD_CPU_INIT (struct sched_domain) {		\
587f30491cSTony Luck 	.span			= CPU_MASK_NONE,	\
597f30491cSTony Luck 	.parent			= NULL,			\
607f30491cSTony Luck 	.child			= NULL,			\
617f30491cSTony Luck 	.groups			= NULL,			\
627f30491cSTony Luck 	.min_interval		= 1,			\
637f30491cSTony Luck 	.max_interval		= 4,			\
647f30491cSTony Luck 	.busy_factor		= 64,			\
657f30491cSTony Luck 	.imbalance_pct		= 125,			\
667f30491cSTony Luck 	.cache_nice_tries	= 2,			\
677f30491cSTony Luck 	.busy_idx		= 2,			\
687f30491cSTony Luck 	.idle_idx		= 1,			\
697f30491cSTony Luck 	.newidle_idx		= 2,			\
707f30491cSTony Luck 	.wake_idx		= 1,			\
717f30491cSTony Luck 	.forkexec_idx		= 1,			\
727f30491cSTony Luck 	.flags			= SD_LOAD_BALANCE	\
737f30491cSTony Luck 				| SD_BALANCE_NEWIDLE	\
747f30491cSTony Luck 				| SD_BALANCE_EXEC	\
757f30491cSTony Luck 				| SD_WAKE_AFFINE,	\
767f30491cSTony Luck 	.last_balance		= jiffies,		\
777f30491cSTony Luck 	.balance_interval	= 1,			\
787f30491cSTony Luck 	.nr_balance_failed	= 0,			\
797f30491cSTony Luck }
807f30491cSTony Luck 
817f30491cSTony Luck /* sched_domains SD_NODE_INIT for IA64 NUMA machines */
827f30491cSTony Luck #define SD_NODE_INIT (struct sched_domain) {		\
837f30491cSTony Luck 	.span			= CPU_MASK_NONE,	\
847f30491cSTony Luck 	.parent			= NULL,			\
857f30491cSTony Luck 	.child			= NULL,			\
867f30491cSTony Luck 	.groups			= NULL,			\
877f30491cSTony Luck 	.min_interval		= 8,			\
887f30491cSTony Luck 	.max_interval		= 8*(min(num_online_cpus(), 32)), \
897f30491cSTony Luck 	.busy_factor		= 64,			\
907f30491cSTony Luck 	.imbalance_pct		= 125,			\
917f30491cSTony Luck 	.cache_nice_tries	= 2,			\
927f30491cSTony Luck 	.busy_idx		= 3,			\
937f30491cSTony Luck 	.idle_idx		= 2,			\
947f30491cSTony Luck 	.newidle_idx		= 2,			\
957f30491cSTony Luck 	.wake_idx		= 1,			\
967f30491cSTony Luck 	.forkexec_idx		= 1,			\
977f30491cSTony Luck 	.flags			= SD_LOAD_BALANCE	\
987f30491cSTony Luck 				| SD_BALANCE_EXEC	\
997f30491cSTony Luck 				| SD_BALANCE_FORK	\
1007f30491cSTony Luck 				| SD_SERIALIZE		\
1017f30491cSTony Luck 				| SD_WAKE_BALANCE,	\
1027f30491cSTony Luck 	.last_balance		= jiffies,		\
1037f30491cSTony Luck 	.balance_interval	= 64,			\
1047f30491cSTony Luck 	.nr_balance_failed	= 0,			\
1057f30491cSTony Luck }
1067f30491cSTony Luck 
1077f30491cSTony Luck #endif /* CONFIG_NUMA */
1087f30491cSTony Luck 
1097f30491cSTony Luck #ifdef CONFIG_SMP
1107f30491cSTony Luck #define topology_physical_package_id(cpu)	(cpu_data(cpu)->socket_id)
1117f30491cSTony Luck #define topology_core_id(cpu)			(cpu_data(cpu)->core_id)
1127f30491cSTony Luck #define topology_core_siblings(cpu)		(cpu_core_map[cpu])
1137f30491cSTony Luck #define topology_thread_siblings(cpu)		(per_cpu(cpu_sibling_map, cpu))
1147f30491cSTony Luck #define smt_capable() 				(smp_num_siblings > 1)
1157f30491cSTony Luck #endif
1167f30491cSTony Luck 
1177f30491cSTony Luck extern void arch_fix_phys_package_id(int num, u32 slot);
1187f30491cSTony Luck 
1197f30491cSTony Luck #define pcibus_to_cpumask(bus)	(pcibus_to_node(bus) == -1 ? \
1207f30491cSTony Luck 					CPU_MASK_ALL : \
1217f30491cSTony Luck 					node_to_cpumask(pcibus_to_node(bus)) \
1227f30491cSTony Luck 				)
1237f30491cSTony Luck 
1247f30491cSTony Luck #include <asm-generic/topology.h>
1257f30491cSTony Luck 
1267f30491cSTony Luck #endif /* _ASM_IA64_TOPOLOGY_H */
127