Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git] / arch / m32r / kernel / smpboot.c
index 6ac4f70..840b434 100644 (file)
  *             Martin J. Bligh :       Added support for multi-quad systems
  */
 
+#include <linux/module.h>
 #include <linux/config.h>
 #include <linux/init.h>
+#include <linux/kernel.h>
 #include <linux/mm.h>
 #include <linux/smp_lock.h>
 #include <linux/irq.h>
@@ -58,7 +60,6 @@
 #define Dprintk(x...)
 #endif
 
-extern int cpu_idle(void);
 extern cpumask_t cpu_initialized;
 
 /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
@@ -73,18 +74,19 @@ physid_mask_t phys_cpu_present_map;
 
 /* Bitmask of currently online CPUs */
 cpumask_t cpu_online_map;
+EXPORT_SYMBOL(cpu_online_map);
 
 cpumask_t cpu_bootout_map;
 cpumask_t cpu_bootin_map;
-cpumask_t cpu_callout_map;
 static cpumask_t cpu_callin_map;
+cpumask_t cpu_callout_map;
+EXPORT_SYMBOL(cpu_callout_map);
+cpumask_t cpu_possible_map = CPU_MASK_ALL;
+EXPORT_SYMBOL(cpu_possible_map);
 
 /* Per CPU bogomips and other parameters */
 struct cpuinfo_m32r cpu_data[NR_CPUS] __cacheline_aligned;
 
-/* Set when the idlers are all forked */
-int smp_threads_ready;
-
 static int cpucount;
 static cpumask_t smp_commenced_mask;
 
@@ -95,6 +97,7 @@ extern struct {
 
 /* which physical physical ID maps to which logical CPU number */
 static volatile int physid_2_cpu[NR_CPUS];
+#define physid_to_cpu(physid)  physid_2_cpu[physid]
 
 /* which logical CPU number maps to which physical ID */
 volatile int cpu_2_physid[NR_CPUS];
@@ -107,15 +110,12 @@ spinlock_t ipi_lock[NR_IPIS];
 
 static unsigned int calibration_result;
 
-unsigned long cache_decay_ticks = HZ / 100;
-
 /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
 /* Function Prototypes                                                       */
 /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
 
 void smp_prepare_boot_cpu(void);
 void smp_prepare_cpus(unsigned int);
-static void smp_tune_scheduling(void);
 static void init_ipi_lock(void);
 static void do_boot_cpu(int);
 int __cpu_up(unsigned int);
@@ -182,6 +182,9 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
        }
        for (phys_id = 0 ; phys_id < nr_cpu ; phys_id++)
                physid_set(phys_id, phys_cpu_present_map);
+#ifndef CONFIG_HOTPLUG_CPU
+       cpu_present_map = cpu_possible_map;
+#endif
 
        show_mp_info(nr_cpu);
 
@@ -191,7 +194,6 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
         * Setup boot CPU information
         */
        smp_store_cpu_info(0); /* Final full version of the data */
-       smp_tune_scheduling();
 
        /*
         * If SMP should be disabled, then really disable it!
@@ -235,11 +237,6 @@ smp_done:
        Dprintk("Boot done.\n");
 }
 
-static void __init smp_tune_scheduling(void)
-{
-       /* Nothing to do. */
-}
-
 /*
  * init_ipi_lock : Initialize IPI locks.
  */
@@ -248,7 +245,7 @@ static void __init init_ipi_lock(void)
        int ipi;
 
        for (ipi = 0 ; ipi < NR_IPIS ; ipi++)
-               ipi_lock[ipi] = SPIN_LOCK_UNLOCKED;
+               spin_lock_init(&ipi_lock[ipi]);
 }
 
 /*==========================================================================*
@@ -291,7 +288,7 @@ static void __init do_boot_cpu(int phys_id)
        /* So we see what's up   */
        printk("Booting processor %d/%d\n", phys_id, cpu_id);
        stack_start.spi = (void *)idle->thread.sp;
-       idle->thread_info->cpu = cpu_id;
+       task_thread_info(idle)->cpu = cpu_id;
 
        /*
         * Send Startup IPI
@@ -431,9 +428,10 @@ void __init smp_cpus_done(unsigned int max_cpus)
 int __init start_secondary(void *unused)
 {
        cpu_init();
+       preempt_disable();
        smp_callin();
        while (!cpu_isset(smp_processor_id(), smp_commenced_mask))
-               rep_nop();
+               cpu_relax();
 
        smp_online();
 
@@ -443,7 +441,8 @@ int __init start_secondary(void *unused)
         */
        local_flush_tlb_all();
 
-       return cpu_idle();
+       cpu_idle();
+       return 0;
 }
 
 /*==========================================================================*
@@ -482,7 +481,7 @@ static void __init smp_callin(void)
                /* Has the boot CPU finished it's STARTUP sequence ? */
                if (cpu_isset(cpu_id, cpu_callout_map))
                        break;
-               rep_nop();
+               cpu_relax();
        }
 
        if (!time_before(jiffies, timeout)) {
@@ -632,4 +631,3 @@ static void __init unmap_cpu_to_physid(int cpu_id, int phys_id)
        physid_2_cpu[phys_id] = -1;
        cpu_2_physid[cpu_id] = -1;
 }
-