mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Vinod Koul <vinod.koul@intel.com>
To: Russell King - ARM Linux <linux@arm.linux.org.uk>
Cc: Pratyush Anand <pratyush.anand@st.com>,
	Vipul Kumar SAMAR <vipulkumar.samar@st.com>,
	Bhavna YADAV <bhavna.yadav@st.com>,
	Bhupesh SHARMA <bhupesh.sharma@st.com>,
	Armando VISCONTI <armando.visconti@st.com>,
	"linus.walleij@linaro.org" <linus.walleij@linaro.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Vipin KUMAR <vipin.kumar@st.com>,
	Shiraz HASHIM <shiraz.hashim@st.com>,
	Amit VIRDI <Amit.VIRDI@st.com>, Mirko GARDI <mirko.gardi@st.com>,
	Deepak SIKRI <deepak.sikri@st.com>,
	"dan.j.williams@intel.com" <dan.j.williams@intel.com>,
	Rajeev KUMAR <rajeev-dlh.kumar@st.com>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	Vincenzo FRASCINO <Vincenzo.FRASCINO@st.com>
Subject: Re: [PATCH] dmaengine/dw_dmac: Add support for device_prep_dma_sg
Date: Wed, 04 Jan 2012 19:17:49 +0530	[thread overview]
Message-ID: <1325684869.1540.77.camel@vkoul-udesk3> (raw)
In-Reply-To: <20120103134328.GR2914@n2100.arm.linux.org.uk>

On Tue, 2012-01-03 at 13:43 +0000, Russell King - ARM Linux wrote:
> On Tue, Jan 03, 2012 at 06:33:36PM +0530, Vinod Koul wrote:
> > On Tue, 2012-01-03 at 09:40 +0000, Russell King - ARM Linux wrote:
> > > Wait a moment.  This looks like a disaster waiting to happen.  The DMA
> > > engine code doesn't really handle the DMA API properly as it is - and
> > > that has lead to at least one recent oops report (and it still remains
> > > unresolved.)
> > > 
> > > The DMA API has the idea of buffer ownership: a buffer is either owned by
> > > the CPU, or the DMA device.  Only its owner may explicitly access the
> > > buffer.
> > > 
> > > Before a buffer can be used for DMA, it must be mapped to the DMA device
> > > (using dma_map_sg() or dma_map_single().)  Once this call returns, the
> > > mapping is setup and the CPU must not explicitly access the buffer until
> > > the buffer is unmapped via dma_unmap_sg() or dma_unmap_single().
wouldn't this cause issues with audio users of dmaengine API. They would
use DMA API to map the buffer and do a prepare (cyclic). And both cpu
and dma and accessing this?

> This is sub-optimal, because then you end up with:
> 
> - align_sg_list
> - map lists
> - prep_dma_sg
> - unmap lists
> - perform manual copy
> 
> which, if your map/unmap is non-trivial, means you take an unnecessary hit.
> 
> It would be much better if the dmaengine code exposed its alignment
> properties in such a way that:
> 
> (a) align_sg_list could be totally generic code
> (b) it can be found out whether the sg list can be handled by the DMA
>     engine
> 
> I'd also argue that align_sg_list() probably shouldn't even try to align
> a sg list - it should really just indicate whether the sg list _could_
> be handled by the DMA engine code or not.  (The case where the source
> and destination are identically mis-aligned is probably a rare corner
> case of the mis-aligned sg list.)
Yes, we could add something like dmaengine_check_align() which would
check if the given word alignment is supported by dmac or not.
Based on this peripheral driver can take a right decision on what needs
to be done.
Of-course, we would need controller to let dmaengine know the word
alignment constraints of the dmac.

-- 
~Vinod


      reply	other threads:[~2012-01-04 13:47 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-13  8:47 Pratyush Anand
2011-12-13 11:54 ` Linus Walleij
2011-12-23 15:58 ` Vinod Koul
2012-01-02 11:20   ` Pratyush Anand
2012-01-02 11:25     ` Vinod Koul
2012-01-03  9:40       ` Russell King - ARM Linux
2012-01-03 13:03         ` Vinod Koul
2012-01-03 13:43           ` Russell King - ARM Linux
2012-01-04 13:47             ` Vinod Koul [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=1325684869.1540.77.camel@vkoul-udesk3 \
    --to=vinod.koul@intel.com \
    --cc=Amit.VIRDI@st.com \
    --cc=Vincenzo.FRASCINO@st.com \
    --cc=armando.visconti@st.com \
    --cc=bhavna.yadav@st.com \
    --cc=bhupesh.sharma@st.com \
    --cc=dan.j.williams@intel.com \
    --cc=deepak.sikri@st.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=mirko.gardi@st.com \
    --cc=pratyush.anand@st.com \
    --cc=rajeev-dlh.kumar@st.com \
    --cc=shiraz.hashim@st.com \
    --cc=vipin.kumar@st.com \
    --cc=vipulkumar.samar@st.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®