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]) 37fbb776c3SRusty Russell #define cpumask_of_node(node) (&node_to_cpu_mask[node]) 387f30491cSTony Luck 397f30491cSTony Luck /* 407f30491cSTony Luck * Returns the number of the node containing Node 'nid'. 417f30491cSTony Luck * Not implemented here. Multi-level hierarchies detected with 427f30491cSTony Luck * the help of node_distance(). 437f30491cSTony Luck */ 447f30491cSTony Luck #define parent_node(nid) (nid) 457f30491cSTony Luck 467f30491cSTony Luck /* 477f30491cSTony Luck * Returns the number of the first CPU on Node 'node'. 487f30491cSTony Luck */ 49fbb776c3SRusty Russell #define node_to_first_cpu(node) (cpumask_first(cpumask_of_node(node))) 507f30491cSTony Luck 517f30491cSTony Luck /* 527f30491cSTony Luck * Determines the node for a given pci bus 537f30491cSTony Luck */ 547f30491cSTony Luck #define pcibus_to_node(bus) PCI_CONTROLLER(bus)->node 557f30491cSTony Luck 567f30491cSTony Luck void build_cpu_to_node_map(void); 577f30491cSTony Luck 587f30491cSTony Luck #define SD_CPU_INIT (struct sched_domain) { \ 597f30491cSTony Luck .span = CPU_MASK_NONE, \ 607f30491cSTony Luck .parent = NULL, \ 617f30491cSTony Luck .child = NULL, \ 627f30491cSTony Luck .groups = NULL, \ 637f30491cSTony Luck .min_interval = 1, \ 647f30491cSTony Luck .max_interval = 4, \ 657f30491cSTony Luck .busy_factor = 64, \ 667f30491cSTony Luck .imbalance_pct = 125, \ 677f30491cSTony Luck .cache_nice_tries = 2, \ 687f30491cSTony Luck .busy_idx = 2, \ 697f30491cSTony Luck .idle_idx = 1, \ 707f30491cSTony Luck .newidle_idx = 2, \ 717f30491cSTony Luck .wake_idx = 1, \ 727f30491cSTony Luck .forkexec_idx = 1, \ 737f30491cSTony Luck .flags = SD_LOAD_BALANCE \ 747f30491cSTony Luck | SD_BALANCE_NEWIDLE \ 757f30491cSTony Luck | SD_BALANCE_EXEC \ 767f30491cSTony Luck | SD_WAKE_AFFINE, \ 777f30491cSTony Luck .last_balance = jiffies, \ 787f30491cSTony Luck .balance_interval = 1, \ 797f30491cSTony Luck .nr_balance_failed = 0, \ 807f30491cSTony Luck } 817f30491cSTony Luck 827f30491cSTony Luck /* sched_domains SD_NODE_INIT for IA64 NUMA machines */ 837f30491cSTony Luck #define SD_NODE_INIT (struct sched_domain) { \ 847f30491cSTony Luck .span = CPU_MASK_NONE, \ 857f30491cSTony Luck .parent = NULL, \ 867f30491cSTony Luck .child = NULL, \ 877f30491cSTony Luck .groups = NULL, \ 887f30491cSTony Luck .min_interval = 8, \ 897f30491cSTony Luck .max_interval = 8*(min(num_online_cpus(), 32)), \ 907f30491cSTony Luck .busy_factor = 64, \ 917f30491cSTony Luck .imbalance_pct = 125, \ 927f30491cSTony Luck .cache_nice_tries = 2, \ 937f30491cSTony Luck .busy_idx = 3, \ 947f30491cSTony Luck .idle_idx = 2, \ 957f30491cSTony Luck .newidle_idx = 2, \ 967f30491cSTony Luck .wake_idx = 1, \ 977f30491cSTony Luck .forkexec_idx = 1, \ 987f30491cSTony Luck .flags = SD_LOAD_BALANCE \ 997f30491cSTony Luck | SD_BALANCE_EXEC \ 1007f30491cSTony Luck | SD_BALANCE_FORK \ 1017f30491cSTony Luck | SD_SERIALIZE \ 1027f30491cSTony Luck | SD_WAKE_BALANCE, \ 1037f30491cSTony Luck .last_balance = jiffies, \ 1047f30491cSTony Luck .balance_interval = 64, \ 1057f30491cSTony Luck .nr_balance_failed = 0, \ 1067f30491cSTony Luck } 1077f30491cSTony Luck 1087f30491cSTony Luck #endif /* CONFIG_NUMA */ 1097f30491cSTony Luck 1107f30491cSTony Luck #ifdef CONFIG_SMP 1117f30491cSTony Luck #define topology_physical_package_id(cpu) (cpu_data(cpu)->socket_id) 1127f30491cSTony Luck #define topology_core_id(cpu) (cpu_data(cpu)->core_id) 1137f30491cSTony Luck #define topology_core_siblings(cpu) (cpu_core_map[cpu]) 1147f30491cSTony Luck #define topology_thread_siblings(cpu) (per_cpu(cpu_sibling_map, cpu)) 115333af153SRusty Russell #define topology_core_cpumask(cpu) (&cpu_core_map[cpu]) 116333af153SRusty Russell #define topology_thread_cpumask(cpu) (&per_cpu(cpu_sibling_map, cpu)) 1177f30491cSTony Luck #define smt_capable() (smp_num_siblings > 1) 1187f30491cSTony Luck #endif 1197f30491cSTony Luck 1207f30491cSTony Luck extern void arch_fix_phys_package_id(int num, u32 slot); 1217f30491cSTony Luck 1227f30491cSTony Luck #define pcibus_to_cpumask(bus) (pcibus_to_node(bus) == -1 ? \ 1237f30491cSTony Luck CPU_MASK_ALL : \ 1247f30491cSTony Luck node_to_cpumask(pcibus_to_node(bus)) \ 1257f30491cSTony Luck ) 1267f30491cSTony Luck 127fbb776c3SRusty Russell #define cpumask_of_pcibus(bus) (pcibus_to_node(bus) == -1 ? \ 128fbb776c3SRusty Russell cpu_all_mask : \ 129fbb776c3SRusty Russell cpumask_from_node(pcibus_to_node(bus))) 130fbb776c3SRusty Russell 1317f30491cSTony Luck #include <asm-generic/topology.h> 1327f30491cSTony Luck 1337f30491cSTony Luck #endif /* _ASM_IA64_TOPOLOGY_H */ 134