From: "Nuno Sá" <noname.nuno@gmail.com>
To: "David Lechner" <dlechner@baylibre.com>,
"Michael Hennerich" <michael.hennerich@analog.com>,
"Nuno Sá" <nuno.sa@analog.com>, "Mark Brown" <broonie@kernel.org>
Cc: linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/4] spi: axi-spi-engine: don't repeat mode config for offload
Date: Tue, 29 Apr 2025 16:40:03 +0100 [thread overview]
Message-ID: <a380702d474e9b1f361f7224e20e40bdfb8a810b.camel@gmail.com> (raw)
In-Reply-To: <f68231bc-6546-4eaf-a8b2-fc31add33a1f@baylibre.com>
On Tue, 2025-04-29 at 10:24 -0500, David Lechner wrote:
> On 4/29/25 4:08 AM, Nuno Sá wrote:
> > Hi David,
> >
> > The whole series LGTM but I do have a small concern (maybe an hypothetical
> > one)
> > in this one...
> >
> >
> > On Mon, 2025-04-28 at 15:58 -0500, David Lechner wrote:
>
>
> ...
>
> > > +
> > > + writel_relaxed(SPI_ENGINE_CMD_SYNC(0),
> > > + spi_engine->base + SPI_ENGINE_REG_CMD_FIFO);
> > > +
> > > + writel_relaxed(SPI_ENGINE_CMD_WRITE(SPI_ENGINE_CMD_REG_CONFIG,
> > > + priv->spi_mode_config),
> > > + spi_engine->base + SPI_ENGINE_REG_CMD_FIFO);
> > > +
> > > + writel_relaxed(SPI_ENGINE_CMD_SYNC(1),
> > > + spi_engine->base + SPI_ENGINE_REG_CMD_FIFO);
> > > +
> >
> > I would assume that SPI_ENGINE_CMD_SYNC(0) + SPI_ENGINE_CMD_SYNC(1) should
> > be
> > executed in order by the core? I think all this relaxed API's don't give any
> > guarantee about store completion so, in theory, we could have SYNC(0) after
> > SYNC(1). Even the full barrier variants don't guarantee this I believe [1].
> > There's ioremap_np() variant but likely not supported in many platforms.
> > Doing a
> > read() before SYNC(1) should be all we need to guarantee proper ordering
> > here.
> >
> > Or maybe this is all theoretical and not an issue on the platforms this
> > driver
> > is supported but meh, just raising the possibility.
> >
> >
> > [1]:
> > https://elixir.bootlin.com/linux/v6.12-rc6/source/Documentation/driver-api/device-io.rst#L299
> >
>
> The way I am reading this, relaxed isn't "no barriers", just "weaker
> barriers".
Yes, sometimes just compiler ones. Bad phrasing from me...
> Quoting from the linked doc:
>
> On architectures that require an expensive barrier for serializing
> against DMA, these “relaxed” versions of the MMIO accessors only
> serialize against each other, but contain a less expensive barrier
> operation.
>
> So that sounds like we should not have a problem to me. (And if there is a
> problem, then it would affect other parts of the driver, like when we load
> the fifos with tx data in a loop.)
Well that just ensures that they are issued by the order you wrote them but it
does not guarantee that they end up in the same order on the peripheral itself.
Anyways, likely not an issue on the arches we care and as you mentioned it,
there are other places of the driver where this could matter. So, I guess not
material for this series.
- Nuno Sá
next prev parent reply other threads:[~2025-04-29 15:40 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-28 20:58 [PATCH 0/4] spi: axi-spi-engine: offload instruction optimization David Lechner
2025-04-28 20:58 ` [PATCH 1/4] spi: axi-spi-engine: wait for completion in setup David Lechner
2025-04-28 20:58 ` [PATCH 2/4] spi: axi-spi-engine: don't repeat mode config for offload David Lechner
2025-04-29 9:08 ` Nuno Sá
2025-04-29 15:24 ` David Lechner
2025-04-29 15:40 ` Nuno Sá [this message]
2025-04-28 20:58 ` [PATCH 3/4] spi: axi-spi-engine: optimize bits_per_word " David Lechner
2025-04-28 20:58 ` [PATCH 4/4] spi: axi-spi-engine: omit SYNC from offload instructions David Lechner
2025-04-30 22:52 ` [PATCH 0/4] spi: axi-spi-engine: offload instruction optimization Mark Brown
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=a380702d474e9b1f361f7224e20e40bdfb8a810b.camel@gmail.com \
--to=noname.nuno@gmail.com \
--cc=broonie@kernel.org \
--cc=dlechner@baylibre.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=michael.hennerich@analog.com \
--cc=nuno.sa@analog.com \
/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).