All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] block: Add SPL_BLOCK_CACHE and default n
@ 2018-06-08 20:48 Adam Ford
  2018-06-09 13:26 ` Alex Kiernan
  0 siblings, 1 reply; 7+ messages in thread
From: Adam Ford @ 2018-06-08 20:48 UTC (permalink / raw)
  To: u-boot

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")

Signed-off-by: Adam Ford <aford173@gmail.com>

diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig
index 0792373cfc..8ef363b3d4 100644
--- a/drivers/block/Kconfig
+++ b/drivers/block/Kconfig
@@ -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
diff --git a/drivers/block/Makefile b/drivers/block/Makefile
index 5fcafb193e..a9af28a552 100644
--- a/drivers/block/Makefile
+++ b/drivers/block/Makefile
@@ -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
diff --git a/include/blk.h b/include/blk.h
index fc0c239e46..c17c5eb047 100644
--- a/include/blk.h
+++ b/include/blk.h
@@ -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
  *
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [U-Boot] [PATCH] block: Add SPL_BLOCK_CACHE and default n
  2018-06-08 20:48 [U-Boot] [PATCH] block: Add SPL_BLOCK_CACHE and default n Adam Ford
@ 2018-06-09 13:26 ` Alex Kiernan
  2018-06-09 14:04   ` Adam Ford
  0 siblings, 1 reply; 7+ messages in thread
From: Alex Kiernan @ 2018-06-09 13:26 UTC (permalink / raw)
  To: u-boot

On Fri, Jun 8, 2018 at 9:48 PM Adam Ford <aford173@gmail.com> wrote:
>
> 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")
>
> Signed-off-by: Adam Ford <aford173@gmail.com>
>
> diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig
> index 0792373cfc..8ef363b3d4 100644
> --- a/drivers/block/Kconfig
> +++ b/drivers/block/Kconfig
> @@ -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
> diff --git a/drivers/block/Makefile b/drivers/block/Makefile
> index 5fcafb193e..a9af28a552 100644
> --- a/drivers/block/Makefile
> +++ b/drivers/block/Makefile
> @@ -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?

> +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

> diff --git a/include/blk.h b/include/blk.h
> index fc0c239e46..c17c5eb047 100644
> --- a/include/blk.h
> +++ b/include/blk.h
> @@ -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?

>   * 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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [U-Boot] [PATCH] block: Add SPL_BLOCK_CACHE and default n
  2018-06-09 13:26 ` Alex Kiernan
@ 2018-06-09 14:04   ` Adam Ford
  2018-06-09 20:12     ` Alex Kiernan
  0 siblings, 1 reply; 7+ messages in thread
From: Adam Ford @ 2018-06-09 14:04 UTC (permalink / raw)
  To: u-boot

On Sat, Jun 9, 2018 at 8:26 AM Alex Kiernan <alex.kiernan@gmail.com> wrote:
>
> On Fri, Jun 8, 2018 at 9:48 PM Adam Ford <aford173@gmail.com> wrote:
> >
> > 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")
> >
> > Signed-off-by: Adam Ford <aford173@gmail.com>
> >
> > diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig
> > index 0792373cfc..8ef363b3d4 100644
> > --- a/drivers/block/Kconfig
> > +++ b/drivers/block/Kconfig
> > @@ -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
> > diff --git a/drivers/block/Makefile b/drivers/block/Makefile
> > index 5fcafb193e..a9af28a552 100644
> > --- a/drivers/block/Makefile
> > +++ b/drivers/block/Makefile
> > @@ -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?
>
> > +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.

> > diff --git a/include/blk.h b/include/blk.h
> > index fc0c239e46..c17c5eb047 100644
> > --- a/include/blk.h
> > +++ b/include/blk.h
> > @@ -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?

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
>
> >   * 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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [U-Boot] [PATCH] block: Add SPL_BLOCK_CACHE and default n
  2018-06-09 14:04   ` Adam Ford
@ 2018-06-09 20:12     ` Alex Kiernan
  0 siblings, 0 replies; 7+ messages in thread
From: Alex Kiernan @ 2018-06-09 20:12 UTC (permalink / raw)
  To: u-boot

On Sat, Jun 9, 2018 at 3:04 PM Adam Ford <aford173@gmail.com> wrote:
>
> On Sat, Jun 9, 2018 at 8:26 AM Alex Kiernan <alex.kiernan@gmail.com> wrote:
> >
> > On Fri, Jun 8, 2018 at 9:48 PM Adam Ford <aford173@gmail.com> wrote:
> > >
> > > 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")
> > >
> > > Signed-off-by: Adam Ford <aford173@gmail.com>
> > >
> > > diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig
> > > index 0792373cfc..8ef363b3d4 100644
> > > --- a/drivers/block/Kconfig
> > > +++ b/drivers/block/Kconfig
> > > @@ -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
> > > diff --git a/drivers/block/Makefile b/drivers/block/Makefile
> > > index 5fcafb193e..a9af28a552 100644
> > > --- a/drivers/block/Makefile
> > > +++ b/drivers/block/Makefile
> > > @@ -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?
> >
> > > +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.
>
> > > diff --git a/include/blk.h b/include/blk.h
> > > index fc0c239e46..c17c5eb047 100644
> > > --- a/include/blk.h
> > > +++ b/include/blk.h
> > > @@ -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?
>
> 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)

> adam
> >
> > >   * 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



-- 
Alex Kiernan

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [U-Boot] [PATCH] block: Add SPL_BLOCK_CACHE and default n
  2018-06-09 22:55 Adam Ford
  2018-06-10 10:13 ` Alex Kiernan
@ 2018-06-10 11:20 ` Tom Rini
  1 sibling, 0 replies; 7+ messages in thread
From: Tom Rini @ 2018-06-10 11:20 UTC (permalink / raw)
  To: u-boot

On Sat, Jun 09, 2018 at 05:55:11PM -0500, Adam Ford wrote:

> 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")
> 
> Signed-off-by: Adam Ford <aford173@gmail.com>
> --
> 
> V2: Clean up macros and ifdefs
[snip]
> diff --git a/include/blk.h b/include/blk.h
> index fc0c239e46..bd90e39932 100644
> --- a/include/blk.h
> +++ b/include/blk.h
> @@ -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!

-- 
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>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [U-Boot] [PATCH] block: Add SPL_BLOCK_CACHE and default n
  2018-06-09 22:55 Adam Ford
@ 2018-06-10 10:13 ` Alex Kiernan
  2018-06-10 11:20 ` Tom Rini
  1 sibling, 0 replies; 7+ messages in thread
From: Alex Kiernan @ 2018-06-10 10:13 UTC (permalink / raw)
  To: u-boot

On Sat, Jun 9, 2018 at 11:55 PM Adam Ford <aford173@gmail.com> wrote:
>
> 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")
>
> Signed-off-by: Adam Ford <aford173@gmail.com>
> --
>
> V2: Clean up macros and ifdefs
>
> diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig
> index 0792373cfc..8ef363b3d4 100644
> --- a/drivers/block/Kconfig
> +++ b/drivers/block/Kconfig
> @@ -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

> +       default n
> +       help
> +         This option enables the disk-block cache in SPL
> +
>  config IDE
>         bool "Support IDE controllers"
>         select HAVE_BLOCK_DEVICE
> diff --git a/drivers/block/Makefile b/drivers/block/Makefile
> index 5fcafb193e..0e80ce9405 100644
> --- a/drivers/block/Makefile
> +++ b/drivers/block/Makefile
> @@ -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
> diff --git a/include/blk.h b/include/blk.h
> index fc0c239e46..bd90e39932 100644
> --- a/include/blk.h
> +++ b/include/blk.h
> @@ -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.

>  /**
>   * blkcache_read() - attempt to read a set of blocks from cache
>   *
> --
> 2.17.1
>


--
Alex Kiernan

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [U-Boot] [PATCH] block: Add SPL_BLOCK_CACHE and default n
@ 2018-06-09 22:55 Adam Ford
  2018-06-10 10:13 ` Alex Kiernan
  2018-06-10 11:20 ` Tom Rini
  0 siblings, 2 replies; 7+ messages in thread
From: Adam Ford @ 2018-06-09 22:55 UTC (permalink / raw)
  To: u-boot

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")

Signed-off-by: Adam Ford <aford173@gmail.com>
--

V2: Clean up macros and ifdefs

diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig
index 0792373cfc..8ef363b3d4 100644
--- a/drivers/block/Kconfig
+++ b/drivers/block/Kconfig
@@ -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
diff --git a/drivers/block/Makefile b/drivers/block/Makefile
index 5fcafb193e..0e80ce9405 100644
--- a/drivers/block/Makefile
+++ b/drivers/block/Makefile
@@ -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
diff --git a/include/blk.h b/include/blk.h
index fc0c239e46..bd90e39932 100644
--- a/include/blk.h
+++ b/include/blk.h
@@ -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
  *
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-06-10 11:20 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-08 20:48 [U-Boot] [PATCH] block: Add SPL_BLOCK_CACHE and default n Adam Ford
2018-06-09 13:26 ` Alex Kiernan
2018-06-09 14:04   ` Adam Ford
2018-06-09 20:12     ` Alex Kiernan
2018-06-09 22:55 Adam Ford
2018-06-10 10:13 ` Alex Kiernan
2018-06-10 11:20 ` Tom Rini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.