diff mbox series

[v2,14/14] common/board_r: Move blkcache_init call earlier in the boot sequence

Message ID 20200710101907.11214-14-ovidiu.panait@windriver.com
State Accepted
Commit 276b6c943a9b8166666b808c64d8a1deefdccbb3
Headers show
Series [v2,01/14] Kconfig: Introduce CONFIG_SYS_HAS_SRAM | expand

Commit Message

Ovidiu Panait July 10, 2020, 10:19 a.m. UTC
blkcache_init manually relocates blkcache list pointers when
CONFIG_NEEDS_MANUAL_RELOC is enabled. However, it is called very late in
the boot sequence, which could be a problem if previous boot calls execute
blkcache operations with the non-relocated pointers. For example, mmc is
initialized earlier and might call blkcache_invalidate (in
mmc_select_hwpart()) when trying to load the environment from mmc via
env_load().

To fix this issue, move blkcache_init boot call earlier, before mmc gets
initialized.

Cc: Angelo Durgehello <angelo.dureghello at timesys.com>
Reviewed-by: Simon Glass <sjg at chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait at windriver.com>
---
v2 updates:
- add reviewed-by tag

 common/board_r.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Angelo Dureghello July 13, 2020, 5:23 p.m. UTC | #1
Hi Ovidiu and all,

>
> blkcache_init manually relocates blkcache list pointers when
> CONFIG_NEEDS_MANUAL_RELOC is enabled. However, it is called very late in
> the boot sequence, which could be a problem if previous boot calls execute
> blkcache operations with the non-relocated pointers. For example, mmc is
> initialized earlier and might call blkcache_invalidate (in
> mmc_select_hwpart()) when trying to load the environment from mmc via
> env_load().
>
> To fix this issue, move blkcache_init boot call earlier, before mmc gets
> initialized.

i tested this full 14/14 patch on ColdFire mcf5441x (m68k), it works for me.

Acked-by: Angelo Dureghello <angelo.dureghello at timesys.com>
Tested-by: Angelo Dureghello <angelo.dureghello at timesys.com>

Thanks !

Regards,
angelo
diff mbox series

Patch

diff --git a/common/board_r.c b/common/board_r.c
index 29d831d5eb..a3c26bb380 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -705,6 +705,9 @@  static init_fnc_t init_sequence_r[] = {
 	initr_watchdog,
 #endif
 	INIT_FUNC_WATCHDOG_RESET
+#if defined(CONFIG_NEEDS_MANUAL_RELOC) && defined(CONFIG_BLOCK_CACHE)
+	blkcache_init,
+#endif
 #ifdef CONFIG_NEEDS_MANUAL_RELOC
 	initr_manual_reloc_cmdtable,
 #endif
@@ -835,9 +838,6 @@  static init_fnc_t init_sequence_r[] = {
 #endif
 #if defined(CONFIG_PRAM)
 	initr_mem,
-#endif
-#if defined(CONFIG_NEEDS_MANUAL_RELOC) && defined(CONFIG_BLOCK_CACHE)
-	blkcache_init,
 #endif
 	run_main_loop,
 };