[U-Boot] [PATCH] mmc:dcache: Cache line size aligned internal MMC buffers

Wolfgang Denk
2011-08-23T21:09:37Z

Dear Mike Frysinger,

In message <201108231637.05845.vapier@gentoo.org> you wrote:
>
> On Tuesday, August 23, 2011 16:27:26 Anton Staaf wrote:
> > So then, to guide our efforts, what is a more suitable solution?
> > Would you prefer we stick with the existing path of calling memalign
> > and passing it the cache size by directly calling
> > get_dcache_line_size? Or would you prefer something more like a
> > dma_buffer_malloc function that allocates on the heap a cache line
> > size aligned buffer and returns it?
>
> memalign() is simply a malloc() with offset fudging, so dma_buffer_malloc() is
> the way to go imo. anything that involves end code having to figure out how
> to align things itself is asking for pain.

I would like to avoid using any malloc code here. We have to keep in
mind that such code changes will spread, and will be copied into
driver code, file systems, etc. which might be used (and even
required, for example for NAND or SDCard booting systems) before
relocation - but malloc becomes available only after relocation.

Why cannot we define a macro that declares a (sufficiently sized)
buffer on the stack and provides and a pointer to a (correctly
aligned) address in this buffer?

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
There are three ways to get something done:
(1) Do it yourself.
(2) Hire someone to do it for you.
(3) Forbid your kids to do it.