powerpc/rtas: don't online CPUs for partition suspend
[linux-2.6-microblaze.git] / arch / powerpc / kernel / rtas.c
index a09eba0..806d554 100644 (file)
@@ -843,96 +843,6 @@ static void rtas_percpu_suspend_me(void *info)
        __rtas_suspend_cpu((struct rtas_suspend_me_data *)info, 1);
 }
 
-enum rtas_cpu_state {
-       DOWN,
-       UP,
-};
-
-#ifndef CONFIG_SMP
-static int rtas_cpu_state_change_mask(enum rtas_cpu_state state,
-                               cpumask_var_t cpus)
-{
-       if (!cpumask_empty(cpus)) {
-               cpumask_clear(cpus);
-               return -EINVAL;
-       } else
-               return 0;
-}
-#else
-/* On return cpumask will be altered to indicate CPUs changed.
- * CPUs with states changed will be set in the mask,
- * CPUs with status unchanged will be unset in the mask. */
-static int rtas_cpu_state_change_mask(enum rtas_cpu_state state,
-                               cpumask_var_t cpus)
-{
-       int cpu;
-       int cpuret = 0;
-       int ret = 0;
-
-       if (cpumask_empty(cpus))
-               return 0;
-
-       for_each_cpu(cpu, cpus) {
-               struct device *dev = get_cpu_device(cpu);
-
-               switch (state) {
-               case DOWN:
-                       cpuret = device_offline(dev);
-                       break;
-               case UP:
-                       cpuret = device_online(dev);
-                       break;
-               }
-               if (cpuret < 0) {
-                       pr_debug("%s: cpu_%s for cpu#%d returned %d.\n",
-                                       __func__,
-                                       ((state == UP) ? "up" : "down"),
-                                       cpu, cpuret);
-                       if (!ret)
-                               ret = cpuret;
-                       if (state == UP) {
-                               /* clear bits for unchanged cpus, return */
-                               cpumask_shift_right(cpus, cpus, cpu);
-                               cpumask_shift_left(cpus, cpus, cpu);
-                               break;
-                       } else {
-                               /* clear bit for unchanged cpu, continue */
-                               cpumask_clear_cpu(cpu, cpus);
-                       }
-               }
-               cond_resched();
-       }
-
-       return ret;
-}
-#endif
-
-int rtas_online_cpus_mask(cpumask_var_t cpus)
-{
-       int ret;
-
-       ret = rtas_cpu_state_change_mask(UP, cpus);
-
-       if (ret) {
-               cpumask_var_t tmp_mask;
-
-               if (!alloc_cpumask_var(&tmp_mask, GFP_KERNEL))
-                       return ret;
-
-               /* Use tmp_mask to preserve cpus mask from first failure */
-               cpumask_copy(tmp_mask, cpus);
-               rtas_offline_cpus_mask(tmp_mask);
-               free_cpumask_var(tmp_mask);
-       }
-
-       return ret;
-}
-
-int rtas_offline_cpus_mask(cpumask_var_t cpus)
-{
-       return rtas_cpu_state_change_mask(DOWN, cpus);
-}
-
 int rtas_ibm_suspend_me(u64 handle)
 {
        long state;
@@ -940,8 +850,6 @@ int rtas_ibm_suspend_me(u64 handle)
        unsigned long retbuf[PLPAR_HCALL_BUFSIZE];
        struct rtas_suspend_me_data data;
        DECLARE_COMPLETION_ONSTACK(done);
-       cpumask_var_t offline_mask;
-       int cpuret;
 
        if (!rtas_service_present("ibm,suspend-me"))
                return -ENOSYS;
@@ -962,9 +870,6 @@ int rtas_ibm_suspend_me(u64 handle)
                return -EIO;
        }
 
-       if (!alloc_cpumask_var(&offline_mask, GFP_KERNEL))
-               return -ENOMEM;
-
        atomic_set(&data.working, 0);
        atomic_set(&data.done, 0);
        atomic_set(&data.error, 0);
@@ -973,24 +878,8 @@ int rtas_ibm_suspend_me(u64 handle)
 
        lock_device_hotplug();
 
-       /* All present CPUs must be online */
-       cpumask_andnot(offline_mask, cpu_present_mask, cpu_online_mask);
-       cpuret = rtas_online_cpus_mask(offline_mask);
-       if (cpuret) {
-               pr_err("%s: Could not bring present CPUs online.\n", __func__);
-               atomic_set(&data.error, cpuret);
-               goto out;
-       }
-
        cpu_hotplug_disable();
 
-       /* Check if we raced with a CPU-Offline Operation */
-       if (!cpumask_equal(cpu_present_mask, cpu_online_mask)) {
-               pr_info("%s: Raced against a concurrent CPU-Offline\n", __func__);
-               atomic_set(&data.error, -EAGAIN);
-               goto out_hotplug_enable;
-       }
-
        /* Call function on all CPUs.  One of us will make the
         * rtas call
         */
@@ -1001,18 +890,11 @@ int rtas_ibm_suspend_me(u64 handle)
        if (atomic_read(&data.error) != 0)
                printk(KERN_ERR "Error doing global join\n");
 
-out_hotplug_enable:
-       cpu_hotplug_enable();
 
-       /* Take down CPUs not online prior to suspend */
-       cpuret = rtas_offline_cpus_mask(offline_mask);
-       if (cpuret)
-               pr_warn("%s: Could not restore CPUs to offline state.\n",
-                               __func__);
+       cpu_hotplug_enable();
 
-out:
        unlock_device_hotplug();
-       free_cpumask_var(offline_mask);
+
        return atomic_read(&data.error);
 }