[U-Boot] [PATCH] dcache: Dcache line size aligned stack buffer allocation

Wolfgang Denk wd at denx.de
Thu Aug 25 11:34:00 CEST 2011


Dear Lukasz Majewski,

In message <1314261435-29789-1-git-send-email-l.majewski at samsung.com> you wrote:
> This commit is defining new include/cache.h file, which defines macro
> needed for cache aligned buffers.
> ALLOC_CACHE_ALIGN_BUFFER shall be used in functions, which are using
> stack allocated buffers for DMA transfers.
> 
> Signed-off-by: Lukasz Majewski <l.majewski at samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park at samsung.com>
> CC: Albert ARIBAUD <albert.u.boot at aribaud.net>
> ---
>  include/cache.h |   42 ++++++++++++++++++++++++++++++++++++++++++
>  1 files changed, 42 insertions(+), 0 deletions(-)
>  create mode 100644 include/cache.h

I don't think it makes sense to create a new header file just for this
macro.  Please add this to an existing header file instead; if no
better place is found even to common.h

> +#if defined(CONFIG_SYS_CACHELINE_SIZE) && !defined(CONFIG_SYS_DCACHE_OFF)

Please omit this #ifdef.

CONFIG_SYS_CACHELINE_SIZE is a mandatory #define, and it's OK that a
build breaks when it's missing.  On the other hand I don;t se why this
macro needs top be removed when the data cache is off.

> +#define ALIGN_ADDR(addr) ((void *)(((unsigned long) addr + \
> +				    CONFIG_SYS_CACHELINE_SIZE - 1)  \
> +				   & ~(CONFIG_SYS_CACHELINE_SIZE - 1)))
> +

This is not needed. common.h defines ALIGN() which should be
sufficient here.


Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
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
The use of Microsoft crippleware systems is a sin that  carries  with
it its own punishment.
         -- Tom Christiansen in <6bo3fr$pj8$5 at csnews.cs.colorado.edu>


More information about the U-Boot mailing list