Skip to contentSkip to conversation

Flush cache after the OS image is loaded into the memory.

PATCH New Kumar Gala 2 participants 2 messages Aug 31, 2011 – Sep 5, 2011 PowerPC

lore
Share & tools
lore

Kumar Gala

author
#0 lore raw

PATCH 1/1 Flush cache after the OS image is loaded into the memory.

From: Diana CRACIUN <[email protected]>

Since we are loading an executable image into memory we need flush it out of the cache to possible maintain coherence on CPUs with split instruction and data caches. We do this for other executable image loading command.

On PowerPC once we do this we no longer need to explicitly flush the dcache on multi-core systems in the BOOTM_STATE_OS_PREP phase. We now treat the BOOTM_STATE_OS_PREP as a no-op to maintain backwards compatibility with the bootm subcommand.

---
 arch/powerpc/lib/bootm.c |   20 ++++++--------------
 common/cmd_bootm.c       |    3 +++
 2 files changed, 9 insertions(+), 14 deletions(-)
arch/powerpc/lib/bootm.c +6 -14
index 1375474..8233f1f 100644
@@ -174,16 +174,6 @@ void arch_lmb_reserve(struct lmb *lmb)
 	return ;
 }
 
-static void boot_prep_linux(void)
-{
-#ifdef CONFIG_MP
-	/* if we are MP make sure to flush the dcache() to any changes are made
-	 * visibile to all other cores */
-	flush_dcache();
-#endif
-	return ;
-}
-
 static int boot_cmdline_linux(bootm_headers_t *images)
 {
 	ulong of_size = images->ft_len;
@@ -339,17 +329,19 @@ int do_bootm_linux(int flag, int argc, char * const argv[], bootm_headers_t *ima
 		return 0;
 	}
 
-	if (flag & BOOTM_STATE_OS_PREP) {
-		boot_prep_linux();
+	/*
+	 * 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)
 		return 0;
-	}
 
 	if (flag & BOOTM_STATE_OS_GO) {
 		boot_jump_linux(images);
 		return 0;
 	}
 
-	boot_prep_linux();
 	ret = boot_body_linux(images);
 	if (ret)
 		return ret;
common/cmd_bootm.c +3 -0
index 272d879..8909ee7 100644
@@ -432,6 +432,9 @@ static int bootm_load_os(image_info_t os, ulong *load_end, int boot_progress)
 		printf ("Unimplemented compression type %d\n", comp);
 		return BOOTM_ERR_UNIMPLEMENTED;
 	}
+
+	flush_cache(load, (*load_end - load) * sizeof(ulong));
+
 	puts ("OK\n");
 	debug ("   kernel loaded at 0x%08lx, end = 0x%08lx\n", load, *load_end);
 	if (boot_progress)
Signature · 1 line
1.7.3.4
#1 lore raw

PATCH 1/1 Flush cache after the OS image is loaded into the memory.

Dear Kumar Gala,

Quoted 12 lines · In message <[email protected]> you…

From: Diana CRACIUN <[email protected]>

Since we are loading an executable image into memory we need flush it out of the cache to possible maintain coherence on CPUs with split instruction and data caches. We do this for other executable image loading command.

On PowerPC once we do this we no longer need to explicitly flush the dcache on multi-core systems in the BOOTM_STATE_OS_PREP phase. We now treat the BOOTM_STATE_OS_PREP as a no-op to maintain backwards compatibility with the bootm subcommand.

Quoted 7 lines
---
 arch/powerpc/lib/bootm.c |   20 ++++++--------------
 common/cmd_bootm.c       |    3 +++
 2 files changed, 9 insertions(+), 14 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 5 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
Children are natural mimics who act like their parents despite  every
effort to teach them good manners.