From: Russell King - ARM Linux <linux@arm.linux.org.uk>
To: Dan Williams <dan.j.williams@intel.com>,
Linus Walleij <linus.walleij@stericsson.com>
Cc: Viresh Kumar <viresh.kumar@st.com>,
Kukjin Kim <kgene.kim@samsung.com>,
yuanyabin1978@sina.com, linux-kernel@vger.kernel.org,
Ben Dooks <ben-linux@fluff.org>,
Peter Pearse <peter.pearse@arm.com>,
linux-arm-kernel@lists.infradead.org,
Alessandro Rubini <rubini@unipv.it>
Subject: Re: [PATCH 06/13] DMAENGINE: driver for the ARM PL080/PL081 PrimeCells
Date: Mon, 3 Jan 2011 15:19:44 +0000 [thread overview]
Message-ID: <20110103151944.GA32508@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <AANLkTikpyAggDCPef1pS=_QHnu9-FyLcpddGyVHnGwWx@mail.gmail.com>
Another issue to think about in terms of API guarantees...
Pausing an on-going transfer (which from what I read is a recent addition
to the API) can be problematical - having tripped over one such problem
on my Realview EB (PL081 rev1) platform.
With the PL08x, when you program a channel up for a M->P transfer and
enable it, the DMAC will immediately fetch data from memory and mark
itself busy before the first DMA request from the peripheral.
When the first DMA request occurs from the peripheral, the DMAC starts
feeding this data to the peripheral, and fetches new data into its FIFO
as required.
The problem comes when the peripheral stops requesting data from the
DMAC, and then you want to pause it. Current code sets the HALT bit,
and then spins indefinitely for the BUSY bit to clear - which it will
only ever do if the peripheral drains the FIFO. As a result of botched
DMA signal selection code for the Realview EB, the DMA signals never
went active, and on terminate_all() the CPU locked up solid (no
interrupts) spinning on the DMAC to clear the busy bit.
It may be worth specifying that a pause followed by a resume is
expected to never lose data - and that drivers must check the result
of a request to pause the channel. If DMA engine drivers are unable
to pause the channel within a reasonable amount of time, they should
return -ETIMEOUT, so they know that there may still be data that
could still be transferred to the peripheral.
One important note about this condition is that with the DMA channel
marked BUSY+HALT and the channel being configured for M->P, the
peripheral can still transfer data from the DMAC to itself, and this
causes the transfer size value in the CNTL register to decrement (since
reading the CNTL register returns the number of transfers _to_ the
destination, not the number of transfers from the source.)
I've changed the comment against pl08x_pause_phy_chan() to this:
* Pause the channel by setting the HALT bit.
*
* For M->P transfers, pause the DMAC first and then stop the peripheral -
* the FIFO can only drain if the peripheral is still requesting data.
* (note: this can still timeout if the DMAC FIFO never drains of data.)
*
* For P->M transfers, disable the peripheral first to stop it filling
* the DMAC FIFO, and then pause the DMAC.
I've not decided whether it should be possible to resume an ETIMEOUT'd
pause request (in theory with pl08x, that's just a matter of clearing
the HALT bit) or whether an ETIMEOUT'd pause request should restore
the previous HALT bit setting (possibly re-enabling transfers on the
channel.) Allowing it to be re-enabled in some way would be the safest
thing in terms of data integrity for the reason mentioned in the
"important note" above.
Dan, Linus, any thoughts?
next prev parent reply other threads:[~2011-01-03 15:20 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-11 15:27 Linus Walleij
2010-06-14 6:02 ` Viresh KUMAR
2010-06-14 13:39 ` Linus Walleij
2010-06-15 5:25 ` Viresh KUMAR
2010-06-15 20:14 ` Linus WALLEIJ
2010-06-16 3:59 ` Viresh KUMAR
2010-06-16 6:38 ` Linus Walleij
2010-06-15 10:25 ` Kukjin Kim
2010-06-15 10:45 ` Jassi Brar
2010-06-15 11:17 ` Maurus Cuelenaere
2010-06-15 11:39 ` Jassi Brar
2010-06-15 12:04 ` Maurus Cuelenaere
2010-06-15 20:55 ` Linus WALLEIJ
2010-12-21 18:20 ` Russell King - ARM Linux
2010-12-21 22:25 ` Russell King - ARM Linux
2010-12-22 12:22 ` Russell King - ARM Linux
2010-12-22 12:29 ` Russell King - ARM Linux
2010-12-22 23:45 ` Dan Williams
2010-12-22 23:54 ` Russell King - ARM Linux
2010-12-23 0:53 ` Dan Williams
2010-12-23 0:10 ` Russell King - ARM Linux
2010-12-23 1:11 ` Dan Williams
2010-12-23 1:31 ` Dan Williams
2010-12-31 21:50 ` Russell King - ARM Linux
2011-01-02 9:42 ` Dan Williams
2011-01-02 11:22 ` Russell King - ARM Linux
2011-01-02 20:33 ` Linus Walleij
2011-01-03 11:14 ` Russell King - ARM Linux
2010-12-23 9:18 ` Russell King - ARM Linux
2010-12-23 8:17 ` Linus Walleij
2010-12-23 8:30 ` Jassi Brar
2010-12-23 12:30 ` Russell King - ARM Linux
2010-12-28 0:33 ` Linus Walleij
2011-01-01 15:15 ` Russell King - ARM Linux
2011-01-02 20:29 ` Linus Walleij
2014-03-10 13:56 ` David Woodhouse
2014-03-10 14:11 ` Arnd Bergmann
2014-03-10 14:27 ` David Woodhouse
2014-03-10 14:40 ` Arnd Bergmann
2014-03-10 14:32 ` Russell King - ARM Linux
2014-03-10 14:52 ` David Woodhouse
2014-03-13 8:17 ` Linus Walleij
2014-03-13 8:52 ` Arnd Bergmann
2014-03-13 14:35 ` Linus Walleij
2011-01-01 15:36 ` Russell King - ARM Linux
2011-01-03 15:19 ` Russell King - ARM Linux [this message]
2011-01-04 0:41 ` Jassi Brar
2011-01-04 10:47 ` Linus Walleij
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=20110103151944.GA32508@n2100.arm.linux.org.uk \
--to=linux@arm.linux.org.uk \
--cc=ben-linux@fluff.org \
--cc=dan.j.williams@intel.com \
--cc=kgene.kim@samsung.com \
--cc=linus.walleij@stericsson.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=peter.pearse@arm.com \
--cc=rubini@unipv.it \
--cc=viresh.kumar@st.com \
--cc=yuanyabin1978@sina.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®