]> git.karo-electronics.de Git - karo-tx-uboot.git/commitdiff
powerpc/bootm: Flush ramdisk and device tree image when booting on MP
authorKumar Gala <galak@kernel.crashing.org>
Wed, 7 Dec 2011 04:42:58 +0000 (04:42 +0000)
committerWolfgang Denk <wd@denx.de>
Mon, 12 Dec 2011 07:17:52 +0000 (08:17 +0100)
We already flush the kernel image after we've loaded it to ensure
visiblity to the other cores.  We need to do the same thing for the
ramdisk and device tree images.  In AMP boot scenarios we might not be
HW cache coherent with the secondary core that we are loading and
setting the ramdisk and device tree up for.  Thus we need to ensure
we've flushed the regions of memory utilized by ramdisk and device tree
so the loadding and any modifications (from decompression or fdt updates)
are made visible to the secondary cores.

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
arch/powerpc/lib/bootm.c
common/image.c

index 8233f1fd7b572e843d14e32e06bb001d8c3feafc..efcfe84ad91729b5d850751eea7b6d4eb0575657 100644 (file)
@@ -174,6 +174,18 @@ void arch_lmb_reserve(struct lmb *lmb)
        return ;
 }
 
+static void boot_prep_linux(bootm_headers_t *images)
+{
+#ifdef CONFIG_MP
+       /*
+        * if we are MP make sure to flush the device tree so any changes are
+        * made visibile to all other cores.  In AMP boot scenarios the cores
+        * might not be HW cache coherent with each other.
+        */
+       flush_cache((unsigned long)images->ft_addr, images->ft_len);
+#endif
+}
+
 static int boot_cmdline_linux(bootm_headers_t *images)
 {
        ulong of_size = images->ft_len;
@@ -329,19 +341,17 @@ int do_bootm_linux(int flag, int argc, char * const argv[], bootm_headers_t *ima
                return 0;
        }
 
-       /*
-        * We do nothing & report success to retain compatiablity with older
-        * versions of u-boot in which this use to flush the dcache on MP
-        * systems
-        */
-       if (flag & BOOTM_STATE_OS_PREP)
+       if (flag & BOOTM_STATE_OS_PREP) {
+               boot_prep_linux(images);
                return 0;
+       }
 
        if (flag & BOOTM_STATE_OS_GO) {
                boot_jump_linux(images);
                return 0;
        }
 
+       boot_prep_linux(images);
        ret = boot_body_linux(images);
        if (ret)
                return ret;
index aacae5ac51aab01d3e10499c4e843971f1129000..77ca6e4705777aa77dca3040c77cede2d1b9b746 100644 (file)
@@ -1104,6 +1104,14 @@ int boot_ramdisk_high(struct lmb *lmb, ulong rd_data, ulong rd_len,
                        memmove_wd((void *)*initrd_start,
                                        (void *)rd_data, rd_len, CHUNKSZ);
 
+#ifdef CONFIG_MP
+                       /*
+                        * Ensure the image is flushed to memory to handle
+                        * AMP boot scenarios in which we might not be
+                        * HW cache coherent
+                        */
+                       flush_cache((unsigned long)*initrd_start, rd_len);
+#endif
                        puts("OK\n");
                }
        } else {