From: Cosmin Tanislav <demonsingur@gmail.com>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Jonathan Cameron <jic23@kernel.org>,
Rob Herring <robh+dt@kernel.org>,
Linus Walleij <linus.walleij@linaro.org>,
linux-iio <linux-iio@vger.kernel.org>,
"open list:GPIO SUBSYSTEM" <linux-gpio@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
devicetree <devicetree@vger.kernel.org>,
Cosmin Tanislav <cosmin.tanislav@analog.com>
Subject: Re: [PATCH v5 2/2] iio: adc: ad4130: add AD4130 driver
Date: Thu, 23 Jun 2022 19:14:48 +0300 [thread overview]
Message-ID: <54bfff70-938f-16e1-198d-47ed9ba95db4@gmail.com> (raw)
In-Reply-To: <CAHp75Vc_fcAP6gGwMkYZUoMM6jKeUoQr8J+zYCUz8inSHnTF_w@mail.gmail.com>
On 6/23/22 18:39, Andy Shevchenko wrote:
> On Thu, Jun 23, 2022 at 5:27 PM Cosmin Tanislav <demonsingur@gmail.com> wrote:
>> On 6/20/22 21:29, Andy Shevchenko wrote:
>>> On Mon, Jun 20, 2022 at 6:27 PM Cosmin Tanislav <demonsingur@gmail.com> wrote:
>
> ...
>
>>>> + /*
>>>> + * DMA (thus cache coherency maintenance) requires the
>>>> + * transfer buffers to live in their own cache lines.
>>>> + */
>>>
>>> This is a good comment, but what fields does it apply to?
>>
>> Whatever is below it, grouped together. This is not hard to
>> understand.
>
> It's hard to understand what exactly is DMA-aware here. I see only one
> buffer that is aligned properly for DMA, the rest are not, except the
> case if all of them are going in one DMA transaction. Is this the case
> here?
>
>>>> + u8 reset_buf[AD4130_RESET_BUF_SIZE] __aligned(IIO_DMA_MINALIGN);
>
> This is aligned.
>
>>>> + u8 reg_write_tx_buf[4];
>
> This one is aligned + offset (== AD4130_RESET_BUF_SIZE + 0).
>
>>>> + u8 reg_read_tx_buf[1];
>
> This one is aligned + offset (== AD4130_RESET_BUF_SIZE + 0 + 4).
>
>>>> + u8 reg_read_rx_buf[3];
>
> This one is aligned + offset (== AD4130_RESET_BUF_SIZE + 0 + 4 + 1).
> And this is Rx.
>
>>>> + u8 fifo_tx_buf[2];
>
> Here is Tx again which is most likely is not aligned...
>
>>>> + u8 fifo_rx_buf[AD4130_FIFO_SIZE *
>>>> + AD4130_FIFO_MAX_SAMPLE_SIZE];
>>>> +};
>
This has been mentioned before by Jonathan as a reply to V6 of my
AD74413R driver.
> I'm surprised I didn't mention this before but you only need to
ensure > that any memory used for DMA is not in a cacheline with memory
used
> for other things that might change concurrently.
To my understanding, as long as the DMA buffers will all be accessed by
the same DMA-compatible SPI controller, you only need to align them so
they're not in the same cacheline with memory that will not be accessed
by the SPI controller.
next prev parent reply other threads:[~2022-06-23 16:14 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-20 16:20 [PATCH v5 0/2] AD4130 Cosmin Tanislav
2022-06-20 16:20 ` [PATCH v5 1/2] dt-bindings: iio: adc: add AD4130 Cosmin Tanislav
2022-06-28 13:47 ` Rob Herring
2022-06-28 14:30 ` Cosmin Tanislav
2022-06-20 16:20 ` [PATCH v5 2/2] iio: adc: ad4130: add AD4130 driver Cosmin Tanislav
2022-06-20 18:29 ` Andy Shevchenko
2022-06-23 15:27 ` Cosmin Tanislav
2022-06-23 15:39 ` Andy Shevchenko
2022-06-23 16:14 ` Cosmin Tanislav [this message]
2022-06-23 17:33 ` Andy Shevchenko
2022-06-25 13:32 ` Jonathan Cameron
2022-06-25 14:08 ` Jonathan Cameron
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=54bfff70-938f-16e1-198d-47ed9ba95db4@gmail.com \
--to=demonsingur@gmail.com \
--cc=andy.shevchenko@gmail.com \
--cc=cosmin.tanislav@analog.com \
--cc=devicetree@vger.kernel.org \
--cc=jic23@kernel.org \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=robh+dt@kernel.org \
/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).