From: arnd@arndb.de (Arnd Bergmann)
To: linux-arm-kernel@lists.infradead.org
Subject: dma_cache_sync replacement call
Date: Thu, 16 Dec 2010 14:22:47 +0100 [thread overview]
Message-ID: <201012161422.47667.arnd@arndb.de> (raw)
In-Reply-To: <AANLkTi=XVZLcGut44xO8_MM=MH=VbiDtks5MATG5BSyq@mail.gmail.com>
On Thursday 16 December 2010, y bhanu wrote:
> Alternative for dma_cache_sync:
> dma_sync_single_for_cpu() and dma_unmap_single()
> These do the same operation of (i.e.__dma_single_dev_to_cpu ) to
> trasfer the buffer ownership.
>
> But, I really dont understand what is the differnec between
> dma_sync_single_for_cpu() and dma_unmap_single()? (Is it is just to
> make the name clear?)
> I think dma_sync_single_for_cpu() bests suites to situation.
The difference is mainly on platforms with an IOMMU, where you have
to explicitly manage the bus addresses using dma_map_* / dma_unmap_*.
dma_sync_single_for_cpu is for cases where you have a long-lived
(mapping with multiple accesses from both CPU and device, e.g. doing
dma_map_single(); /* gives returns a dma address
and allows the device to access it */
while (running) {
dma_sync_single_for_cpu(); /* lets the CPU access the buffer */
dma_sync_single_for_device(); /* lets the device access the buffer */
}
dma_unmap_single(); /* invalidates the dma address and returns it
to the CPU */
If the device only accesses the buffer once, you don't need to do an
explicit sync at all, just unmap after the access is done.
Arnd
prev parent reply other threads:[~2010-12-16 13:22 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-15 22:54 dma_cache_sync replacement call y bhanu
2010-12-15 22:59 ` Russell King - ARM Linux
2010-12-16 2:08 ` y bhanu
2010-12-16 13:22 ` Arnd Bergmann [this message]
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=201012161422.47667.arnd@arndb.de \
--to=arnd@arndb.de \
--cc=linux-arm-kernel@lists.infradead.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