
Hi Marcel,
thanks for reporting, the fix should be already in master, please let me know if it works on your hardware.
Regards, Angleo
On Mon, Jan 27, 2020 at 8:38 AM Marcel Ziswiler marcel.ziswiler@toradex.com wrote:
Hi Angelo
On Tue, 2020-01-21 at 10:37 +0100, Angelo Dureghello wrote:
From: Angelo Durgehello angelo.dureghello@timesys.com
On m68k, block_cache list is relocated, but next and prev list pointers are not adjusted to the relocated struct list_head address, so the first iteration over the block_cache list hangs.
This patch initializes the block_cache list after relocation.
Signed-off-by: Angelo Durgehello angelo.dureghello@timesys.com Reviewed-by: Eric Nelson eric@nelint.com
Changes for v2:
- call blkcache_init directly
common/board_r.c | 3 +++ drivers/block/blkcache.c | 9 ++++++++- include/blk.h | 6 ++++++ 3 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/common/board_r.c b/common/board_r.c index 8a0c1114e7..4f56c19fcc 100644 --- a/common/board_r.c +++ b/common/board_r.c @@ -864,6 +864,9 @@ static init_fnc_t init_sequence_r[] = { #endif #if defined(CONFIG_PRAM) initr_mem, +#endif +#ifdef CONFIG_BLOCK_CACHE
blkcache_init,
#endif run_main_loop, }; diff --git a/drivers/block/blkcache.c b/drivers/block/blkcache.c index 1fa64989d3..f603aa129d 100644 --- a/drivers/block/blkcache.c +++ b/drivers/block/blkcache.c @@ -21,13 +21,20 @@ struct block_cache_node { char *cache; };
-static LIST_HEAD(block_cache); +static struct list_head block_cache;
static struct block_cache_stats _stats = { .max_blocks_per_entry = 8, .max_entries = 32 };
+int blkcache_init(void) +{
INIT_LIST_HEAD(&block_cache);
return 0;
+}
static struct block_cache_node *cache_find(int iftype, int devnum, lbaint_t start, lbaint_t blkcnt, unsigned long blksz) diff --git a/include/blk.h b/include/blk.h index d0c033aece..65db69f5d9 100644 --- a/include/blk.h +++ b/include/blk.h @@ -113,6 +113,12 @@ struct blk_desc { (PAD_SIZE(size, blk_desc->blksz))
#if CONFIG_IS_ENABLED(BLOCK_CACHE)
+/**
- blkcache_init() - initialize the block cache list pointers
- */
+int blkcache_init(void);
/**
- blkcache_read() - attempt to read a set of blocks from cache
Unfortunately this one seems to break i.MX 8M Mini booting:
U-Boot SPL 2020.01-00179-g35ac4f216b (Jan 25 2020 - 23:36:35 +0100) Normal Boot Trying to boot from MMC1 NOTICE: Configuring TZASC380 NOTICE: RDC off NOTICE: BL31: v2.0(release):rel_imx_4.14.98_2.3.0-0-g09c5cc994-dirty NOTICE: BL31: Built : 01:11:41, Jan 25 2020 NOTICE: sip svc init
U-Boot 2020.01-00179-g35ac4f216b (Jan 25 2020 - 23:36:35 +0100)
CPU: Freescale i.MX8MMQ rev1.0 at 0 MHz Reset cause: POR DRAM: 2 GiB MMC: FSL_SDHC: 0, FSL_SDHC: 1 Loading Environment from MMC... "Synchronous Abort" handler, esr 0x96000004 elr: 0000000040226de8 lr : 000000004021e99c (reloc) elr: 00000000bff7fde8 lr : 00000000bff7799c x0 : 0000000002000f00 x1 : 0000000000000000 x2 : 00000000fffffffb x3 : 0000000000000020 x4 : 0000000000000000 x5 : 0000000000000030 x6 : 0000000000000002 x7 : 00000000bdf4ecf0 x8 : 0000000000000000 x9 : 0000000000000008 x10: 00000000ffffffe0 x11: 0000000000000006 x12: 000000000001869f x13: 0000000000005339 x14: 0000000000006694 x15: 00000000ffffffff x16: 0000000000002080 x17: 0000000000004180 x18: 00000000bdf58d70 x19: 01e0000002000f00 x20: 00000000bffec258 x21: 00000000bffcca10 x22: 01e0000002000f00 x23: 0000000000000006 x24: 0000000000000000 x25: 0000000000000000 x26: 0000000000000000 x27: 0000000000000000 x28: 0000000000000000 x29: 00000000bdf4edc0
Code: b9400aa0 51000400 b9000aa0 aa1603f3 (f94002d6) Resetting CPU ...
resetting ...
Reverting just this patch makes it boot fine again.
Cheers
Marcel