From: will.deacon@arm.com (Will Deacon)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] ARM:dma-mapping: Handle DMA_BIDIRECTIONAL in _dma_page_cpu_to_dev()
Date: Mon, 9 Nov 2015 10:08:05 +0000 [thread overview]
Message-ID: <20151109100804.GA24936@arm.com> (raw)
In-Reply-To: <CAGUYZuQDiH_xzinEJ952rw9GuA9oUQSNASaNdOE1x_i97XCBrw@mail.gmail.com>
On Mon, Nov 09, 2015 at 11:29:17AM +0530, sanjeev sharma wrote:
> On Wed, Nov 04, 2015 at 10:39:13AM +0000, Will Deacon wrote:
> > On Wed, Nov 04, 2015 at 03:26:48PM +0530, Sanjeev Sharma wrote:
> > > _dma_page_cpu_to_dev() treat DMA_BIDIRECTIONAL similar to
> > > DMA_TO_DEVICE which means that destination buffer is device
> > > memory,means cpu may have written some data to source buffer and
> > > data may be in cache line.For cleaner operation we need to call
> > > outer_flush_range() which will clean and invalidate outer cache lines.
> >
> > Why isn't the clean sufficient in this case? We're mapping the buffer
> > to the device, so we clean the dirty lines in the CPU caches and make
> > them visible to the device. If the CPU later wants to read the buffer
> > (i.e. after the device has DMA'd into it), you'll need to map the
> > buffer to the CPU, which will perform the invalidation of the CPU caches.
>
> Indeed. bidirectional mode is already handled prefectly well by this
> code. No patches are required.
>
> Thanks Russell & Will for providing input.
>
> Let's assume , CPU don't read the buffer then there could be the problem
> correct ? IMO, to handle every use case outer_flush_range can be used ?
> If still it doesn't make sense to use flush on bidirectional mappings, then
> FIXME comment should be removed from the function to avoid any
> Confusion.
>
>
>
> Please let me know what you think on above comment ?
I still don't understand the problem that you're trying to fix.
Sorry,
Will
WARNING: multiple messages have this Message-ID (diff)
From: Will Deacon <will.deacon@arm.com>
To: sanjeev sharma <sanjeevsharmaengg@gmail.com>
Cc: "Sharma, Sanjeev" <Sanjeev_Sharma@mentor.com>,
Russell King - ARM Linux <linux@arm.linux.org.uk>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"m.szyprowski@samsung.com" <m.szyprowski@samsung.com>
Subject: Re: [PATCH] ARM:dma-mapping: Handle DMA_BIDIRECTIONAL in _dma_page_cpu_to_dev()
Date: Mon, 9 Nov 2015 10:08:05 +0000 [thread overview]
Message-ID: <20151109100804.GA24936@arm.com> (raw)
In-Reply-To: <CAGUYZuQDiH_xzinEJ952rw9GuA9oUQSNASaNdOE1x_i97XCBrw@mail.gmail.com>
On Mon, Nov 09, 2015 at 11:29:17AM +0530, sanjeev sharma wrote:
> On Wed, Nov 04, 2015 at 10:39:13AM +0000, Will Deacon wrote:
> > On Wed, Nov 04, 2015 at 03:26:48PM +0530, Sanjeev Sharma wrote:
> > > _dma_page_cpu_to_dev() treat DMA_BIDIRECTIONAL similar to
> > > DMA_TO_DEVICE which means that destination buffer is device
> > > memory,means cpu may have written some data to source buffer and
> > > data may be in cache line.For cleaner operation we need to call
> > > outer_flush_range() which will clean and invalidate outer cache lines.
> >
> > Why isn't the clean sufficient in this case? We're mapping the buffer
> > to the device, so we clean the dirty lines in the CPU caches and make
> > them visible to the device. If the CPU later wants to read the buffer
> > (i.e. after the device has DMA'd into it), you'll need to map the
> > buffer to the CPU, which will perform the invalidation of the CPU caches.
>
> Indeed. bidirectional mode is already handled prefectly well by this
> code. No patches are required.
>
> Thanks Russell & Will for providing input.
>
> Let's assume , CPU don't read the buffer then there could be the problem
> correct ? IMO, to handle every use case outer_flush_range can be used ?
> If still it doesn't make sense to use flush on bidirectional mappings, then
> FIXME comment should be removed from the function to avoid any
> Confusion.
>
>
>
> Please let me know what you think on above comment ?
I still don't understand the problem that you're trying to fix.
Sorry,
Will
next prev parent reply other threads:[~2015-11-09 10:08 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-04 9:56 [PATCH] ARM:dma-mapping: Handle DMA_BIDIRECTIONAL in _dma_page_cpu_to_dev() Sanjeev Sharma
2015-11-04 10:39 ` Will Deacon
2015-11-04 10:39 ` Will Deacon
2015-11-04 10:54 ` Russell King - ARM Linux
2015-11-04 10:54 ` Russell King - ARM Linux
2015-11-05 5:56 ` Sharma, Sanjeev
2015-11-05 5:56 ` Sharma, Sanjeev
[not found] ` <CAGUYZuQDiH_xzinEJ952rw9GuA9oUQSNASaNdOE1x_i97XCBrw@mail.gmail.com>
2015-11-09 10:08 ` Will Deacon [this message]
2015-11-09 10:08 ` Will Deacon
2015-11-09 10:15 ` Sharma, Sanjeev
2015-11-09 10:15 ` Sharma, Sanjeev
2015-11-09 10:50 ` Robin Murphy
2015-11-09 10:50 ` Robin Murphy
2015-11-09 12:00 ` Russell King - ARM Linux
2015-11-09 12:00 ` Russell King - ARM Linux
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=20151109100804.GA24936@arm.com \
--to=will.deacon@arm.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.