All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tom Rini <trini@ti.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/2] common.h: Introduce DEFINE_CACHE_ALIGN_BUFFER
Date: Mon, 23 Jul 2012 08:24:17 -0700	[thread overview]
Message-ID: <20120723152417.GA22955@bill-the-cat> (raw)
In-Reply-To: <201207211322.41728.vapier@gentoo.org>

On Sat, Jul 21, 2012 at 01:22:40PM -0400, Mike Frysinger wrote:
> On Friday 20 July 2012 17:50:33 Tom Rini wrote:
> > On 07/20/2012 02:47 PM, Mike Frysinger wrote:
> > > On Friday 20 July 2012 07:31:47 Marek Vasut wrote:
> > >> Dear Mike Frysinger,
> > >> 
> > >>> On Saturday 07 July 2012 23:08:14 Marek Vasut wrote:
> > >>>> +/* DEFINE_CACHE_ALIGN_BUFFER() is similar to
> > >>>> ALLOC_CACHE_ALIGN_BUFFER, but it's purpose is to allow
> > >>>> allocating aligned buffers outside of function scope.  Usage
> > >>>> of this macro shall be avoided or used with extreme care! */
> > >>>> +#define DEFINE_CACHE_ALIGN_BUFFER(type, name, size) +	static
> > >>>> char __##name[roundup(size * sizeof(type),
> > >>>> ARCH_DMA_MINALIGN)] +			__aligned(ARCH_DMA_MINALIGN); +
> > >>>> static type *name = (type *)__##name;
> > >>> 
> > >>> how is this any different from doing: static __u8 foo[1234]
> > >>> __aligned(ARCH_DMA_MINALIGN);
> > >> 
> > >> Does __aligned() align both start of the buffer downwards and end
> > >> of it upwards ?
> > > 
> > > it guarantees the start is aligned.  i don't believe it does any
> > > tail padding.
> > > 
> > > that said, you've added just 1 consumer, but it uses in function
> > > scope, so i don't see why you had to define a new helper in the
> > > first place.  the existing one would work fine shouldn't it ?
> > 
> > The rough outline of the problems are:
> > - We need to have buffers that are multiple of cache size, for clearing.
> > - Today we know ehci-hcd had a problem.  We also know other drivers /
> > layers have problems, but they aren't as readily breakable.
> > 
> > That's why we put the macro in <common.h> rather than a USB header.
> 
> that wasn't the question.  no one in the tree needs the new macro at all, 
> regardless of what header it lives in.  i guess the answer is that some code 
> in the future (which hasn't been merged) might use it.

Er, between drivers/usb/host/ehci-hcd.c and drivers/usb/eth/smsc95xx.c
the three new macros are used today.

-- 
Tom

      reply	other threads:[~2012-07-23 15:24 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-08  3:08 [U-Boot] [PATCH 1/2] common.h: Introduce DEFINE_CACHE_ALIGN_BUFFER Marek Vasut
2012-07-08  3:08 ` [U-Boot] [PATCH 2/2] ehci-hcd.c, musb_core, usb.h: Add USB_DMA_MINALIGN define for cache alignment Marek Vasut
2012-07-08 10:04   ` Ilya Yanok
2012-07-08 18:51     ` Marek Vasut
2012-07-08 20:52       ` Tom Rini
2012-07-08 21:36         ` Marek Vasut
2012-07-09 18:37   ` Ilya Yanok
2012-07-10  1:55     ` Marek Vasut
2012-07-14 22:11       ` Ilya Yanok
2012-07-14 22:08   ` Ilya Yanok
2012-07-15  8:07     ` Marek Vasut
2012-07-15  8:55       ` Ilya Yanok
2012-07-15  9:42         ` Marek Vasut
2012-07-08 12:23 ` [U-Boot] [PATCH 1/2] common.h: Introduce DEFINE_CACHE_ALIGN_BUFFER Ilya Yanok
2012-07-08 18:55   ` Marek Vasut
2012-07-20  4:01 ` Mike Frysinger
2012-07-20 11:31   ` Marek Vasut
2012-07-20 21:47     ` Mike Frysinger
2012-07-20 21:50       ` Tom Rini
2012-07-21 17:22         ` Mike Frysinger
2012-07-23 15:24           ` Tom Rini [this message]

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=20120723152417.GA22955@bill-the-cat \
    --to=trini@ti.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.