Merge tag 'powerpc-5.3-1' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc...
[sfrench/cifs-2.6.git] / arch / powerpc / platforms / pseries / mobility.c
index 0c48c8964783756aec523af865d88c633956eccc..fe812bebdf5e618261b6c4cec5dd809402697589 100644 (file)
@@ -6,6 +6,7 @@
  * Copyright (C) 2010 IBM Corporation
  */
 
+#include <linux/cpu.h>
 #include <linux/kernel.h>
 #include <linux/kobject.h>
 #include <linux/smp.h>
@@ -19,6 +20,7 @@
 #include <asm/machdep.h>
 #include <asm/rtas.h>
 #include "pseries.h"
+#include "../../kernel/cacheinfo.h"
 
 static struct kobject *mobility_kobj;
 
@@ -335,11 +337,28 @@ void post_mobility_fixup(void)
        if (rc)
                printk(KERN_ERR "Post-mobility activate-fw failed: %d\n", rc);
 
+       /*
+        * We don't want CPUs to go online/offline while the device
+        * tree is being updated.
+        */
+       cpus_read_lock();
+
+       /*
+        * It's common for the destination firmware to replace cache
+        * nodes.  Release all of the cacheinfo hierarchy's references
+        * before updating the device tree.
+        */
+       cacheinfo_teardown();
+
        rc = pseries_devicetree_update(MIGRATION_SCOPE);
        if (rc)
                printk(KERN_ERR "Post-mobility device tree update "
                        "failed: %d\n", rc);
 
+       cacheinfo_rebuild();
+
+       cpus_read_unlock();
+
        /* Possibly switch to a new RFI flush type */
        pseries_setup_rfi_flush();