Skip to contentSkip to conversation

block: Add SPL_BLOCK_CACHE and default n

PATCH Superseded Adam Ford 3 participants 3 messages Jun 9, 2018 – Jun 10, 2018 Block layer

v1 of 3 Superseded Latest is v3 →

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 dependent on BLOCK_CACHE and SPL_BLK

Fixes 46960ad6d09b ("block: Have BLOCK_CACHE default to y in some cases")

--

V2: Clean up macros and ifdefs

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 +1 -1
index 5fcafb193e..0e80ce9405 100644
@@ -11,4 +11,4 @@ endif
 
 obj-$(CONFIG_IDE) += ide.o
 obj-$(CONFIG_SANDBOX) += sandbox.o
-obj-$(CONFIG_BLOCK_CACHE) += blkcache.o
+obj-$(CONFIG_$(SPL_)BLOCK_CACHE) += blkcache.o
include/blk.h +2 -1
index fc0c239e46..bd90e39932 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 (CONFIG_IS_ENABLED(BLOCK_CACHE) && !CONFIG_IS_ENABLED(SPL_BUILD)) || \
+	 (CONFIG_IS_ENABLED(SPL_BLOCK_CACHE) && CONFIG_IS_ENABLED(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 18 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 dependent on BLOCK_CACHE and SPL_BLK

Fixes 46960ad6d09b ("block: Have BLOCK_CACHE default to y in some cases")

--

V2: Clean up macros and ifdefs

drivers/block/Kconfig +0 -0
index 0792373cfc..8ef363b3d4 100644

drivers/block/Kconfig config BLOCK_CACHE · line 42

Quoted 6 lines
drivers/block/Kconfig +3 -0
@@ -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

Seems like an odd dependency - to use the block cache in SPL, you also have to have block cache in full U-Boot? I'm guessing depends on SPL_BLK would be sufficient

Quoted 22 lines
drivers/block/Kconfig +4 -0
+       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 +1 -1
index 5fcafb193e..0e80ce9405 100644
@@ -11,4 +11,4 @@ endif
 
 obj-$(CONFIG_IDE) += ide.o
 obj-$(CONFIG_SANDBOX) += sandbox.o
-obj-$(CONFIG_BLOCK_CACHE) += blkcache.o
+obj-$(CONFIG_$(SPL_)BLOCK_CACHE) += blkcache.o
include/blk.h +0 -0
index fc0c239e46..bd90e39932 100644

include/blk.h struct blk_desc { · line 115

Quoted 6 lines
include/blk.h +2 -1
@@ -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 (CONFIG_IS_ENABLED(BLOCK_CACHE) && !CONFIG_IS_ENABLED(SPL_BUILD)) || \
+        (CONFIG_IS_ENABLED(SPL_BLOCK_CACHE) && CONFIG_IS_ENABLED(SPL_BUILD))

Assuming I read it right, you shouldn't need all the &&/|| gyrations, just:

#if CONFIG_IS_ENABLED(BLOCK_CACHE)

Should get you what you want.

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

2.17.1

--
Alex Kiernan

#2 lore raw

PATCH 1/1 block: Add SPL_BLOCK_CACHE and default n

In reply to Adam Ford
Quoted 11 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 dependent on BLOCK_CACHE and SPL_BLK

Fixes 46960ad6d09b ("block: Have BLOCK_CACHE default to y in some cases")

--

V2: Clean up macros and ifdefs

[snip]

Quoted 5 lines
include/blk.h +0 -0
index fc0c239e46..bd90e39932 100644

include/blk.h struct blk_desc { · line 118

Quoted 9 lines
include/blk.h +2 -1
@@ -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 (CONFIG_IS_ENABLED(BLOCK_CACHE) && !CONFIG_IS_ENABLED(SPL_BUILD)) || \
+	 (CONFIG_IS_ENABLED(SPL_BLOCK_CACHE) && CONFIG_IS_ENABLED(SPL_BUILD))
 /**
  * blkcache_read() - attempt to read a set of blocks from cache
  *

CONFIG_IS_ENABLED(FOO) has the logic for checking for SPL_FOO and SPL_BUILD and so forth. Thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180610/f7accc14/attachment.sig>