From: radu.rendec@gmail.com
To: Wolfram Sang <wsa@the-dreams.de>,
Seth Heasley <seth.heasley@intel.com>,
Neil Horman <nhorman@tuxdriver.com>
Cc: linux-i2c@vger.kernel.org
Subject: Re: [PATCH 1/2] i2c: ismt: 16-byte align the DMA buffer address
Date: Tue, 29 Aug 2017 17:37:40 +0100 [thread overview]
Message-ID: <1504024660.4416.27.camel@gmail.com> (raw)
In-Reply-To: <20170827143755.zpb7l7kuk4hf2pjt@ninjato>
On Sun, 2017-08-27 at 16:37 +0200, Wolfram Sang wrote:
> Please use scripts/get_maintainers.pl as cc-cmd of git-send-email. This
> would have added Seth and Neil (driver maintainers) to CC automatically.
> I have done so now.
My bad; sorry about that and thanks for adding Seth and Neil.
> The IIO subsystems uses ____cacheline_aligned. I have never looked into
> this closely, but it probably is cleaner than working with ALIGN on an
> oversized buffer? Dunno why ____cacheline_aligned has four underscores
> at the beginning, though...
I haven't looked into that either; it seems that ____cacheline_aligned
is just __attribute__((__aligned__(SMP_CACHE_BYTES))) unless already
defined by the architecture (see include/linux/cache.h).
I believe using this on a (whole) structure only makes sense with
statically allocated structures and instructs the compiler to allocate
the structure at an aligned address. My guess is that it has no effect
on dynamically allocated structures (such as struct ismt_priv).
If you were thinking about using ____cacheline_aligned just on the
dma_buffer field, then it would align the field with respect to the
beginning of the structure (i.e. insert the required padding), but the
field would still be misaligned if the structure itself is misaligned.
> @@ -320,7 +320,7 @@ static int ismt_process_desc(const struct
> > ismt_desc *desc,
> > struct ismt_priv *priv, int size,
> > char read_write)
> > {
> > - u8 *dma_buffer = priv->dma_buffer;
> > + u8 *dma_buffer = (u8*)ALIGN((unsigned long)&priv->buffer[0], 16);
>
> The fixed value here might not work on all (future?) generations?
Good question. In theory this alignment should not be necessary at all.
There is no such requirement in the public datasheet, which is probably
why it was not implemented in the driver in the first place.
This is related to some hardware errata and the problem probably occurs
only with some specific hardware revisions. Hard to say what happens
with future generations. But at least it should not make any difference
to the other (existing) generations.
In any case, it's probably better to use a macro (e.g. #define
ISMT_DMA_ALIGN 16) rather than hardcoding the "16" value.
Radu
next prev parent reply other threads:[~2017-08-29 16:37 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-18 16:01 [PATCH 0/2] i2c: ismt: align the DMA buffer to avoid parity errors Radu Rendec
2017-08-18 16:01 ` [PATCH 1/2] i2c: ismt: 16-byte align the DMA buffer address Radu Rendec
2017-08-27 14:37 ` Wolfram Sang
2017-08-29 16:37 ` radu.rendec [this message]
2018-01-04 13:46 ` [1/2] " Neil Horman
2018-01-04 15:42 ` Radu Rendec
2018-01-04 16:22 ` Neil Horman
2018-01-04 17:01 ` Radu Rendec
2018-01-05 1:47 ` Neil Horman
2018-01-15 12:33 ` Radu Rendec
2018-01-15 18:53 ` Neil Horman
2018-01-15 19:02 ` Wolfram Sang
2018-01-15 19:53 ` Neil Horman
2017-08-18 16:01 ` [PATCH 2/2] i2c: ismt: dump registers at the end of transactions Radu Rendec
2018-01-04 13:52 ` [2/2] " Neil Horman
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=1504024660.4416.27.camel@gmail.com \
--to=radu.rendec@gmail.com \
--cc=linux-i2c@vger.kernel.org \
--cc=nhorman@tuxdriver.com \
--cc=seth.heasley@intel.com \
--cc=wsa@the-dreams.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;
as well as URLs for NNTP newsgroup(s).