Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

MIPS: SGI-IP27: get rid of compact node ids

Node ids don't need to be contiguous in Linux, so the concept to
use compact node ids to make them contiguous isn't needed at all.
This patchset therefore removes it.

Signed-off-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
Signed-off-by: Paul Burton <paul.burton@mips.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: James Hogan <jhogan@kernel.org>
Cc: linux-mips@vger.kernel.org
Cc: linux-kernel@vger.kernel.org

authored by

Thomas Bogendoerfer and committed by
Paul Burton
4bf841eb 46a73e9e

+81 -212
+1 -1
arch/mips/include/asm/mach-ip27/mmzone.h
··· 6 6 #include <asm/sn/arch.h> 7 7 #include <asm/sn/hub.h> 8 8 9 - #define pa_to_nid(addr) NASID_TO_COMPACT_NODEID(NASID_GET(addr)) 9 + #define pa_to_nid(addr) NASID_GET(addr) 10 10 11 11 struct hub_data { 12 12 kern_vars_t kern_vars;
+1 -2
arch/mips/include/asm/mach-ip27/topology.h
··· 7 7 #include <asm/mmzone.h> 8 8 9 9 struct cpuinfo_ip27 { 10 - cnodeid_t p_nodeid; /* my node ID in compact-id-space */ 11 10 nasid_t p_nasid; /* my node ID in numa-as-id-space */ 12 11 unsigned char p_slice; /* Physical position on node board */ 13 12 }; 14 13 15 14 extern struct cpuinfo_ip27 sn_cpu_info[NR_CPUS]; 16 15 17 - #define cpu_to_node(cpu) (sn_cpu_info[(cpu)].p_nodeid) 16 + #define cpu_to_node(cpu) (cputonasid(cpu)) 18 17 #define cpumask_of_node(node) ((node) == -1 ? \ 19 18 cpu_all_mask : \ 20 19 &hub_data(node)->h_cpus)
+1 -1
arch/mips/include/asm/sn/agent.h
··· 26 26 27 27 #if defined(CONFIG_SGI_IP27) 28 28 #define HUB_NIC_ADDR(_cpuid) \ 29 - REMOTE_HUB_ADDR(COMPACT_TO_NASID_NODEID(cpu_to_node(_cpuid)), \ 29 + REMOTE_HUB_ADDR(cpu_to_node(_cpuid), \ 30 30 MD_MLAN_CTL) 31 31 #endif 32 32
-23
arch/mips/include/asm/sn/arch.h
··· 21 21 #define cputoslice(cpu) (sn_cpu_info[(cpu)].p_slice) 22 22 23 23 #define INVALID_NASID (nasid_t)-1 24 - #define INVALID_CNODEID (cnodeid_t)-1 25 24 #define INVALID_PNODEID (pnodeid_t)-1 26 25 #define INVALID_MODULE (moduleid_t)-1 27 26 #define INVALID_PARTID (partid_t)-1 28 27 29 28 extern nasid_t get_nasid(void); 30 - extern cnodeid_t get_cpu_cnode(cpuid_t); 31 29 extern int get_cpu_slice(cpuid_t); 32 - 33 - /* 34 - * NO ONE should access these arrays directly. The only reason we refer to 35 - * them here is to avoid the procedure call that would be required in the 36 - * macros below. (Really want private data members here :-) 37 - */ 38 - extern cnodeid_t nasid_to_compact_node[MAX_NASIDS]; 39 - extern nasid_t compact_to_nasid_node[MAX_COMPACT_NODES]; 40 - 41 - /* 42 - * These macros are used by various parts of the kernel to convert 43 - * between the three different kinds of node numbering. At least some 44 - * of them may change to procedure calls in the future, but the macros 45 - * will continue to work. Don't use the arrays above directly. 46 - */ 47 - 48 - extern cnodeid_t cpuid_to_compact_node[MAXCPUS]; 49 - 50 - #define NASID_TO_COMPACT_NODEID(nnode) (nasid_to_compact_node[nnode]) 51 - #define COMPACT_TO_NASID_NODEID(cnode) (compact_to_nasid_node[cnode]) 52 - #define CPUID_TO_COMPACT_NODEID(cpu) (cpuid_to_compact_node[(cpu)]) 53 30 54 31 #endif /* _ASM_SN_ARCH_H */
+2 -2
arch/mips/include/asm/sn/hub.h
··· 10 10 #include <asm/xtalk/xtalk.h> 11 11 12 12 /* ip27-hubio.c */ 13 - extern unsigned long hub_pio_map(cnodeid_t cnode, xwidgetnum_t widget, 13 + extern unsigned long hub_pio_map(nasid_t nasid, xwidgetnum_t widget, 14 14 unsigned long xtalk_addr, size_t size); 15 - extern void hub_pio_init(cnodeid_t cnode); 15 + extern void hub_pio_init(nasid_t nasid); 16 16 17 17 #endif /* __ASM_SN_HUB_H */
+2 -2
arch/mips/include/asm/sn/mapped_kernel.h
··· 37 37 38 38 #define MAPPED_KERN_RO_TO_PHYS(x) \ 39 39 ((unsigned long)MAPPED_ADDR_RO_TO_PHYS(x) | \ 40 - MAPPED_KERN_RO_PHYSBASE(get_compact_nodeid())) 40 + MAPPED_KERN_RO_PHYSBASE(get_nasid())) 41 41 #define MAPPED_KERN_RW_TO_PHYS(x) \ 42 42 ((unsigned long)MAPPED_ADDR_RW_TO_PHYS(x) | \ 43 - MAPPED_KERN_RW_PHYSBASE(get_compact_nodeid())) 43 + MAPPED_KERN_RW_PHYSBASE(get_nasid())) 44 44 45 45 #else /* CONFIG_MAPPED_KERNEL */ 46 46
+2 -3
arch/mips/include/asm/sn/sn_private.h
··· 7 7 extern nasid_t master_nasid; 8 8 9 9 extern void cpu_node_probe(void); 10 - extern cnodeid_t get_compact_nodeid(void); 11 - extern void hub_rtc_init(cnodeid_t); 10 + extern void hub_rtc_init(nasid_t nasid); 12 11 extern void cpu_time_init(void); 13 12 extern void per_cpu_init(void); 14 13 extern void install_cpu_nmi_handler(int slice); 15 14 extern void install_ipi(void); 16 15 extern void setup_replication_mask(void); 17 16 extern void replicate_kernel_text(void); 18 - extern unsigned long node_getfirstfree(cnodeid_t); 17 + extern unsigned long node_getfirstfree(nasid_t nasid); 19 18 20 19 #endif /* __ASM_SN_SN_PRIVATE_H */
-1
arch/mips/include/asm/sn/types.h
··· 13 13 14 14 typedef unsigned long cpuid_t; 15 15 typedef signed short nasid_t; /* node id in numa-as-id space */ 16 - typedef signed short cnodeid_t; /* node id in compact-id space */ 17 16 typedef signed char partid_t; /* partition ID type */ 18 17 typedef signed short moduleid_t; /* user-visible module number type */ 19 18
+1 -1
arch/mips/pci/pci-xtalk-bridge.c
··· 285 285 ret = irq_chip_set_affinity_parent(d, mask, force); 286 286 if (ret >= 0) { 287 287 cpu = cpumask_first_and(mask, cpu_online_mask); 288 - nasid = COMPACT_TO_NASID_NODEID(cpu_to_node(cpu)); 288 + nasid = cpu_to_node(cpu); 289 289 bridge_write(data->bc, b_int_addr[pin].addr, 290 290 (((data->bc->intr_addr >> 30) & 0x30000) | 291 291 bit | (nasid << 8)));
+4 -6
arch/mips/sgi-ip27/ip27-hubio.c
··· 25 25 * @size: size of the PIO mapping 26 26 * 27 27 **/ 28 - unsigned long hub_pio_map(cnodeid_t cnode, xwidgetnum_t widget, 28 + unsigned long hub_pio_map(nasid_t nasid, xwidgetnum_t widget, 29 29 unsigned long xtalk_addr, size_t size) 30 30 { 31 - nasid_t nasid = COMPACT_TO_NASID_NODEID(cnode); 32 31 unsigned i; 33 32 34 33 /* use small-window mapping if possible */ ··· 43 44 44 45 xtalk_addr &= ~(BWIN_SIZE-1); 45 46 for (i = 0; i < HUB_NUM_BIG_WINDOW; i++) { 46 - if (test_and_set_bit(i, hub_data(cnode)->h_bigwin_used)) 47 + if (test_and_set_bit(i, hub_data(nasid)->h_bigwin_used)) 47 48 continue; 48 49 49 50 /* ··· 170 171 * 171 172 * @hub: hubinfo structure for our hub 172 173 */ 173 - void hub_pio_init(cnodeid_t cnode) 174 + void hub_pio_init(nasid_t nasid) 174 175 { 175 - nasid_t nasid = COMPACT_TO_NASID_NODEID(cnode); 176 176 unsigned i; 177 177 178 178 /* initialize big window piomaps for this hub */ 179 - bitmap_zero(hub_data(cnode)->h_bigwin_used, HUB_NUM_BIG_WINDOW); 179 + bitmap_zero(hub_data(nasid)->h_bigwin_used, HUB_NUM_BIG_WINDOW); 180 180 for (i = 0; i < HUB_NUM_BIG_WINDOW; i++) 181 181 IIO_ITTE_DISABLE(nasid, i); 182 182
+8 -25
arch/mips/sgi-ip27/ip27-init.c
··· 41 41 static DECLARE_BITMAP(hub_init_mask, MAX_COMPACT_NODES); 42 42 nasid_t master_nasid = INVALID_NASID; 43 43 44 - cnodeid_t nasid_to_compact_node[MAX_NASIDS]; 45 - nasid_t compact_to_nasid_node[MAX_COMPACT_NODES]; 46 - cnodeid_t cpuid_to_compact_node[MAXCPUS]; 47 - 48 - EXPORT_SYMBOL(nasid_to_compact_node); 49 - 50 44 struct cpuinfo_ip27 sn_cpu_info[NR_CPUS]; 51 45 EXPORT_SYMBOL_GPL(sn_cpu_info); 52 46 53 - extern void pcibr_setup(cnodeid_t); 54 - 55 - static void per_hub_init(cnodeid_t cnode) 47 + static void per_hub_init(nasid_t nasid) 56 48 { 57 - struct hub_data *hub = hub_data(cnode); 58 - nasid_t nasid = COMPACT_TO_NASID_NODEID(cnode); 49 + struct hub_data *hub = hub_data(nasid); 59 50 60 51 cpumask_set_cpu(smp_processor_id(), &hub->h_cpus); 61 52 62 - if (test_and_set_bit(cnode, hub_init_mask)) 53 + if (test_and_set_bit(nasid, hub_init_mask)) 63 54 return; 64 55 /* 65 56 * Set CRB timeout at 5ms, (< PI timeout of 10ms) ··· 58 67 REMOTE_HUB_S(nasid, IIO_ICTP, 0x800); 59 68 REMOTE_HUB_S(nasid, IIO_ICTO, 0xff); 60 69 61 - hub_rtc_init(cnode); 70 + hub_rtc_init(nasid); 62 71 63 72 #ifdef CONFIG_REPLICATE_EXHANDLERS 64 73 /* 65 74 * If this is not a headless node initialization, 66 75 * copy over the caliased exception handlers. 67 76 */ 68 - if (get_compact_nodeid() == cnode) { 77 + if (get_nasid() == nasid) { 69 78 extern char except_vec2_generic, except_vec3_generic; 70 79 extern void build_tlb_refill_handler(void); 71 80 ··· 83 92 { 84 93 int cpu = smp_processor_id(); 85 94 int slice = LOCAL_HUB_L(PI_CPU_NUM); 86 - cnodeid_t cnode = get_compact_nodeid(); 87 - struct hub_data *hub = hub_data(cnode); 95 + nasid_t nasid = get_nasid(); 96 + struct hub_data *hub = hub_data(nasid); 88 97 89 98 if (test_and_set_bit(slice, &hub->slice_map)) 90 99 return; 91 100 92 101 clear_c0_status(ST0_IM); 93 102 94 - per_hub_init(cnode); 103 + per_hub_init(nasid); 95 104 96 105 cpu_time_init(); 97 106 install_ipi(); ··· 111 120 { 112 121 return (nasid_t)((LOCAL_HUB_L(NI_STATUS_REV_ID) & NSRI_NODEID_MASK) 113 122 >> NSRI_NODEID_SHFT); 114 - } 115 - 116 - /* 117 - * Map the physical node id to a virtual node id (virtual node ids are contiguous). 118 - */ 119 - cnodeid_t get_compact_nodeid(void) 120 - { 121 - return NASID_TO_COMPACT_NODEID(get_nasid()); 122 123 } 123 124 124 125 extern void ip27_reboot_setup(void);
+2 -2
arch/mips/sgi-ip27/ip27-irq.c
··· 73 73 int cpu; 74 74 75 75 cpu = cpumask_first_and(mask, cpu_online_mask); 76 - nasid = COMPACT_TO_NASID_NODEID(cpu_to_node(cpu)); 76 + nasid = cpu_to_node(cpu); 77 77 hd->cpu = cpu; 78 78 if (!cputoslice(cpu)) { 79 79 hd->irq_mask[0] = REMOTE_HUB_PTR(nasid, PI_INT_MASK0_A); ··· 137 137 handle_level_irq, NULL, NULL); 138 138 139 139 /* use CPU connected to nearest hub */ 140 - hub = hub_data(NASID_TO_COMPACT_NODEID(info->nasid)); 140 + hub = hub_data(info->nasid); 141 141 setup_hub_mask(hd, &hub->h_cpus); 142 142 143 143 /* Make sure it's not already pending when we connect it. */
+2 -12
arch/mips/sgi-ip27/ip27-klconfig.c
··· 73 73 return (lboard_t *)NULL; 74 74 } 75 75 76 - cnodeid_t get_cpu_cnode(cpuid_t cpu) 77 - { 78 - return CPUID_TO_COMPACT_NODEID(cpu); 79 - } 80 - 81 76 klcpu_t *nasid_slice_to_cpuinfo(nasid_t nasid, int slice) 82 77 { 83 78 lboard_t *brd; ··· 97 102 nasid_t nasid; 98 103 int slice; 99 104 klcpu_t *acpu; 100 - gda_t *gdap = GDA; 101 - cnodeid_t cnode; 102 105 103 106 if (!(cpu < MAXCPUS)) { 104 107 printk("sn_get_cpuinfo: illegal cpuid 0x%lx\n", cpu); 105 108 return NULL; 106 109 } 107 110 108 - cnode = get_cpu_cnode(cpu); 109 - if (cnode == INVALID_CNODEID) 110 - return NULL; 111 - 112 - if ((nasid = gdap->g_nasidtable[cnode]) == INVALID_NASID) 111 + nasid = cputonasid(cpu); 112 + if (nasid == INVALID_NASID) 113 113 return NULL; 114 114 115 115 for (slice = 0; slice < CPUS_PER_NODE; slice++) {
+9 -12
arch/mips/sgi-ip27/ip27-klnuma.c
··· 38 38 #error Kernel replication works with mapped kernel support. No calias support. 39 39 #endif 40 40 { 41 - cnodeid_t cnode; 41 + nasid_t nasid; 42 42 43 - for_each_online_node(cnode) { 44 - if (cnode == 0) 43 + for_each_online_node(nasid) { 44 + if (nasid == 0) 45 45 continue; 46 46 /* Advertise that we have a copy of the kernel */ 47 - cpumask_set_cpu(cnode, &ktext_repmask); 47 + cpumask_set_cpu(nasid, &ktext_repmask); 48 48 } 49 49 } 50 50 #endif ··· 85 85 86 86 void __init replicate_kernel_text(void) 87 87 { 88 - cnodeid_t cnode; 89 88 nasid_t client_nasid; 90 89 nasid_t server_nasid; 91 90 ··· 93 94 /* Record where the master node should get its kernel text */ 94 95 set_ktext_source(master_nasid, master_nasid); 95 96 96 - for_each_online_node(cnode) { 97 - if (cnode == 0) 97 + for_each_online_node(client_nasid) { 98 + if (client_nasid == 0) 98 99 continue; 99 - client_nasid = COMPACT_TO_NASID_NODEID(cnode); 100 100 101 101 /* Check if this node should get a copy of the kernel */ 102 - if (cpumask_test_cpu(cnode, &ktext_repmask)) { 102 + if (cpumask_test_cpu(client_nasid, &ktext_repmask)) { 103 103 server_nasid = client_nasid; 104 104 copy_kernel(server_nasid); 105 105 } ··· 113 115 * data structures on the first couple of pages of the first slot of each 114 116 * node. If this is the case, getfirstfree(node) > getslotstart(node, 0). 115 117 */ 116 - unsigned long node_getfirstfree(cnodeid_t cnode) 118 + unsigned long node_getfirstfree(nasid_t nasid) 117 119 { 118 120 unsigned long loadbase = REP_BASE; 119 - nasid_t nasid = COMPACT_TO_NASID_NODEID(cnode); 120 121 unsigned long offset; 121 122 122 123 #ifdef CONFIG_MAPPED_KERNEL 123 124 loadbase += 16777216; 124 125 #endif 125 126 offset = PAGE_ALIGN((unsigned long)(&_end)) - loadbase; 126 - if ((cnode == 0) || (cpumask_test_cpu(cnode, &ktext_repmask))) 127 + if ((nasid == 0) || (cpumask_test_cpu(nasid, &ktext_repmask))) 127 128 return TO_NODE(nasid, offset) >> PAGE_SHIFT; 128 129 else 129 130 return KDM_TO_PHYS(PAGE_ALIGN(SYMMON_STK_ADDR(nasid, 0))) >> PAGE_SHIFT;
+18 -39
arch/mips/sgi-ip27/ip27-memory.c
··· 44 44 return ((LOCAL_HUB_L(NI_STATUS_REV_ID) & NSRI_REGIONSIZE_MASK) >> NSRI_REGIONSIZE_SHFT) & REGIONSIZE_FINE; 45 45 } 46 46 47 - static u64 get_region(cnodeid_t cnode) 47 + static u64 get_region(nasid_t nasid) 48 48 { 49 49 if (fine_mode) 50 - return COMPACT_TO_NASID_NODEID(cnode) >> NASID_TO_FINEREG_SHFT; 50 + return nasid >> NASID_TO_FINEREG_SHFT; 51 51 else 52 - return COMPACT_TO_NASID_NODEID(cnode) >> NASID_TO_COARSEREG_SHFT; 52 + return nasid >> NASID_TO_COARSEREG_SHFT; 53 53 } 54 54 55 55 static u64 region_mask; 56 56 57 57 static void gen_region_mask(u64 *region_mask) 58 58 { 59 - cnodeid_t cnode; 59 + nasid_t nasid; 60 60 61 61 (*region_mask) = 0; 62 - for_each_online_node(cnode) { 63 - (*region_mask) |= 1ULL << get_region(cnode); 62 + for_each_online_node(nasid) { 63 + (*region_mask) |= 1ULL << get_region(nasid); 64 64 } 65 65 } 66 66 ··· 111 111 { 112 112 klrou_t *router, *router_a = NULL, *router_b = NULL; 113 113 lboard_t *brd, *dest_brd; 114 - cnodeid_t cnode; 115 114 nasid_t nasid; 116 115 int port; 117 116 118 117 /* Figure out which routers nodes in question are connected to */ 119 - for_each_online_node(cnode) { 120 - nasid = COMPACT_TO_NASID_NODEID(cnode); 121 - 122 - if (nasid == -1) continue; 123 - 118 + for_each_online_node(nasid) { 124 119 brd = find_lboard_class((lboard_t *)KL_CONFIG_INFO(nasid), 125 120 KLTYPE_ROUTER); 126 121 ··· 171 176 172 177 static void __init init_topology_matrix(void) 173 178 { 174 - nasid_t nasid, nasid2; 175 - cnodeid_t row, col; 179 + nasid_t row, col; 176 180 177 181 for (row = 0; row < MAX_COMPACT_NODES; row++) 178 182 for (col = 0; col < MAX_COMPACT_NODES; col++) 179 183 __node_distances[row][col] = -1; 180 184 181 185 for_each_online_node(row) { 182 - nasid = COMPACT_TO_NASID_NODEID(row); 183 186 for_each_online_node(col) { 184 - nasid2 = COMPACT_TO_NASID_NODEID(col); 185 187 __node_distances[row][col] = 186 - compute_node_distance(nasid, nasid2); 188 + compute_node_distance(row, col); 187 189 } 188 190 } 189 191 } ··· 188 196 static void __init dump_topology(void) 189 197 { 190 198 nasid_t nasid; 191 - cnodeid_t cnode; 192 199 lboard_t *brd, *dest_brd; 193 200 int port; 194 201 int router_num = 0; 195 202 klrou_t *router; 196 - cnodeid_t row, col; 203 + nasid_t row, col; 197 204 198 205 pr_info("************** Topology ********************\n"); 199 206 ··· 207 216 pr_cont("\n"); 208 217 } 209 218 210 - for_each_online_node(cnode) { 211 - nasid = COMPACT_TO_NASID_NODEID(cnode); 212 - 213 - if (nasid == -1) continue; 214 - 219 + for_each_online_node(nasid) { 215 220 brd = find_lboard_class((lboard_t *)KL_CONFIG_INFO(nasid), 216 221 KLTYPE_ROUTER); 217 222 ··· 241 254 } 242 255 } 243 256 244 - static unsigned long __init slot_getbasepfn(cnodeid_t cnode, int slot) 257 + static unsigned long __init slot_getbasepfn(nasid_t nasid, int slot) 245 258 { 246 - nasid_t nasid = COMPACT_TO_NASID_NODEID(cnode); 247 - 248 259 return ((unsigned long)nasid << PFN_NASIDSHFT) | (slot << SLOT_PFNSHIFT); 249 260 } 250 261 251 - static unsigned long __init slot_psize_compute(cnodeid_t node, int slot) 262 + static unsigned long __init slot_psize_compute(nasid_t nasid, int slot) 252 263 { 253 - nasid_t nasid; 254 264 lboard_t *brd; 255 265 klmembnk_t *banks; 256 266 unsigned long size; 257 267 258 - nasid = COMPACT_TO_NASID_NODEID(node); 259 268 /* Find the node board */ 260 269 brd = find_lboard((lboard_t *)KL_CONFIG_INFO(nasid), KLTYPE_IP27); 261 270 if (!brd) ··· 281 298 282 299 static void __init mlreset(void) 283 300 { 284 - int i; 301 + nasid_t nasid; 285 302 286 303 master_nasid = get_nasid(); 287 304 fine_mode = is_fine_dirmode(); ··· 304 321 /* 305 322 * Set all nodes' calias sizes to 8k 306 323 */ 307 - for_each_online_node(i) { 308 - nasid_t nasid; 309 - 310 - nasid = COMPACT_TO_NASID_NODEID(i); 311 - 324 + for_each_online_node(nasid) { 312 325 /* 313 326 * Always have node 0 in the region mask, otherwise 314 327 * CALIAS accesses get exceptions since the hub ··· 333 354 { 334 355 unsigned long slot_psize, slot0sz = 0, nodebytes; /* Hack to detect problem configs */ 335 356 int slot; 336 - cnodeid_t node; 357 + nasid_t node; 337 358 338 359 for_each_online_node(node) { 339 360 nodebytes = 0; ··· 363 384 } 364 385 } 365 386 366 - static void __init node_mem_init(cnodeid_t node) 387 + static void __init node_mem_init(nasid_t node) 367 388 { 368 389 unsigned long slot_firstpfn = slot_getbasepfn(node, 0); 369 390 unsigned long slot_freepfn = node_getfirstfree(node); ··· 410 431 */ 411 432 void __init prom_meminit(void) 412 433 { 413 - cnodeid_t node; 434 + nasid_t node; 414 435 415 436 mlreset(); 416 437 szmem();
+4 -12
arch/mips/sgi-ip27/ip27-nmi.c
··· 17 17 #define NODE_NUM_CPUS(n) CPUS_PER_NODE 18 18 #endif 19 19 20 - #define CNODEID_NONE (cnodeid_t)-1 21 - 22 20 typedef unsigned long machreg_t; 23 21 24 22 static arch_spinlock_t nmi_lock = __ARCH_SPIN_LOCK_UNLOCKED; ··· 150 152 * Copy the cpu registers which have been saved in the IP27prom format 151 153 * into the eframe format for the node under consideration. 152 154 */ 153 - void nmi_node_eframe_save(cnodeid_t cnode) 155 + void nmi_node_eframe_save(nasid_t nasid) 154 156 { 155 - nasid_t nasid; 156 157 int slice; 157 158 158 - /* Make sure that we have a valid node */ 159 - if (cnode == CNODEID_NONE) 160 - return; 161 - 162 - nasid = COMPACT_TO_NASID_NODEID(cnode); 163 159 if (nasid == INVALID_NASID) 164 160 return; 165 161 ··· 170 178 void 171 179 nmi_eframes_save(void) 172 180 { 173 - cnodeid_t cnode; 181 + nasid_t nasid; 174 182 175 - for_each_online_node(cnode) 176 - nmi_node_eframe_save(cnode); 183 + for_each_online_node(nasid) 184 + nmi_node_eframe_save(nasid); 177 185 } 178 186 179 187 void
+2 -4
arch/mips/sgi-ip27/ip27-reset.c
··· 45 45 #endif 46 46 #if 0 47 47 for_each_online_node(i) 48 - REMOTE_HUB_S(COMPACT_TO_NASID_NODEID(i), PROMOP_REG, 49 - PROMOP_REBOOT); 48 + REMOTE_HUB_S(i, PROMOP_REG, PROMOP_REBOOT); 50 49 #else 51 50 LOCAL_HUB_S(NI_PORT_RESET, NPR_PORTRESET | NPR_LOCALRESET); 52 51 #endif ··· 60 61 smp_send_stop(); 61 62 #endif 62 63 for_each_online_node(i) 63 - REMOTE_HUB_S(COMPACT_TO_NASID_NODEID(i), PROMOP_REG, 64 - PROMOP_RESTART); 64 + REMOTE_HUB_S(i, PROMOP_REG, PROMOP_RESTART); 65 65 LOCAL_HUB_S(NI_PORT_RESET, NPR_PORTRESET | NPR_LOCALRESET); 66 66 noreturn; 67 67 }
+16 -56
arch/mips/sgi-ip27/ip27-smp.c
··· 31 31 * Takes as first input the PROM assigned cpu id, and the kernel 32 32 * assigned cpu id as the second. 33 33 */ 34 - static void alloc_cpupda(cpuid_t cpu, int cpunum) 34 + static void alloc_cpupda(nasid_t nasid, cpuid_t cpu, int cpunum) 35 35 { 36 - cnodeid_t node = get_cpu_cnode(cpu); 37 - nasid_t nasid = COMPACT_TO_NASID_NODEID(node); 38 - 39 36 cputonasid(cpunum) = nasid; 40 - sn_cpu_info[cpunum].p_nodeid = node; 41 37 cputoslice(cpunum) = get_cpu_slice(cpu); 42 38 } 43 39 44 - static nasid_t get_actual_nasid(lboard_t *brd) 45 - { 46 - klhub_t *hub; 47 - 48 - if (!brd) 49 - return INVALID_NASID; 50 - 51 - /* find out if we are a completely disabled brd. */ 52 - hub = (klhub_t *)find_first_component(brd, KLSTRUCT_HUB); 53 - if (!hub) 54 - return INVALID_NASID; 55 - if (!(hub->hub_info.flags & KLINFO_ENABLE)) /* disabled node brd */ 56 - return hub->hub_info.physid; 57 - else 58 - return brd->brd_nasid; 59 - } 60 - 61 - static int do_cpumask(cnodeid_t cnode, nasid_t nasid, int highest) 40 + static int do_cpumask(nasid_t nasid, int highest) 62 41 { 63 42 static int tot_cpus_found = 0; 64 43 lboard_t *brd; ··· 51 72 acpu = (klcpu_t *)find_first_component(brd, KLSTRUCT_CPU); 52 73 while (acpu) { 53 74 cpuid = acpu->cpu_info.virtid; 54 - /* cnode is not valid for completely disabled brds */ 55 - if (get_actual_nasid(brd) == brd->brd_nasid) 56 - cpuid_to_compact_node[cpuid] = cnode; 57 - if (cpuid > highest) 58 - highest = cpuid; 59 75 /* Only let it join in if it's marked enabled */ 60 76 if ((acpu->cpu_info.flags & KLINFO_ENABLE) && 61 77 (tot_cpus_found != NR_CPUS)) { 78 + if (cpuid > highest) 79 + highest = cpuid; 62 80 set_cpu_possible(cpuid, true); 63 - alloc_cpupda(cpuid, tot_cpus_found); 81 + alloc_cpupda(nasid, cpuid, tot_cpus_found); 64 82 cpus_found++; 65 83 tot_cpus_found++; 66 84 } ··· 80 104 gda_t *gdap = GDA; 81 105 82 106 /* 83 - * Initialize the arrays to invalid nodeid (-1) 84 - */ 85 - for (i = 0; i < MAX_COMPACT_NODES; i++) 86 - compact_to_nasid_node[i] = INVALID_NASID; 87 - for (i = 0; i < MAX_NASIDS; i++) 88 - nasid_to_compact_node[i] = INVALID_CNODEID; 89 - for (i = 0; i < MAXCPUS; i++) 90 - cpuid_to_compact_node[i] = INVALID_CNODEID; 91 - 92 - /* 93 107 * MCD - this whole "compact node" stuff can probably be dropped, 94 108 * as we can handle sparse numbering now 95 109 */ ··· 88 122 nasid_t nasid = gdap->g_nasidtable[i]; 89 123 if (nasid == INVALID_NASID) 90 124 break; 91 - compact_to_nasid_node[i] = nasid; 92 - nasid_to_compact_node[nasid] = i; 93 - node_set_online(num_online_nodes()); 94 - highest = do_cpumask(i, nasid, highest); 125 + node_set_online(nasid); 126 + highest = do_cpumask(nasid, highest); 95 127 } 96 128 97 129 printk("Discovered %d cpus on %d nodes\n", highest + 1, num_online_nodes()); ··· 126 162 irq += cputoslice(destid); 127 163 128 164 /* 129 - * Convert the compact hub number to the NASID to get the correct 130 - * part of the address space. Then set the interrupt bit associated 131 - * with the CPU we want to send the interrupt to. 165 + * Set the interrupt bit associated with the CPU we want to 166 + * send the interrupt to. 132 167 */ 133 - REMOTE_HUB_SEND_INTR(COMPACT_TO_NASID_NODEID(cpu_to_node(destid)), irq); 168 + REMOTE_HUB_SEND_INTR(cpu_to_node(destid), irq); 134 169 } 135 170 136 171 static void ip27_send_ipi_mask(const struct cpumask *mask, unsigned int action) ··· 171 208 172 209 static void __init ip27_smp_setup(void) 173 210 { 174 - cnodeid_t cnode; 211 + nasid_t nasid; 175 212 176 - for_each_online_node(cnode) { 177 - if (cnode == 0) 213 + for_each_online_node(nasid) { 214 + if (nasid == 0) 178 215 continue; 179 - intr_clear_all(COMPACT_TO_NASID_NODEID(cnode)); 216 + intr_clear_all(nasid); 180 217 } 181 218 182 219 replicate_kernel_text(); 183 220 184 221 /* 185 - * Assumption to be fixed: we're always booted on logical / physical 186 - * processor 0. While we're always running on logical processor 0 187 - * this still means this is physical processor zero; it might for 188 - * example be disabled in the firmware. 222 + * PROM sets up system, that boot cpu is always first CPU on nasid 0 189 223 */ 190 - alloc_cpupda(0, 0); 224 + alloc_cpupda(0, 0, 0); 191 225 } 192 226 193 227 static void __init ip27_prepare_cpus(unsigned int max_cpus)
+2 -2
arch/mips/sgi-ip27/ip27-timer.c
··· 170 170 printk("CPU %d clock is %dMHz.\n", smp_processor_id(), cpu->cpu_speed); 171 171 } 172 172 173 - void hub_rtc_init(cnodeid_t cnode) 173 + void hub_rtc_init(nasid_t nasid) 174 174 { 175 175 176 176 /* ··· 178 178 * If this is not the current node then it is a cpuless 179 179 * node and timeouts will not happen there. 180 180 */ 181 - if (get_compact_nodeid() == cnode) { 181 + if (get_nasid() == nasid) { 182 182 LOCAL_HUB_S(PI_RT_EN_A, 1); 183 183 LOCAL_HUB_S(PI_RT_EN_B, 1); 184 184 LOCAL_HUB_S(PI_PROF_EN_A, 0);
+4 -6
arch/mips/sgi-ip27/ip27-xtalk.c
··· 138 138 return 0; 139 139 } 140 140 141 - static void xtalk_probe_node(cnodeid_t nid) 141 + static void xtalk_probe_node(nasid_t nasid) 142 142 { 143 143 volatile u64 hubreg; 144 - nasid_t nasid; 145 144 xwidget_part_num_t partnum; 146 145 widgetreg_t widget_id; 147 146 148 - nasid = COMPACT_TO_NASID_NODEID(nid); 149 147 hubreg = REMOTE_HUB_L(nasid, IIO_LLP_CSR); 150 148 151 149 /* check whether the link is up */ ··· 171 173 172 174 static int __init xtalk_init(void) 173 175 { 174 - cnodeid_t cnode; 176 + nasid_t nasid; 175 177 176 - for_each_online_node(cnode) 177 - xtalk_probe_node(cnode); 178 + for_each_online_node(nasid) 179 + xtalk_probe_node(nasid); 178 180 179 181 return 0; 180 182 }