Skip to contentSkip to conversation

block: Add SPL_BLOCK_CACHE and default n

PATCH New Adam Ford 2 participants 4 messages Jun 8, 2018 – Jun 9, 2018 Block layer

lore
Share & tools
lore

Adam Ford

author
#0 lore raw

PATCH 1/1 block: Add SPL_BLOCK_CACHE and default n

When enabling BLOCK_CACHE on devices with limited RAM during SPL, some devices may not boot. This creates an option to enable block caching in SPL by defaults off. It is dependant on BLOCK_CACHE and SPL_BLK

Fixes 46960ad6d09b ("block: Have BLOCK_CACHE default to y in some cases")
drivers/block/Kconfig +7 -0
index 0792373cfc..8ef363b3d4 100644
@@ -37,6 +37,13 @@ config BLOCK_CACHE
 	  it will prevent repeated reads from directory structures and other
 	  filesystem data structures.
 
+config SPL_BLOCK_CACHE
+	bool "Use block device cache in SPL"
+	depends on BLOCK_CACHE && SPL_BLK
+	default n
+	help
+	  This option enables the disk-block cache in SPL
+
 config IDE
 	bool "Support IDE controllers"
 	select HAVE_BLOCK_DEVICE
drivers/block/Makefile +5 -0
index 5fcafb193e..a9af28a552 100644
@@ -11,4 +11,9 @@ endif
 
 obj-$(CONFIG_IDE) += ide.o
 obj-$(CONFIG_SANDBOX) += sandbox.o
+ifdef CONFIG_SPL_BUILD
+obj-$(SPL_BLOCK_CACHE) += blkcache.o
+endif
+ifndef CONFIG_SPL_BUILD
 obj-$(CONFIG_BLOCK_CACHE) += blkcache.o
+endif
include/blk.h +2 -1
index fc0c239e46..c17c5eb047 100644
@@ -111,7 +111,8 @@ struct blk_desc {
 #define PAD_TO_BLOCKSIZE(size, blk_desc) \
 	(PAD_SIZE(size, blk_desc->blksz))
 
-#ifdef CONFIG_BLOCK_CACHE
+#if (defined(CONFIG_BLOCK_CACHE) && !defined(CONFIG_SPL_BUILD)) || \
+	 (defined(CONFIG_SPL_BLOCK_CACHE) && defined(CONFIG_SPL_BUILD))
 /**
  * blkcache_read() - attempt to read a set of blocks from cache
  *
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/1 block: Add SPL_BLOCK_CACHE and default n

Quoted 33 lines · Adam Ford

When enabling BLOCK_CACHE on devices with limited RAM during SPL, some devices may not boot. This creates an option to enable block caching in SPL by defaults off. It is dependant on BLOCK_CACHE and SPL_BLK

Fixes 46960ad6d09b ("block: Have BLOCK_CACHE default to y in some cases")
drivers/block/Kconfig +7 -0
index 0792373cfc..8ef363b3d4 100644
@@ -37,6 +37,13 @@ config BLOCK_CACHE
          it will prevent repeated reads from directory structures and other
          filesystem data structures.
 
+config SPL_BLOCK_CACHE
+       bool "Use block device cache in SPL"
+       depends on BLOCK_CACHE && SPL_BLK
+       default n
+       help
+         This option enables the disk-block cache in SPL
+
 config IDE
        bool "Support IDE controllers"
        select HAVE_BLOCK_DEVICE
drivers/block/Makefile +0 -0
index 5fcafb193e..a9af28a552 100644

drivers/block/Makefile endif · line 15

Quoted 5 lines
drivers/block/Makefile +2 -0
@@ -11,4 +11,9 @@ endif
 
 obj-$(CONFIG_IDE) += ide.o
 obj-$(CONFIG_SANDBOX) += sandbox.o
+ifdef CONFIG_SPL_BUILD
+obj-$(SPL_BLOCK_CACHE) += blkcache.o

CONFIG_SPL_BLOCK_CACHE?

drivers/block/Makefile endif · line 19

Quoted 4 lines
drivers/block/Makefile +3 -0
+endif
+ifndef CONFIG_SPL_BUILD
 obj-$(CONFIG_BLOCK_CACHE) += blkcache.o
+endif

Could this all get replaced by:

obj-$(CONFIG_$(SPL_)BLOCK_CACHE) += blkcache.o

include/blk.h struct blk_desc { · line 116

Quoted 12 lines
include/blk.h +2 -1
index fc0c239e46..c17c5eb047 100644
@@ -111,7 +111,8 @@ struct blk_desc {
 #define PAD_TO_BLOCKSIZE(size, blk_desc) \
        (PAD_SIZE(size, blk_desc->blksz))
 
-#ifdef CONFIG_BLOCK_CACHE
+#if (defined(CONFIG_BLOCK_CACHE) && !defined(CONFIG_SPL_BUILD)) || \
+        (defined(CONFIG_SPL_BLOCK_CACHE) && defined(CONFIG_SPL_BUILD))
 /**

Replace with CONFIG_IS_ENABLED?

Quoted 9 lines
include/blk.h +0 -1
  * blkcache_read() - attempt to read a set of blocks from cache
  *
--

2.17.1

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot

Signature · 1 line
Alex Kiernan
author
#2 lore raw

PATCH 1/1 block: Add SPL_BLOCK_CACHE and default n

Quoted 43 lines · Alex Kiernan
Quoted 33 lines · Adam Ford

When enabling BLOCK_CACHE on devices with limited RAM during SPL, some devices may not boot. This creates an option to enable block caching in SPL by defaults off. It is dependant on BLOCK_CACHE and SPL_BLK

Fixes 46960ad6d09b ("block: Have BLOCK_CACHE default to y in some cases")
drivers/block/Kconfig +7 -0
index 0792373cfc..8ef363b3d4 100644
@@ -37,6 +37,13 @@ config BLOCK_CACHE
          it will prevent repeated reads from directory structures and other
          filesystem data structures.
 
+config SPL_BLOCK_CACHE
+       bool "Use block device cache in SPL"
+       depends on BLOCK_CACHE && SPL_BLK
+       default n
+       help
+         This option enables the disk-block cache in SPL
+
 config IDE
        bool "Support IDE controllers"
        select HAVE_BLOCK_DEVICE
drivers/block/Makefile +0 -0
index 5fcafb193e..a9af28a552 100644

drivers/block/Makefile endif · line 15

Quoted 5 lines
drivers/block/Makefile +2 -0
@@ -11,4 +11,9 @@ endif
 
 obj-$(CONFIG_IDE) += ide.o
 obj-$(CONFIG_SANDBOX) += sandbox.o
+ifdef CONFIG_SPL_BUILD
+obj-$(SPL_BLOCK_CACHE) += blkcache.o

CONFIG_SPL_BLOCK_CACHE?

Quoted 9 lines

drivers/block/Makefile endif · line 19

Quoted 4 lines
drivers/block/Makefile +3 -0
+endif
+ifndef CONFIG_SPL_BUILD
 obj-$(CONFIG_BLOCK_CACHE) += blkcache.o
+endif

Could this all get replaced by:

obj-$(CONFIG_$(SPL_)BLOCK_CACHE) += blkcache.o

Nicely done. I am not that familiar with Makefiles and how to clean that up, but it seems to work work this way at least for the AM3517 EVM.

Quoted 8 lines
Quoted 8 lines
include/blk.h +0 -0
index fc0c239e46..c17c5eb047 100644
@@ -111,7 +111,8 @@ struct blk_desc {
 #define PAD_TO_BLOCKSIZE(size, blk_desc) \
        (PAD_SIZE(size, blk_desc->blksz))
 
Quoted 6 lines

include/blk.h struct blk_desc { · line 116

Quoted 4 lines
include/blk.h +2 -1
-#ifdef CONFIG_BLOCK_CACHE
+#if (defined(CONFIG_BLOCK_CACHE) && !defined(CONFIG_SPL_BUILD)) || \
+        (defined(CONFIG_SPL_BLOCK_CACHE) && defined(CONFIG_SPL_BUILD))
 /**

Replace with CONFIG_IS_ENABLED?

I tried replacing 'defined(x)' with 'CONFIG_IS_ENABLED(x)' and I got a bunch of build errors.
The only way I could get it to work was using 'defined(x)'

adam

Quoted 15 lines
Quoted 10 lines
include/blk.h +0 -1
  * blkcache_read() - attempt to read a set of blocks from cache
  *
--

2.17.1

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot

--
Alex Kiernan

#3 lore raw

PATCH 1/1 block: Add SPL_BLOCK_CACHE and default n

Quoted 73 lines · Adam Ford
Quoted 43 lines · Alex Kiernan
Quoted 33 lines · Adam Ford

When enabling BLOCK_CACHE on devices with limited RAM during SPL, some devices may not boot. This creates an option to enable block caching in SPL by defaults off. It is dependant on BLOCK_CACHE and SPL_BLK

Fixes 46960ad6d09b ("block: Have BLOCK_CACHE default to y in some cases")
drivers/block/Kconfig +7 -0
index 0792373cfc..8ef363b3d4 100644
@@ -37,6 +37,13 @@ config BLOCK_CACHE
          it will prevent repeated reads from directory structures and other
          filesystem data structures.
 
+config SPL_BLOCK_CACHE
+       bool "Use block device cache in SPL"
+       depends on BLOCK_CACHE && SPL_BLK
+       default n
+       help
+         This option enables the disk-block cache in SPL
+
 config IDE
        bool "Support IDE controllers"
        select HAVE_BLOCK_DEVICE
drivers/block/Makefile +0 -0
index 5fcafb193e..a9af28a552 100644

drivers/block/Makefile endif · line 15

Quoted 5 lines
drivers/block/Makefile +2 -0
@@ -11,4 +11,9 @@ endif
 
 obj-$(CONFIG_IDE) += ide.o
 obj-$(CONFIG_SANDBOX) += sandbox.o
+ifdef CONFIG_SPL_BUILD
+obj-$(SPL_BLOCK_CACHE) += blkcache.o

CONFIG_SPL_BLOCK_CACHE?

Quoted 9 lines

drivers/block/Makefile endif · line 19

Quoted 4 lines
drivers/block/Makefile +3 -0
+endif
+ifndef CONFIG_SPL_BUILD
 obj-$(CONFIG_BLOCK_CACHE) += blkcache.o
+endif

Could this all get replaced by:

obj-$(CONFIG_$(SPL_)BLOCK_CACHE) += blkcache.o

Nicely done. I am not that familiar with Makefiles and how to clean that up, but it seems to work work this way at least for the AM3517 EVM.

Quoted 8 lines
Quoted 8 lines
include/blk.h +0 -0
index fc0c239e46..c17c5eb047 100644
@@ -111,7 +111,8 @@ struct blk_desc {
 #define PAD_TO_BLOCKSIZE(size, blk_desc) \
        (PAD_SIZE(size, blk_desc->blksz))
 
Quoted 6 lines

include/blk.h struct blk_desc { · line 116

Quoted 4 lines
include/blk.h +2 -1
-#ifdef CONFIG_BLOCK_CACHE
+#if (defined(CONFIG_BLOCK_CACHE) && !defined(CONFIG_SPL_BUILD)) || \
+        (defined(CONFIG_SPL_BLOCK_CACHE) && defined(CONFIG_SPL_BUILD))
 /**

Replace with CONFIG_IS_ENABLED?

Quoted 4 lines

I tried replacing 'defined(x)' with 'CONFIG_IS_ENABLED(x)' and I got a bunch of build errors.
The only way I could get it to work was using 'defined(x)'

You need to drop the CONFIG_ off the front of the symbol, something like:

#if CONFIG_IS_ENABLED(BLK_CACHE)

Quoted 16 lines

adam

Quoted 15 lines
Quoted 10 lines
include/blk.h +0 -1
  * blkcache_read() - attempt to read a set of blocks from cache
  *
--

2.17.1

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot

--
Alex Kiernan

Signature · 1 line
Alex Kiernan