* [U-Boot] [PATCH] fat: Use cache aligned buffers for fat_opendir
@ 2017-11-24 8:54 Neil Armstrong
2017-11-24 9:04 ` Lukasz Majewski
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Neil Armstrong @ 2017-11-24 8:54 UTC (permalink / raw)
To: u-boot
Before this patch one could receive following errors when executing "fatls"
command on machine with cache enabled (ex i.MX6Q) :
=> fatls mmc 0:1
CACHE: Misaligned operation at range [4f59dfc8, 4f59e7c8]
CACHE: Misaligned operation at range [4f59dfc8, 4f59e7c8]
ERROR: v7_outer_cache_inval_range - start address is not aligned - 0x4f59dfc8
ERROR: v7_outer_cache_inval_range - stop address is not aligned - 0x4f59e7c8
CACHE: Misaligned operation at range [4f59dfc8, 4f59e7c8]
CACHE: Misaligned operation at range [4f59dfc8, 4f59e7c8]
ERROR: v7_outer_cache_inval_range - start address is not aligned - 0x4f59dfc8
ERROR: v7_outer_cache_inval_range - stop address is not aligned - 0x4f59e7c8
To alleviate this problem - the calloc()s have been replaced with
malloc_cache_aligned() and memset().
After those changes the buffers are properly aligned (with both start
address and size) to SoC cache line.
Fixes: 09fa964bba80 ("fs/fat: Fix 'CACHE: Misaligned operation at range' warnings")
Suggested-by: Lukasz Majewski <lukma@denx.de>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
---
fs/fat/fat.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/fs/fat/fat.c b/fs/fat/fat.c
index 7fe7843..d16883f 100644
--- a/fs/fat/fat.c
+++ b/fs/fat/fat.c
@@ -1149,11 +1149,13 @@ typedef struct {
int fat_opendir(const char *filename, struct fs_dir_stream **dirsp)
{
- fat_dir *dir = calloc(1, sizeof(*dir));
+ fat_dir *dir;
int ret;
+ dir = malloc_cache_aligned(sizeof(*dir));
if (!dir)
return -ENOMEM;
+ memset(dir, 0, sizeof(*dir));
ret = fat_itr_root(&dir->itr, &dir->fsdata);
if (ret)
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [U-Boot] [PATCH] fat: Use cache aligned buffers for fat_opendir
2017-11-24 8:54 [U-Boot] [PATCH] fat: Use cache aligned buffers for fat_opendir Neil Armstrong
@ 2017-11-24 9:04 ` Lukasz Majewski
2017-11-24 13:31 ` Fabio Estevam
2017-11-30 15:36 ` [U-Boot] " Tom Rini
2 siblings, 0 replies; 4+ messages in thread
From: Lukasz Majewski @ 2017-11-24 9:04 UTC (permalink / raw)
To: u-boot
On Fri, 24 Nov 2017 09:54:41 +0100
Neil Armstrong <narmstrong@baylibre.com> wrote:
> Before this patch one could receive following errors when executing
> "fatls" command on machine with cache enabled (ex i.MX6Q) :
>
> => fatls mmc 0:1
> CACHE: Misaligned operation at range [4f59dfc8, 4f59e7c8]
> CACHE: Misaligned operation at range [4f59dfc8, 4f59e7c8]
> ERROR: v7_outer_cache_inval_range - start address is not aligned -
> 0x4f59dfc8 ERROR: v7_outer_cache_inval_range - stop address is not
> aligned - 0x4f59e7c8 CACHE: Misaligned operation at range [4f59dfc8,
> 4f59e7c8] CACHE: Misaligned operation at range [4f59dfc8, 4f59e7c8]
> ERROR: v7_outer_cache_inval_range - start address is not aligned -
> 0x4f59dfc8 ERROR: v7_outer_cache_inval_range - stop address is not
> aligned - 0x4f59e7c8
>
> To alleviate this problem - the calloc()s have been replaced with
> malloc_cache_aligned() and memset().
>
> After those changes the buffers are properly aligned (with both start
> address and size) to SoC cache line.
>
> Fixes: 09fa964bba80 ("fs/fat: Fix 'CACHE: Misaligned operation at
> range' warnings") Suggested-by: Lukasz Majewski <lukma@denx.de>
> Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
> ---
> fs/fat/fat.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/fs/fat/fat.c b/fs/fat/fat.c
> index 7fe7843..d16883f 100644
> --- a/fs/fat/fat.c
> +++ b/fs/fat/fat.c
> @@ -1149,11 +1149,13 @@ typedef struct {
>
> int fat_opendir(const char *filename, struct fs_dir_stream **dirsp)
> {
> - fat_dir *dir = calloc(1, sizeof(*dir));
> + fat_dir *dir;
> int ret;
>
> + dir = malloc_cache_aligned(sizeof(*dir));
> if (!dir)
> return -ENOMEM;
> + memset(dir, 0, sizeof(*dir));
>
> ret = fat_itr_root(&dir->itr, &dir->fsdata);
> if (ret)
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20171124/1ea77cdb/attachment.sig>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [U-Boot] [PATCH] fat: Use cache aligned buffers for fat_opendir
2017-11-24 8:54 [U-Boot] [PATCH] fat: Use cache aligned buffers for fat_opendir Neil Armstrong
2017-11-24 9:04 ` Lukasz Majewski
@ 2017-11-24 13:31 ` Fabio Estevam
2017-11-30 15:36 ` [U-Boot] " Tom Rini
2 siblings, 0 replies; 4+ messages in thread
From: Fabio Estevam @ 2017-11-24 13:31 UTC (permalink / raw)
To: u-boot
Hi Neil,
On Fri, Nov 24, 2017 at 6:54 AM, Neil Armstrong <narmstrong@baylibre.com> wrote:
> Before this patch one could receive following errors when executing "fatls"
> command on machine with cache enabled (ex i.MX6Q) :
>
> => fatls mmc 0:1
> CACHE: Misaligned operation at range [4f59dfc8, 4f59e7c8]
> CACHE: Misaligned operation at range [4f59dfc8, 4f59e7c8]
> ERROR: v7_outer_cache_inval_range - start address is not aligned - 0x4f59dfc8
> ERROR: v7_outer_cache_inval_range - stop address is not aligned - 0x4f59e7c8
> CACHE: Misaligned operation at range [4f59dfc8, 4f59e7c8]
> CACHE: Misaligned operation at range [4f59dfc8, 4f59e7c8]
> ERROR: v7_outer_cache_inval_range - start address is not aligned - 0x4f59dfc8
> ERROR: v7_outer_cache_inval_range - stop address is not aligned - 0x4f59e7c8
>
> To alleviate this problem - the calloc()s have been replaced with
> malloc_cache_aligned() and memset().
>
> After those changes the buffers are properly aligned (with both start
> address and size) to SoC cache line.
>
> Fixes: 09fa964bba80 ("fs/fat: Fix 'CACHE: Misaligned operation at range' warnings")
> Suggested-by: Lukasz Majewski <lukma@denx.de>
> Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Thanks for the fix:
Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [U-Boot] fat: Use cache aligned buffers for fat_opendir
2017-11-24 8:54 [U-Boot] [PATCH] fat: Use cache aligned buffers for fat_opendir Neil Armstrong
2017-11-24 9:04 ` Lukasz Majewski
2017-11-24 13:31 ` Fabio Estevam
@ 2017-11-30 15:36 ` Tom Rini
2 siblings, 0 replies; 4+ messages in thread
From: Tom Rini @ 2017-11-30 15:36 UTC (permalink / raw)
To: u-boot
On Fri, Nov 24, 2017 at 09:54:41AM +0100, Neil Armstrong wrote:
> Before this patch one could receive following errors when executing "fatls"
> command on machine with cache enabled (ex i.MX6Q) :
>
> => fatls mmc 0:1
> CACHE: Misaligned operation at range [4f59dfc8, 4f59e7c8]
> CACHE: Misaligned operation at range [4f59dfc8, 4f59e7c8]
> ERROR: v7_outer_cache_inval_range - start address is not aligned - 0x4f59dfc8
> ERROR: v7_outer_cache_inval_range - stop address is not aligned - 0x4f59e7c8
> CACHE: Misaligned operation at range [4f59dfc8, 4f59e7c8]
> CACHE: Misaligned operation at range [4f59dfc8, 4f59e7c8]
> ERROR: v7_outer_cache_inval_range - start address is not aligned - 0x4f59dfc8
> ERROR: v7_outer_cache_inval_range - stop address is not aligned - 0x4f59e7c8
>
> To alleviate this problem - the calloc()s have been replaced with
> malloc_cache_aligned() and memset().
>
> After those changes the buffers are properly aligned (with both start
> address and size) to SoC cache line.
>
> Fixes: 09fa964bba80 ("fs/fat: Fix 'CACHE: Misaligned operation at range' warnings")
> Suggested-by: Lukasz Majewski <lukma@denx.de>
> Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
> Reviewed-by: Lukasz Majewski <lukma@denx.de>
> Reviewed-by: Fabio Estevam <fabio.estevam@nxp.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: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20171130/057967d8/attachment.sig>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-11-30 15:36 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-24 8:54 [U-Boot] [PATCH] fat: Use cache aligned buffers for fat_opendir Neil Armstrong
2017-11-24 9:04 ` Lukasz Majewski
2017-11-24 13:31 ` Fabio Estevam
2017-11-30 15:36 ` [U-Boot] " Tom Rini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox