public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Lukasz Majewski <l.majewski@samsung.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] mmc:dcache: Cache line size aligned internal MMC buffers
Date: Wed, 24 Aug 2011 12:07:44 +0200	[thread overview]
Message-ID: <20110824120744.097ba2c5@lmajewski.digital.local> (raw)
In-Reply-To: <201108232301.01270.vapier@gentoo.org>

Hi,

On Tue, 23 Aug 2011 23:00:59 -0400
Mike Frysinger <vapier@gentoo.org> wrote:

> On Tuesday, August 23, 2011 18:42:46 Wolfgang Denk wrote:
> > Mike Frysinger wrote:
> > > > 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?
> > > 
> > > isnt that what i already posted and you NAK-ed ? :)
> > > 
> > > DMA_DECLARE_BUFFER(...)
> > 
> > I just NAKed this specific implementation.
> 
> well, it's hard to come up with a "good" one without knowing the
> parameters to work within ;).  i'm not stuck on any particular
> implementation, i just want the helper to be simple to use and hard
> to screw up.
> 
> the trouble with doing something like:
> 	char foo[func_to_do_round(size)];
> is that "size" is not in # of bytes but is number of elements.  so
> the point of my (i dont deny) complicated cpp logic was so that the
> internal implementation took on more of the work leaving the user
> (which we all know can easily mess things up) with a very simple
> macro: DMA_DECLARE_BUFFER(<buffer type>, <variable name>, <num
> elements>); -mike

After reading dcache related threads I'd like to sum them up:

1. alloca() -> not acceptable to u-boot mainline by Wolfgang. I agree
that alloca is NOT the way to go.

2. malloc/memalign -> avoidable to use

3. Mike's DMA_DECLARE_BUFFER(<buffer type>, <variable name>,
<size in bytes>) 
solution looks OK for me, at least for the stack allocated data (e.g.
ext_csd).
However this proposed implementation has been NAK'ed by Wolfgang. 

I'm curious how this macro should look like? Is it only matter of code
reordering or other approach shall be found?

4. get_dcache_line_size() can be simply defined as 
#define get_dcache_line_size() CONFIG_SYS_CACHE_LINE_SIZE if we
_really_ want to save a few bytes. 
However, I think, that proposed get_dcache_line_size() implementation
( http://patchwork.ozlabs.org/patch/111048/ ) is more programmer
friendly (one don't need to exactly know the dcache line size on a
particular SoC). 


-- 
Best regards,

Lukasz Majewski

Samsung Poland R&D Center
Platform Group

  reply	other threads:[~2011-08-24 10:07 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-19  9:25 [U-Boot] [PATCH] mmc:dcache: Cache line size aligned internal MMC buffers Lukasz Majewski
2011-08-19 13:57 ` Mike Frysinger
2011-08-19 15:28   ` Lukasz Majewski
2011-08-19 15:35     ` Mike Frysinger
2011-08-22  7:29       ` Lukasz Majewski
2011-08-22 16:08         ` Mike Frysinger
2011-08-22 16:42           ` Anton Staaf
2011-08-22 16:52             ` Marek Vasut
2011-08-22 17:17             ` Mike Frysinger
2011-08-22 18:15               ` Anton Staaf
2011-08-22 18:31                 ` Mike Frysinger
2011-08-22 18:57                   ` Anton Staaf
2011-08-23  9:19                     ` Lukasz Majewski
2011-08-23 17:00                       ` Anton Staaf
2011-08-23 17:30                       ` Mike Frysinger
2011-08-23 18:12                         ` Anton Staaf
2011-08-23 18:35                           ` Mike Frysinger
2011-08-23 18:36                           ` Mike Frysinger
2011-08-23 18:46                             ` Anton Staaf
2011-08-23 20:12                           ` Wolfgang Denk
2011-08-23 20:27                             ` Anton Staaf
2011-08-23 20:37                               ` Mike Frysinger
2011-08-23 21:06                                 ` Anton Staaf
2011-08-23 21:32                                   ` Mike Frysinger
2011-08-23 21:09                                 ` Wolfgang Denk
2011-08-23 21:32                                   ` Mike Frysinger
2011-08-23 21:48                                     ` Anton Staaf
2011-08-24 16:16                                       ` Mike Frysinger
2011-08-23 22:42                                     ` Wolfgang Denk
2011-08-24  3:00                                       ` Mike Frysinger
2011-08-24 10:07                                         ` Lukasz Majewski [this message]
2011-08-24 13:25                                           ` Wolfgang Denk
2011-08-24 14:31                                             ` Lukasz Majewski
2011-08-24 16:20                                             ` Mike Frysinger
2011-08-24 17:27                                             ` Anton Staaf
2011-08-24 18:06                                               ` Mike Frysinger
2011-08-24 18:12                                               ` Wolfgang Denk
2011-08-24 18:25                                                 ` Anton Staaf
2011-08-24 19:04                                                   ` Wolfgang Denk
2011-08-24 20:12                                                     ` Anton Staaf
2011-08-24 19:18                                                   ` Lukasz Majewski
2011-08-24 20:13                                                     ` Anton Staaf
2011-08-29 20:12                                                       ` Anton Staaf
2011-08-29 20:35                                                         ` Wolfgang Denk
2011-08-29 21:08                                                           ` Anton Staaf
2011-08-29 20:47                                                         ` Scott Wood
2011-08-29 20:58                                                           ` Anton Staaf
2011-08-29 21:23                                                             ` Scott Wood
2011-08-29 21:54                                                               ` Anton Staaf
2011-08-29 22:03                                                                 ` Scott Wood
2011-08-29 22:49                                                                   ` Anton Staaf
2011-08-29 23:01                                                                     ` Scott Wood
2011-08-29 23:05                                                                       ` Anton Staaf
2011-08-23 20:35                             ` Mike Frysinger
2011-08-23  8:42           ` Lukasz Majewski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110824120744.097ba2c5@lmajewski.digital.local \
    --to=l.majewski@samsung.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox