From: "Arnd Bergmann" <arnd@arndb.de>
To: "Neil Armstrong" <narmstrong@baylibre.com>,
"Mark Brown" <broonie@kernel.org>
Cc: linux-spi@vger.kernel.org, linux-amlogic@lists.infradead.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] spi: meson-spicc: add support for DMA
Date: Wed, 14 Sep 2022 15:17:17 +0200 [thread overview]
Message-ID: <28501fbf-3508-4afe-804d-fa5a3ccd4291@www.fastmail.com> (raw)
In-Reply-To: <499f0940-3d7f-0ed5-e469-5c0979e6f761@baylibre.com>
On Wed, Sep 14, 2022, at 2:35 PM, Neil Armstrong wrote:
> On 14/09/2022 13:19, Arnd Bergmann wrote:
>> On Tue, Sep 13, 2022, at 4:03 PM, Neil Armstrong wrote:
>>
>>> + /* Sometimes, TC gets triggered while the RX fifo isn't fully flushed *
>>> + if (spicc->using_dma) {
>>> + unsigned int rxfifo_count = FIELD_GET(SPICC_RXCNT_MASK,
>>> + readl_relaxed(spicc->base + SPICC_TESTREG));
>>
>> Same here in the interrupt controller, I don't see anything enforcing
>> the DMA to actually complete before the readl_relaxed().
>
> I don't see the relathionship between a register relaxed read and the
> DMA not finishing
> writing the data in uncached memory, for me it's 2 unrelated things.
The race is between the readl_relaxed() and a subsequent access
to the data that is being transferred. On Arm processors you
need a "dmb(oshld)" instruction to ensure that the CPU cannot
prefetch data from the DMA buffer while it is waiting for the
MMIO to complete.
The __io_ar() in readl() exists specifically there for this race, and
this is the reason that readl_relaxed() exists for drivers that
do not do any DMA.
Note that this prefetching can happen for uncached memory, but
spe-meson-spicc uses cached memory.
Arnd
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
next prev parent reply other threads:[~2022-09-14 13:17 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-13 14:03 Neil Armstrong
2022-09-14 11:19 ` Arnd Bergmann
2022-09-14 12:35 ` Neil Armstrong
2022-09-14 13:17 ` Arnd Bergmann [this message]
2022-09-14 13:43 ` Neil Armstrong
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=28501fbf-3508-4afe-804d-fa5a3ccd4291@www.fastmail.com \
--to=arnd@arndb.de \
--cc=broonie@kernel.org \
--cc=linux-amlogic@lists.infradead.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=narmstrong@baylibre.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
all inboxes | Powered by JetHome®