Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/roland...
[sfrench/cifs-2.6.git] / arch / s390 / kernel / smp.c
index 85222fee43611293bdd8271f760f030535ed286f..e10f4ca00499ede1690e0a650ee935a5b7f27c12 100644 (file)
@@ -65,6 +65,7 @@ extern char vmhalt_cmd[];
 extern char vmpoff_cmd[];
 
 extern void reipl(unsigned long devno);
+extern void reipl_diag(void);
 
 static void smp_ext_bitcall(int, ec_bit_sig);
 static void smp_ext_bitcall_others(ec_bit_sig);
@@ -262,7 +263,7 @@ static void do_machine_restart(void * __unused)
        int cpu;
        static atomic_t cpuid = ATOMIC_INIT(-1);
 
-       if (atomic_compare_and_swap(-1, smp_processor_id(), &cpuid))
+       if (atomic_cmpxchg(&cpuid, -1, smp_processor_id()) != -1)
                signal_processor(smp_processor_id(), sigp_stop);
 
        /* Wait for all other cpus to enter stopped state */
@@ -283,6 +284,8 @@ static void do_machine_restart(void * __unused)
         * interrupted by an external interrupt and s390irq
         * locks are always held disabled).
         */
+       reipl_diag();
+
        if (MACHINE_IS_VM)
                cpcmd ("IPL", NULL, 0, NULL);
        else
@@ -310,7 +313,7 @@ static void do_machine_halt(void * __unused)
 {
        static atomic_t cpuid = ATOMIC_INIT(-1);
 
-       if (atomic_compare_and_swap(-1, smp_processor_id(), &cpuid) == 0) {
+       if (atomic_cmpxchg(&cpuid, -1, smp_processor_id()) == -1) {
                smp_send_stop();
                if (MACHINE_IS_VM && strlen(vmhalt_cmd) > 0)
                        cpcmd(vmhalt_cmd, NULL, 0, NULL);
@@ -329,7 +332,7 @@ static void do_machine_power_off(void * __unused)
 {
        static atomic_t cpuid = ATOMIC_INIT(-1);
 
-       if (atomic_compare_and_swap(-1, smp_processor_id(), &cpuid) == 0) {
+       if (atomic_cmpxchg(&cpuid, -1, smp_processor_id()) == -1) {
                smp_send_stop();
                if (MACHINE_IS_VM && strlen(vmpoff_cmd) > 0)
                        cpcmd(vmpoff_cmd, NULL, 0, NULL);
@@ -399,7 +402,7 @@ static void smp_ext_bitcall_others(ec_bit_sig sig)
         }
 }
 
-#ifndef CONFIG_ARCH_S390X
+#ifndef CONFIG_64BIT
 /*
  * this function sends a 'purge tlb' signal to another CPU.
  */
@@ -413,7 +416,7 @@ void smp_ptlb_all(void)
         on_each_cpu(smp_ptlb_callback, NULL, 0, 1);
 }
 EXPORT_SYMBOL(smp_ptlb_all);
-#endif /* ! CONFIG_ARCH_S390X */
+#endif /* ! CONFIG_64BIT */
 
 /*
  * this function sends a 'reschedule' IPI to another CPU.
@@ -530,6 +533,7 @@ int __devinit start_secondary(void *cpuvoid)
 {
         /* Setup the cpu */
         cpu_init();
+       preempt_disable();
         /* init per CPU timer */
         init_cpu_timer();
 #ifdef CONFIG_VIRT_TIMER
@@ -779,7 +783,7 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
                if (stack == 0ULL)
                        panic("smp_boot_cpus failed to allocate memory\n");
                lowcore_ptr[i]->panic_stack = stack + (PAGE_SIZE);
-#ifndef __s390x__
+#ifndef CONFIG_64BIT
                if (MACHINE_HAS_IEEE) {
                        lowcore_ptr[i]->extended_save_area_addr =
                                (__u32) __get_free_pages(GFP_KERNEL,0);
@@ -789,7 +793,7 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
                }
 #endif
        }
-#ifndef __s390x__
+#ifndef CONFIG_64BIT
        if (MACHINE_HAS_IEEE)
                ctl_set_bit(14, 29); /* enable extended save area */
 #endif