From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Russell King <rmk+lkml@arm.linux.org.uk>
Cc: linux-kernel@vger.kernel.org,
Andrew Morton <akpm@linux-foundation.org>,
rdreier@cisco.com, linux-scsi@vger.kernel.org,
davem@davemloft.net, james.bottomley@steeleye.com,
ralf@linux-mips.org
Subject: Re: [PATCH 1/2] DMA buffer alignment annotations
Date: Sat, 22 Dec 2007 08:25:41 +1100 [thread overview]
Message-ID: <1198272341.6737.12.camel@pasglop> (raw)
In-Reply-To: <20071221093905.GB31115@flint.arm.linux.org.uk>
On Fri, 2007-12-21 at 09:39 +0000, Russell King wrote:
> > +#ifndef ARCH_MIN_DMA_ALIGNMENT
> > +#define __dma_aligned
> > +#define __dma_buffer
> > +#else
> > +#define __dma_aligned __attribute__((aligned(ARCH_MIN_DMA_ALIGNMENT)))
> > +#define __dma_buffer __dma_buffer_line(__LINE__)
> > +#define __dma_buffer_line(line) __dma_aligned;\
> > + char __dma_pad_##line[0] __dma_aligned
>
> You introduce __dma_buffer_line() if ARCH_MIN_DMA_ALIGNMENT is set but
> not if it isn't...
Yup, it's not meant to be used outside of __dma_buffer...
.../...
> > +then dev->buffer will be safe for DMA on all architectures. On a
> > +cache-coherent architecture the members of dev will be aligned exactly
> > +as they would have been without __dma_buffer; on a non-cache-coherent
> > +architecture buffer and field2 will be aligned so that buffer does not
> > +share a cache line with any other data.
> > +
>
> ... but it's not described. What's the purpose of it, and why would it
> only be used on CPUs with ARCH_MIN_DMA_ALIGNMENT set?
Hrm, I'm not the best at writing exlanations, care to send a patch ? :-)
Cheers,
Ben
prev parent reply other threads:[~2007-12-21 21:28 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-12-21 2:30 [PATCH 1/2] DMA buffer alignment annotations Benjamin Herrenschmidt
2007-12-21 2:30 ` Benjamin Herrenschmidt
2007-12-21 9:39 ` Russell King
2007-12-21 16:58 ` Roland Dreier
2007-12-21 21:25 ` Benjamin Herrenschmidt [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=1198272341.6737.12.camel@pasglop \
--to=benh@kernel.crashing.org \
--cc=akpm@linux-foundation.org \
--cc=davem@davemloft.net \
--cc=james.bottomley@steeleye.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=ralf@linux-mips.org \
--cc=rdreier@cisco.com \
--cc=rmk+lkml@arm.linux.org.uk \
/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.