All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] gunzip: cache-align write buffer memory
@ 2016-08-29 15:10 Clemens Gruber
  2016-08-29 15:30 ` Eric Nelson
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Clemens Gruber @ 2016-08-29 15:10 UTC (permalink / raw)
  To: u-boot

When using gzwrite to eMMC on an i.MX6Q board, the following warning
occurs repeatedly:
CACHE: Misaligned operation at range [4fd63318, 4fe63318]

This patch cache-aligns the memory allocation for the gzwrite writebuf,
therefore avoiding the misaligned dcache flush and the warning from
check_cache_range.

Signed-off-by: Clemens Gruber <clemens.gruber@pqgruber.com>
---
 lib/gunzip.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/gunzip.c b/lib/gunzip.c
index bc746d6..832b306 100644
--- a/lib/gunzip.c
+++ b/lib/gunzip.c
@@ -11,6 +11,7 @@
 #include <console.h>
 #include <image.h>
 #include <malloc.h>
+#include <memalign.h>
 #include <u-boot/zlib.h>
 #include <div64.h>
 
@@ -193,7 +194,7 @@ int gzwrite(unsigned char *src, int len,
 
 	s.next_in = src + i;
 	s.avail_in = payload_size+8;
-	writebuf = (unsigned char *)malloc(szwritebuf);
+	writebuf = (unsigned char *)malloc_cache_aligned(szwritebuf);
 
 	/* decompress until deflate stream ends or end of file */
 	do {
-- 
2.9.3

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

* [U-Boot] [PATCH] gunzip: cache-align write buffer memory
  2016-08-29 15:10 [U-Boot] [PATCH] gunzip: cache-align write buffer memory Clemens Gruber
@ 2016-08-29 15:30 ` Eric Nelson
  2016-08-29 20:43 ` Stefan Agner
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Eric Nelson @ 2016-08-29 15:30 UTC (permalink / raw)
  To: u-boot

Thanks Clemens,

On 08/29/2016 08:10 AM, Clemens Gruber wrote:
> When using gzwrite to eMMC on an i.MX6Q board, the following warning
> occurs repeatedly:
> CACHE: Misaligned operation at range [4fd63318, 4fe63318]
> 
> This patch cache-aligns the memory allocation for the gzwrite writebuf,
> therefore avoiding the misaligned dcache flush and the warning from
> check_cache_range.
> 
> Signed-off-by: Clemens Gruber <clemens.gruber@pqgruber.com>
> ---
>  lib/gunzip.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/gunzip.c b/lib/gunzip.c
> index bc746d6..832b306 100644
> --- a/lib/gunzip.c
> +++ b/lib/gunzip.c
> @@ -11,6 +11,7 @@
>  #include <console.h>
>  #include <image.h>
>  #include <malloc.h>
> +#include <memalign.h>
>  #include <u-boot/zlib.h>
>  #include <div64.h>
>  
> @@ -193,7 +194,7 @@ int gzwrite(unsigned char *src, int len,
>  
>  	s.next_in = src + i;
>  	s.avail_in = payload_size+8;
> -	writebuf = (unsigned char *)malloc(szwritebuf);
> +	writebuf = (unsigned char *)malloc_cache_aligned(szwritebuf);
>  
>  	/* decompress until deflate stream ends or end of file */
>  	do {
> 

Reviewed-by: Eric Nelson <eric@nelint.com>

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

* [U-Boot] [PATCH] gunzip: cache-align write buffer memory
  2016-08-29 15:10 [U-Boot] [PATCH] gunzip: cache-align write buffer memory Clemens Gruber
  2016-08-29 15:30 ` Eric Nelson
@ 2016-08-29 20:43 ` Stefan Agner
  2016-10-03 17:53 ` Clemens Gruber
  2016-10-08 17:04 ` [U-Boot] " Tom Rini
  3 siblings, 0 replies; 6+ messages in thread
From: Stefan Agner @ 2016-08-29 20:43 UTC (permalink / raw)
  To: u-boot

On 2016-08-29 08:10, Clemens Gruber wrote:
> When using gzwrite to eMMC on an i.MX6Q board, the following warning
> occurs repeatedly:
> CACHE: Misaligned operation at range [4fd63318, 4fe63318]
> 
> This patch cache-aligns the memory allocation for the gzwrite writebuf,
> therefore avoiding the misaligned dcache flush and the warning from
> check_cache_range.
> 
> Signed-off-by: Clemens Gruber <clemens.gruber@pqgruber.com>
> ---
>  lib/gunzip.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/gunzip.c b/lib/gunzip.c
> index bc746d6..832b306 100644
> --- a/lib/gunzip.c
> +++ b/lib/gunzip.c
> @@ -11,6 +11,7 @@
>  #include <console.h>
>  #include <image.h>
>  #include <malloc.h>
> +#include <memalign.h>
>  #include <u-boot/zlib.h>
>  #include <div64.h>
>  
> @@ -193,7 +194,7 @@ int gzwrite(unsigned char *src, int len,
>  
>  	s.next_in = src + i;
>  	s.avail_in = payload_size+8;
> -	writebuf = (unsigned char *)malloc(szwritebuf);
> +	writebuf = (unsigned char *)malloc_cache_aligned(szwritebuf);
>  
>  	/* decompress until deflate stream ends or end of file */
>  	do {

I wondered about the length of the buffer, but szwritebuf is forced to
be a multiple of the device block size, which is typically quite a bit
bigger than a cache line, so I think we are fine there.

Reviewed-by: Stefan Agner <stefan.agner@toradex.com>

--
Stefan

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

* [U-Boot] [PATCH] gunzip: cache-align write buffer memory
  2016-08-29 15:10 [U-Boot] [PATCH] gunzip: cache-align write buffer memory Clemens Gruber
  2016-08-29 15:30 ` Eric Nelson
  2016-08-29 20:43 ` Stefan Agner
@ 2016-10-03 17:53 ` Clemens Gruber
  2016-10-03 21:49   ` Simon Glass
  2016-10-08 17:04 ` [U-Boot] " Tom Rini
  3 siblings, 1 reply; 6+ messages in thread
From: Clemens Gruber @ 2016-10-03 17:53 UTC (permalink / raw)
  To: u-boot

On Mon, Aug 29, 2016 at 05:10:36PM +0200, Clemens Gruber wrote:
> When using gzwrite to eMMC on an i.MX6Q board, the following warning
> occurs repeatedly:
> CACHE: Misaligned operation at range [4fd63318, 4fe63318]
> 
> This patch cache-aligns the memory allocation for the gzwrite writebuf,
> therefore avoiding the misaligned dcache flush and the warning from
> check_cache_range.
> 
> Signed-off-by: Clemens Gruber <clemens.gruber@pqgruber.com>
> ---
>  lib/gunzip.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/gunzip.c b/lib/gunzip.c
> index bc746d6..832b306 100644
> --- a/lib/gunzip.c
> +++ b/lib/gunzip.c
> @@ -11,6 +11,7 @@
>  #include <console.h>
>  #include <image.h>
>  #include <malloc.h>
> +#include <memalign.h>
>  #include <u-boot/zlib.h>
>  #include <div64.h>
>  
> @@ -193,7 +194,7 @@ int gzwrite(unsigned char *src, int len,
>  
>  	s.next_in = src + i;
>  	s.avail_in = payload_size+8;
> -	writebuf = (unsigned char *)malloc(szwritebuf);
> +	writebuf = (unsigned char *)malloc_cache_aligned(szwritebuf);
>  
>  	/* decompress until deflate stream ends or end of file */
>  	do {
> -- 
> 2.9.3
> 

Hi,

are there any blockers for this patch to get merged?

Thanks,
Clemens

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

* [U-Boot] [PATCH] gunzip: cache-align write buffer memory
  2016-10-03 17:53 ` Clemens Gruber
@ 2016-10-03 21:49   ` Simon Glass
  0 siblings, 0 replies; 6+ messages in thread
From: Simon Glass @ 2016-10-03 21:49 UTC (permalink / raw)
  To: u-boot

+Tom

On 3 October 2016 at 11:53, Clemens Gruber <clemens.gruber@pqgruber.com> wrote:
>
> On Mon, Aug 29, 2016 at 05:10:36PM +0200, Clemens Gruber wrote:
> > When using gzwrite to eMMC on an i.MX6Q board, the following warning
> > occurs repeatedly:
> > CACHE: Misaligned operation at range [4fd63318, 4fe63318]
> >
> > This patch cache-aligns the memory allocation for the gzwrite writebuf,
> > therefore avoiding the misaligned dcache flush and the warning from
> > check_cache_range.
> >
> > Signed-off-by: Clemens Gruber <clemens.gruber@pqgruber.com>
> > ---
> >  lib/gunzip.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> >


[...]

>
>
> Hi,
>
> are there any blockers for this patch to get merged?
>
> Thanks,
> Clemens

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

* [U-Boot] gunzip: cache-align write buffer memory
  2016-08-29 15:10 [U-Boot] [PATCH] gunzip: cache-align write buffer memory Clemens Gruber
                   ` (2 preceding siblings ...)
  2016-10-03 17:53 ` Clemens Gruber
@ 2016-10-08 17:04 ` Tom Rini
  3 siblings, 0 replies; 6+ messages in thread
From: Tom Rini @ 2016-10-08 17:04 UTC (permalink / raw)
  To: u-boot

On Mon, Aug 29, 2016 at 05:10:36PM +0200, Clemens Gruber wrote:

> When using gzwrite to eMMC on an i.MX6Q board, the following warning
> occurs repeatedly:
> CACHE: Misaligned operation at range [4fd63318, 4fe63318]
> 
> This patch cache-aligns the memory allocation for the gzwrite writebuf,
> therefore avoiding the misaligned dcache flush and the warning from
> check_cache_range.
> 
> Signed-off-by: Clemens Gruber <clemens.gruber@pqgruber.com>
> Reviewed-by: Eric Nelson <eric@nelint.com>
> Reviewed-by: Stefan Agner <stefan.agner@toradex.com>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20161008/ac5ae44c/attachment.sig>

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

end of thread, other threads:[~2016-10-08 17:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-29 15:10 [U-Boot] [PATCH] gunzip: cache-align write buffer memory Clemens Gruber
2016-08-29 15:30 ` Eric Nelson
2016-08-29 20:43 ` Stefan Agner
2016-10-03 17:53 ` Clemens Gruber
2016-10-03 21:49   ` Simon Glass
2016-10-08 17:04 ` [U-Boot] " 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.