]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
gunzip: cache-align write buffer memory
authorClemens Gruber <clemens.gruber@pqgruber.com>
Mon, 29 Aug 2016 15:10:36 +0000 (17:10 +0200)
committerTom Rini <trini@konsulko.com>
Fri, 7 Oct 2016 00:57:33 +0000 (20:57 -0400)
When using gzwrite to eMMC on an i.MX6Q board, the following warning
occurs repeatedly:
CACHE: Misaligned operation at range [4fd633184fe63318]

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>
lib/gunzip.c

index bc746d655e60aebc84c207c634728b3f1a4e1e40..832b3064e7614bc7c74159ca04f62b3122420356 100644 (file)
@@ -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 {