powerpc/bootm: Flush ramdisk and device tree image when booting on MP
PATCH 1/1 powerpc/bootm: Flush ramdisk and device tree image when booting on MP
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.
--- arch/powerpc/lib/bootm.c | 22 ++++++++++++++++------ common/image.c | 8 ++++++++ 2 files changed, 24 insertions(+), 6 deletions(-)
arch/powerpc/lib/bootm.c +16 -6
@@ -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 *imareturn 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;
common/image.c +8 -0
@@ -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 {
Signature · 1 line
1.7.3.4
PATCH 1/1 powerpc/bootm: Flush ramdisk and device tree image when booting on MP
Quoted 11 lines · Kumar Gala
+ ? ? ? 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);
Why are we calling boot_prep_linux(images) when "flag & BOOTM_STATE_OS_PREP" is zero? If we don't want the OS to be PREPped, then why call a function named boot_prep_linux()?
Signature · 2 lines
Timur Tabi Linux kernel developer at Freescale
PATCH 1/1 powerpc/bootm: Flush ramdisk and device tree image when booting on MP
Quoted 12 lines · On Dec 7, 2011, at 10:17 AM, Tabi Timur-B04825 wrote:
Quoted 10 lines · Kumar Gala
arch/powerpc/lib/bootm.c +3
-0+if (flag &BOOTM_STATE_OS_PREP ) { +boot_prep_linux (images);return 0 ; + }if (flag &BOOTM_STATE_OS_GO ) {boot_jump_linux (images);return 0 ; }
Quoted 5 lines
Quoted 1 line
+
boot_prep_linux(images);Why are we calling
boot_prep_linux(images)when "flag &BOOTM_STATE_OS_PREP" is zero? If we don't want the OS to be PREPped, then why call a function namedboot_prep_linux()?
We call it in both cases, one is for 'normal' bootm command the other is for 'bootm subcommand'.
- k
Wolfgang Denk
AppliedPATCH 1/1 powerpc/bootm: Flush ramdisk and device tree image when booting on MP
In reply to Kumar GalaDear Kumar Gala,
Quoted 9 lines · In message <[email protected]> you…
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.
Quoted 5 lines
Signed-off-by Kumar Gala <[email protected]>--- arch/powerpc/lib/bootm.c | 22 ++++++++++++++++------ common/image.c | 8 ++++++++ 2 files changed, 24 insertions(+), 6 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk
Signature · 6 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Good morning. This is the telephone company. Due to repairs, we're giving you advance notice that your service will be cut off indefi- nitely at ten o'clock. That's two minutes from now.