fat: Use cache aligned buffers for fat_opendir
PATCH 1/1 fat: Use cache aligned buffers for fat_opendir
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.
--- fs/fat/fat.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/fat/fat.c +3 -1
@@ -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)
Signature · 1 line
2.7.4
PATCH 1/1 fat: Use cache aligned buffers for fat_opendir
Quoted 36 lines · On Fri, 24 Nov 2017 09:54:41 +0100 Neil Armstrong <[email protected]>…
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 -0x4f59dfc8ERROR:v7_outer_cache_inval_range- stop address is not aligned -0x4f59e7c8CACHE: Misaligned operation at range [4f59dfc8,4f59e7c8] CACHE: Misaligned operation at range [4f59dfc8,4f59e7c8]
ERROR:v7_outer_cache_inval_range- start address is not aligned -0x4f59dfc8ERROR:v7_outer_cache_inval_range- stop address is not aligned -0x4f59e7c8To alleviate this problem - the calloc()s have been replaced with
malloc_cache_aligned()andmemset().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 atrange' warnings") Suggested-by: Lukasz Majewski <[email protected]>
Signed-off-by Neil Armstrong <[email protected]>--- fs/fat/fat.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)fs/fat/fat.c +0
-1@@ -1149,11 +1149,13 @@ typedef struct {int fat_opendir (const char *filename,struct fs_dir_stream **dirsp) { -fat_dir *dir =calloc (1 ,sizeof (*dir));
fs/fat/fat.c typedef struct { · line 1161
Quoted 10 lines
fs/fat/fat.c +3
-0+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)
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>
PATCH 1/1 fat: Use cache aligned buffers for fat_opendir
In reply to Neil ArmstrongHi Neil,
Quoted 16 lines · Neil Armstrong
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 -0x4f59e7c8To alleviate this problem - the calloc()s have been replaced with
malloc_cache_aligned()andmemset().
Quoted 6 lines
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 <[email protected]>Signed-off-by Neil Armstrong <[email protected]>
Thanks for the fix:
Quoted 16 lines · Neil Armstrong
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 -0x4f59e7c8To alleviate this problem - the calloc()s have been replaced with
malloc_cache_aligned()andmemset().
Quoted 8 lines
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 <[email protected]>Signed-off-by Neil Armstrong <[email protected]>Reviewed-by Lukasz Majewski <[email protected]>Reviewed-by Fabio Estevam <[email protected]>
Applied to u-boot/master, 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/20171130/057967d8/attachment.sig>