common: add blkcache init
PATCH 1/1 common: add blkcache init
From: Angelo Durgehello <[email protected]>
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.
---
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(-)
common/board_r.c +3 -0
@@ -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, };
drivers/block/blkcache.c +8 -1
@@ -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)
include/blk.h +6 -0
@@ -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 *
Signature · 1 line
2.24.1
PATCH 1/1 common: add blkcache init
Thanks Angelo,
Quoted 66 lines · Angelo Dureghello
From: Angelo Durgehello <[email protected]>
On m68k,
block_cachelist is relocated, but next and prev list pointers are not adjusted to the relocated structlist_headaddress, so the first iteration over theblock_cachelist hangs.This patch initializes the
block_cachelist after relocation.Signed-off-by Angelo Durgehello <[email protected]>---
Changes for v2:
- callblkcache_initdirectly--- common/board_r.c | 3 +++ drivers/block/blkcache.c | 9 ++++++++- include/blk.h | 6 ++++++ 3 files changed, 17 insertions(+), 1 deletion(-)common/board_r.c +3
-0@@ -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, };drivers/block/blkcache.c +8
-1@@ -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)include/blk.h +0
-0@@ -113,6 +113,12 @@ struct blk_desc { (PAD_SIZE (size, blk_desc->blksz))
include/blk.h struct blk_desc { · line 124
Quoted 10 lines
include/blk.h +6
-0#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 *
This looks good to me.
PATCH 1/1 common: add blkcache init
In reply to Angelo DureghelloQuoted 10 lines · Angelo Dureghello
From: Angelo Durgehello <[email protected]>
On m68k,
block_cachelist is relocated, but next and prev list pointers are not adjusted to the relocated structlist_headaddress, so the first iteration over theblock_cachelist hangs.This patch initializes the
block_cachelist after relocation.Signed-off-by Angelo Durgehello <[email protected]>Reviewed-by Eric Nelson <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200125/1e0c95ae/attachment.sig>
PATCH 1/1 common: add blkcache init
In reply to Angelo DureghelloHi Angelo
Quoted 67 lines · Angelo Dureghello
From: Angelo Durgehello <[email protected]>
On m68k,
block_cachelist is relocated, but next and prev list pointers are not adjusted to the relocated structlist_headaddress, so the first iteration over theblock_cachelist hangs.This patch initializes the
block_cachelist after relocation.Signed-off-by Angelo Durgehello <[email protected]>Reviewed-by Eric Nelson <[email protected]>---
Changes for v2:
- callblkcache_initdirectly--- common/board_r.c | 3 +++ drivers/block/blkcache.c | 9 ++++++++- include/blk.h | 6 ++++++ 3 files changed, 17 insertions(+), 1 deletion(-)common/board_r.c +3
-0@@ -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, };drivers/block/blkcache.c +8
-1@@ -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,drivers/block/blkcache.c +0
-0unsigned long blksz)include/blk.h +0
-0@@ -113,6 +113,12 @@ struct blk_desc { (PAD_SIZE (size, blk_desc->blksz))
include/blk.h struct blk_desc { · line 124
Quoted 10 lines
include/blk.h +6
-0#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
PATCH 1/1 common: add blkcache init
Hi Marcel,
thanks for reporting,
the fix should be already in master, please let me know if it works on your hardware.
Regards,
Angleo
Quoted 130 lines · Marcel Ziswiler
Hi Angelo
Quoted 67 lines · Angelo Dureghello
From: Angelo Durgehello <[email protected]>
On m68k,
block_cachelist is relocated, but next and prev list pointers are not adjusted to the relocated structlist_headaddress, so the first iteration over theblock_cachelist hangs.This patch initializes the
block_cachelist after relocation.Signed-off-by Angelo Durgehello <[email protected]>Reviewed-by Eric Nelson <[email protected]>---
Changes for v2:
- callblkcache_initdirectly--- common/board_r.c | 3 +++ drivers/block/blkcache.c | 9 ++++++++- include/blk.h | 6 ++++++ 3 files changed, 17 insertions(+), 1 deletion(-)common/board_r.c +3
-0@@ -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, };drivers/block/blkcache.c +8
-1@@ -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)
include/blk.h +0
-0@@ -113,6 +113,12 @@ struct blk_desc { (PAD_SIZE (size, blk_desc->blksz))include/blk.h struct blk_desc { · line 124
Quoted 10 lines
include/blk.h +6
-0#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 MMC1NOTICE: 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 initU-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: 1Loading Environment from MMC... "Synchronous Abort" handler, esr
0x96000004
elr:0000000040226de8lr :000000004021e99c(reloc)
elr:00000000bff7fde8lr :00000000bff7799c
x0 :0000000002000f00x1 : 0000000000000000
x2 :00000000fffffffbx3 : 0000000000000020
x4 : 0000000000000000 x5 : 0000000000000030
x6 : 0000000000000002 x7 :00000000bdf4ecf0
x8 : 0000000000000000 x9 : 0000000000000008
x10:00000000ffffffe0x11: 0000000000000006
x12:000000000001869fx13: 0000000000005339
x14: 0000000000006694 x15:00000000ffffffff
x16: 0000000000002080 x17: 0000000000004180
x18:00000000bdf58d70x19:01e0000002000f00
x20:00000000bffec258x21:00000000bffcca10
x22:01e0000002000f00x23: 0000000000000006
x24: 0000000000000000 x25: 0000000000000000
x26: 0000000000000000 x27: 0000000000000000
x28: 0000000000000000 x29:00000000bdf4edc0Code: b9400aa0 51000400 b9000aa0 aa1603f3 (f94002d6)Resetting CPU ...
resetting ...
Reverting just this patch makes it boot fine again.
Cheers
Marcel
Signature · 4 lines
Angelo Dureghello Timesys email: angelo.dureghello at timesys.com cell.: +39 388 8550663
PATCH 1/1 common: add blkcache init
Hi Angelo
Quoted 6 lines · Angelo Dureghello
Hi Marcel,
thanks for reporting,
the fix should be already in master, please let me know if it works on
your hardware.
Yes, that works. Thanks!
Quoted 2 lines
Regards,
Angleo
Cheers
Marcel
Quoted 134 lines
Quoted 132 lines · Marcel Ziswiler
Hi Angelo
Quoted 69 lines · Angelo Dureghello
From: Angelo Durgehello <[email protected]>
On m68k,
block_cachelist is relocated, but next and prev list pointers are not adjusted to the relocated structlist_headaddress,
so the first iteration over theblock_cachelist hangs.This patch initializes the
block_cachelist after relocation.Signed-off-by Angelo Durgehello <[email protected]>Reviewed-by Eric Nelson <[email protected]>---
Changes for v2:
- callblkcache_initdirectly--- common/board_r.c | 3 +++ drivers/block/blkcache.c | 9 ++++++++- include/blk.h | 6 ++++++ 3 files changed, 17 insertions(+), 1 deletion(-)common/board_r.c +3
-0@@ -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, };drivers/block/blkcache.c +8
-1@@ -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_tblkcnt,
unsigned long blksz)include/blk.h +0
-0@@ -113,6 +113,12 @@ struct blk_desc { (PAD_SIZE (size, blk_desc->blksz))include/blk.h struct blk_desc { · line 124
Quoted 10 lines
include/blk.h +6
-0#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 MMC1NOTICE: 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 initU-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: 1Loading Environment from MMC... "Synchronous Abort" handler, esr
0x96000004
elr:0000000040226de8lr :000000004021e99c(reloc)
elr:00000000bff7fde8lr :00000000bff7799c
x0 :0000000002000f00x1 : 0000000000000000
x2 :00000000fffffffbx3 : 0000000000000020
x4 : 0000000000000000 x5 : 0000000000000030
x6 : 0000000000000002 x7 :00000000bdf4ecf0
x8 : 0000000000000000 x9 : 0000000000000008
x10:00000000ffffffe0x11: 0000000000000006
x12:000000000001869fx13: 0000000000005339
x14: 0000000000006694 x15:00000000ffffffff
x16: 0000000000002080 x17: 0000000000004180
x18:00000000bdf58d70x19:01e0000002000f00
x20:00000000bffec258x21:00000000bffcca10
x22:01e0000002000f00x23: 0000000000000006
x24: 0000000000000000 x25: 0000000000000000
x26: 0000000000000000 x27: 0000000000000000
x28: 0000000000000000 x29:00000000bdf4edc0Code: b9400aa0 51000400 b9000aa0 aa1603f3 (f94002d6)Resetting CPU ...
resetting ...
Reverting just this patch makes it boot fine again.
Cheers
Marcel