diff -urNp linux-2.5.39-ia64/arch/ia64/kernel/acpi.c linux-2.5.39-ia64-top/arch/ia64/kernel/acpi.c --- linux-2.5.39-ia64/arch/ia64/kernel/acpi.c Fri Sep 27 23:49:54 2002 +++ linux-2.5.39-ia64-top/arch/ia64/kernel/acpi.c Sat Oct 5 19:02:52 2002 @@ -631,6 +631,7 @@ acpi_boot_init (char *cmdline) smp_boot_data.cpu_count = total_cpus; smp_build_cpu_map(); + build_cpu_to_node_map(); #endif /* Make boot-up look pretty */ printk("%d CPUs available, %d CPUs total\n", available_cpus, total_cpus); diff -urNp linux-2.5.39-ia64/arch/ia64/kernel/smpboot.c linux-2.5.39-ia64-top/arch/ia64/kernel/smpboot.c --- linux-2.5.39-ia64/arch/ia64/kernel/smpboot.c Fri Sep 27 23:49:16 2002 +++ linux-2.5.39-ia64-top/arch/ia64/kernel/smpboot.c Sat Oct 5 19:02:52 2002 @@ -16,6 +16,7 @@ #include +#include #include #include #include @@ -427,6 +428,32 @@ smp_build_cpu_map (void) } } +char cpu_to_node_map[NR_CPUS] __cacheline_aligned; +/* + * Build cpu to node mapping. + */ +void __init +build_cpu_to_node_map(void) +{ + int cpu, i; + + for(cpu=0; cpu #include #include #include @@ -44,6 +45,7 @@ extern unsigned char smp_int_redirect; extern volatile int ia64_cpu_to_sapicid[]; #define cpu_physical_id(i) ia64_cpu_to_sapicid[i] +extern char cpu_to_node_map[NR_CPUS] __cacheline_aligned; extern unsigned long ap_wakeup_vector; diff -urNp linux-2.5.39-ia64/include/asm-ia64/topology.h linux-2.5.39-ia64-top/include/asm-ia64/topology.h --- linux-2.5.39-ia64/include/asm-ia64/topology.h Thu Jan 1 01:00:00 1970 +++ linux-2.5.39-ia64-top/include/asm-ia64/topology.h Sat Oct 5 19:22:33 2002 @@ -0,0 +1,66 @@ +/* + * linux/include/asm-ia64/topology.h + * + * Copyright (C) 2002, Erich Focht, NEC + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ +#ifndef _ASM_IA64_TOPOLOGY_H +#define _ASM_IA64_TOPOLOGY_H + +#include +#include + +/* Returns the number of the node containing CPU 'cpu' */ +#define __cpu_to_node(cpu) cpu_to_node_map[cpu] + +/* + * Returns the number of the node containing MemBlk 'memblk' + */ +#ifdef CONFIG_ACPI_NUMA +#define __memblk_to_node(memblk) (node_memblk[memblk].nid) +#else +#define __memblk_to_node(memblk) (memblk) +#endif + +/* + * Returns the number of the node containing Node 'nid'. + * Not implemented here. Multi-level hierarchies detected with + * the help of node_distance(). + */ +#define __parent_node(nid) (nid) + +/* + * Returns the number of the first CPU on Node 'node'. + * Temporarily implemented with the help of pool arrays, so + * don't use it too early. + * Who needs this? + */ +/* #define __node_to_first_cpu(node) pool_cpus[pool_ptr[node]] */ + +/* + * Returns a bitmask of CPUs on Node 'node'. + */ +static inline unsigned long __node_to_cpu_mask(int node) +{ + int cpu; + unsigned long mask = 0UL; + + for(cpu=0; cpu