]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - init/main.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
[karo-tx-linux.git] / init / main.c
index 2df3f0617fdc89fe8377d5d76fb9214c1e8f79a8..833a67df1f7e06c121c4b9b982893592ca7219df 100644 (file)
@@ -359,6 +359,7 @@ static void __init smp_init(void)
 #endif
 
 static inline void setup_per_cpu_areas(void) { }
+static inline void setup_nr_cpu_ids(void) { }
 static inline void smp_prepare_cpus(unsigned int maxcpus) { }
 
 #else
@@ -368,6 +369,21 @@ cpumask_t cpu_mask_all __read_mostly = CPU_MASK_ALL;
 EXPORT_SYMBOL(cpu_mask_all);
 #endif
 
+/* Setup number of possible processor ids */
+int nr_cpu_ids __read_mostly = NR_CPUS;
+EXPORT_SYMBOL(nr_cpu_ids);
+
+/* An arch may set nr_cpu_ids earlier if needed, so this would be redundant */
+static void __init setup_nr_cpu_ids(void)
+{
+       int cpu, highest_cpu = 0;
+
+       for_each_possible_cpu(cpu)
+               highest_cpu = cpu;
+
+       nr_cpu_ids = highest_cpu + 1;
+}
+
 #ifndef CONFIG_HAVE_SETUP_PER_CPU_AREA
 unsigned long __per_cpu_offset[NR_CPUS] __read_mostly;
 
@@ -542,6 +558,7 @@ asmlinkage void __init start_kernel(void)
        setup_command_line(command_line);
        unwind_setup();
        setup_per_cpu_areas();
+       setup_nr_cpu_ids();
        smp_prepare_boot_cpu(); /* arch-specific boot-cpu hooks */
 
        /*