linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: One Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk>
To: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	dmaengine@vger.kernel.org,
	Dan Williams <dan.j.williams@intel.com>,
	"James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>,
	Sumit Semwal <sumit.semwal@linaro.org>,
	Vinod Koul <vinod.koul@intel.com>, Christoph Hellwig <hch@lst.de>,
	Lars-Peter Clausen <lars@metafoo.de>,
	linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,
	Nicolas Ferre <nicolas.ferre@atmel.com>
Subject: Re: [Question about DMA] Consistent memory?
Date: Thu, 31 Dec 2015 10:25:48 +0000	[thread overview]
Message-ID: <20151231102548.3ed389fb@lxorguk.ukuu.org.uk> (raw)
In-Reply-To: <CAK7LNASd1amcHinXzYy=8mtYbnHUY1G_v=fthpachAVSyjqPZA@mail.gmail.com>

On Thu, 31 Dec 2015 16:50:54 +0900
> But, I think such a system is rare.

Actually its quite normal for some vendors processors but not others.

> At least on my SoC (ARM SoC), DMA controllers
> for NAND, MMC, etc. are directly connected to the DRAM
> like Fig.2.
> 
> So, cache operations must be explicitly done
> by software before/after DMAs are kicked.
> (I think this is very normal.)

For ARM certainly.

> 
> Fig.2
> 
> |------|  |------| |-----|
> | CPU0 |  | CPU1 | | DMA |
> |------|  |------| |-----|
>    |         |        |
>    |         |        |
> |------|  |------|    |
> | L1-C |  | L1-C |    |
> |------|  |------|    |
>    |         |        |
> |------------------|  |
> |Snoop Control Unit|  |
> |------------------|  |
>          |            |
> |------------------|  |
> |   L2-cache       |  |
> |------------------|  |
>          |            |
> |--------------------------|
> |           DRAM           |
> |--------------------------|
> 
> 
> In a system like Fig.2, is the memory non-consistent?

dma_alloc_coherent will always provide you with coherent memory. On a
machine with good cache interfaces it will provide you with normal
memory. On some systems it may be memory from a special window, in other
cases it will fall back to providing uncached memory for this.

If the platform genuinely cannot support this (even by marking those areas
uncacheable) then it will fail the allocation.

What it does mean is that you need to use non-coherent mappings when
accessing a lot of data. On hardware without proper cache coherency it
may be quite expensive to access coherent memory.

Alan

  parent reply	other threads:[~2015-12-31 10:26 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-31  7:50 [Question about DMA] Consistent memory? Masahiro Yamada
2015-12-31  8:38 ` Mike Looijmans
2015-12-31 10:25 ` One Thousand Gnomes [this message]
2015-12-31 14:57   ` Masahiro Yamada
2015-12-31 17:12     ` Mike Looijmans
2016-01-02 10:53     ` Russell King - ARM Linux
2016-01-02 10:39 ` Russell King - ARM Linux
2016-01-02 16:17   ` James Bottomley
2016-01-02 18:07     ` Russell King - ARM Linux
2016-01-02 18:35   ` Mike Looijmans
2016-01-02 20:10     ` James Bottomley

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=20151231102548.3ed389fb@lxorguk.ukuu.org.uk \
    --to=gnomes@lxorguk.ukuu.org.uk \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=dan.j.williams@intel.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=hch@lst.de \
    --cc=lars@metafoo.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nicolas.ferre@atmel.com \
    --cc=sumit.semwal@linaro.org \
    --cc=vinod.koul@intel.com \
    --cc=yamada.masahiro@socionext.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;
as well as URLs for NNTP newsgroup(s).