From: Russell King - ARM Linux <linux@arm.linux.org.uk>
To: Ming Lei <tom.leiming@gmail.com>
Cc: Arnd Bergmann <arnd@arndb.de>,
Alan Cox <alan@lxorguk.ukuu.org.uk>,
Joerg Roedel <joerg.roedel@amd.com>,
fujita.tomonori@lab.ntt.co.jp, linux-kernel@vger.kernel.org,
akpm@linux-foundation.org,
linux-arm-kernel <linux-arm-kernel@lists.arm.linux.org.uk>
Subject: Re: [PATCH][RFC] asm-generic:remove calling flush_write_buffers() in dma_sync_*_for_cpu
Date: Tue, 7 Jul 2009 18:33:44 +0100 [thread overview]
Message-ID: <20090707173344.GA18504@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <d82e647a0907070643i198b9188q80203ab0408b4df8@mail.gmail.com>
On Tue, Jul 07, 2009 at 09:43:37PM +0800, Ming Lei wrote:
> 2009/7/7 Russell King - ARM Linux <linux@arm.linux.org.uk>:
> > On Tue, Jul 07, 2009 at 09:54:20AM +0800, Ming Lei wrote:
> >> 2009/6/30 Arnd Bergmann <arnd@arndb.de>:
> >> > On Tuesday 30 June 2009, Alan Cox wrote:
> >> > Well, not even that. dma-mapping-common.h only makes sense on architectures
> >> > that have multiple dma-mapping implementations (parisc, mips, arm, powerpc,
> >>
> >> It seems that there is only one dma-mmaping implementation on ARM, doesn't it?
> >> Is it necessary that using dma-mapping-common.h on ARM?
> >
> > ARM has two (normal, and dma bounce), and in the long run we need to do
>
> OK, Can we use dma-mapping-common.h on ARM?
No.
> > cache handling on unmap as well as map due to CPU speculative fetches.
>
> IMHO, it seems we can fix this problem now.
>
> For DMA_TO_DEVICE transfer, clean cache in dma map, but does nothing in
> dma unmap;
>
> For DMA_FROM_DEVICE, we may do nothing in dma map, but invaliate cache
> in dma unmap.
No. If there are dirty lines, they can be written back, overwriting the
data which has been DMA'd there.
Basically, with speculative prefetching, we need to:
- for DMA_TO_DEVICE, clean the cache in the DMA map and do nothing on DMA unmap
- for DMA_FROM_DEVICE, invalidate the cache on DMA map and again on DMA unmap
Moreover, this isn't going to be trivial. In order to do these cache
operations, we need the virtual address. However, the unmap APIs aren't
given this information (though dma_to_virt() will do what's required for
the dma_unmap_single case.)
dma_unmap_page() on the other hand, we don't have any API existing to
turn a DMA address back into a page struct...
If only we had an architecture specific struct to contain whatever
information needs to be carried from map to unmap...
next prev parent reply other threads:[~2009-07-07 17:34 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-28 14:39 tom.leiming
2009-06-28 15:34 ` Arnd Bergmann
2009-06-29 12:31 ` Joerg Roedel
2009-06-29 13:51 ` Ming Lei
2009-06-29 14:45 ` Joerg Roedel
2009-06-29 14:54 ` Ming Lei
2009-06-29 15:44 ` Joerg Roedel
2009-06-29 16:22 ` Arnd Bergmann
2009-06-29 16:31 ` Alan Cox
2009-06-29 16:45 ` Arnd Bergmann
2009-06-29 17:16 ` Alan Cox
2009-06-30 12:34 ` Arnd Bergmann
2009-06-30 12:40 ` Alan Cox
2009-06-30 12:48 ` Arnd Bergmann
2009-06-30 13:09 ` Alan Cox
2009-06-30 13:38 ` Arnd Bergmann
2009-07-07 1:54 ` Ming Lei
2009-07-07 7:48 ` Russell King - ARM Linux
2009-07-07 13:43 ` Ming Lei
2009-07-07 14:06 ` Arnd Bergmann
2009-07-07 14:55 ` Ming Lei
2009-07-07 15:30 ` Arnd Bergmann
2009-07-07 17:36 ` Russell King - ARM Linux
2009-07-07 17:33 ` Russell King - ARM Linux [this message]
2009-06-29 18:47 ` Joerg Roedel
2009-06-29 19:10 ` Alan Cox
2009-06-29 19:24 ` Joerg Roedel
2009-06-29 18:48 ` Joerg Roedel
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=20090707173344.GA18504@n2100.arm.linux.org.uk \
--to=linux@arm.linux.org.uk \
--cc=akpm@linux-foundation.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=arnd@arndb.de \
--cc=fujita.tomonori@lab.ntt.co.jp \
--cc=joerg.roedel@amd.com \
--cc=linux-arm-kernel@lists.arm.linux.org.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=tom.leiming@gmail.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®