Skip to contentSkip to conversation

topology for ia64

PATCH New Erich Focht 1 participant 1 message Oct 5, 2002

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 topology for ia64

Hi David,

please find attached a first attempt to implement the topology.h macros/routines for IA64. We need this for the NUMA scheduler setup.

Thanks!
Best regards,
Erich

arch/ia64/kernel/acpi.c +1 -0
diff -urNp linux-2.5.39-ia64/arch/ia64/kernel/acpi.c linux-2.5.39-ia64-top/arch/ia64/kernel/acpi.c
@@ -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);
arch/ia64/kernel/smpboot.c +27 -0
diff -urNp linux-2.5.39-ia64/arch/ia64/kernel/smpboot.c linux-2.5.39-ia64-top/arch/ia64/kernel/smpboot.c
@@ -16,6 +16,7 @@
 
 #include <linux/config.h>
 
+#include <linux/acpi.h>
 #include <linux/bootmem.h>
 #include <linux/delay.h>
 #include <linux/init.h>
@@ -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<NR_CPUS; cpu++) {
+		if (!(phys_cpu_present_map & (1UL << cpu))) {
+			cpu_to_node_map[cpu] = -1;
+			continue;
+		}
+#ifdef CONFIG_ACPI_NUMA
+		for(i=0; i<NR_CPUS; i++)
+			if (cpu_physical_id(cpu) == node_cpuid[i].phys_id) {
+				cpu_to_node_map[cpu]=node_cpuid[i].nid;
+				break;
+			}
+#else
+		cpu_to_node_map[cpu] = 0;
+#endif
+	}
+}
+
 /*
  * Cycle through the APs sending Wakeup IPIs to boot each.
  */
include/asm-ia64/smp.h +2 -0
diff -urNp linux-2.5.39-ia64/include/asm-ia64/smp.h linux-2.5.39-ia64-top/include/asm-ia64/smp.h
@@ -13,6 +13,7 @@
 
 #ifdef CONFIG_SMP
 
+#include <linux/cache.h>
 #include <linux/init.h>
 #include <linux/threads.h>
 #include <linux/kernel.h>
@@ -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;
 
include/asm-ia64/topology.h +66 -0

66 lines not on this page · raw message