All of lore.kernel.org
 help / color / mirror / Atom feed
From: akepner@sgi.com
To: akpm@linux-foundation.org
Cc: Tony Luck <tony.luck@intel.com>,
	Grant Grundler <grundler@parisc-linux.org>,
	Jesse Barnes <jbarnes@virtuousgeek.org>,
	Jes Sorensen <jes@sgi.com>,
	Randy Dunlap <randy.dunlap@oracle.com>,
	Roland Dreier <rdreier@cisco.com>,
	James Bottomley <James.Bottomley@steeleye.com>,
	David Miller <davem@davemloft.net>,
	linux-kernel@vger.kernel.org
Subject: [PATCH 3/3] document dma_flags_set/get_*()
Date: Tue, 16 Oct 2007 18:44:17 -0700	[thread overview]
Message-ID: <20071017014417.GL5601@sgi.com> (raw)


Document the dma_flags_set/get_*() interfaces.

Signed-off-by: Arthur Kepner <akepner@sgi.com>

--- 

 DMA-API.txt |   38 ++++++++++++++++++++++++++++++++++++++
 1 files changed, 38 insertions(+)

diff --git a/Documentation/DMA-API.txt b/Documentation/DMA-API.txt
index b939ebb..00919b0 100644
--- a/Documentation/DMA-API.txt
+++ b/Documentation/DMA-API.txt
@@ -547,3 +547,41 @@ size is the size (and should be a page-sized multiple).
 The return value will be either a pointer to the processor virtual
 address of the memory, or an error (via PTR_ERR()) if any part of the
 region is occupied.
+
+int 
+dma_flags_set_attr(u32 attr, enum dma_data_direction dir)
+
+Amend dir with a platform-specific "dma attribute".
+
+The only attribute currently defined is DMA_BARRIER_ATTR, which causes 
+in-flight DMA to be flushed when the associated memory region is written 
+to (see example below).  Setting DMA_BARRIER_ATTR provides a mechanism 
+to enforce ordering of DMA on platforms that permit DMA to be reordered 
+between device and host memory (within a NUMA interconnect).  On other 
+platforms this is a nop.
+
+DMA_BARRIER_ATTR would be set when the memory region is mapped for DMA, 
+e.g.:
+
+	int count;
+	int flags = dma_flags_set_attr(DMA_BARRIER_ATTR, DMA_BIDIRECTIONAL);
+	....
+	count = dma_map_sg(dev, sglist, nents, flags);
+
+As an example of a situation where this would be useful, suppose that 
+the device does a DMA write to indicate that data is ready and 
+available in memory.  The DMA of the "completion indication" could 
+race with data DMA.  Using DMA_BARRIER_ATTR on the memory used for 
+completion indications would prevent the race.
+
+int
+dma_flags_get_dir(int flags)
+
+Retrieve the original DMA direction, where flags was returned from 
+dma_flags_set_attr().
+
+int
+dma_flags_get_attr(int flags)
+
+Retrieve the "dma attributes", where flags was returned from 
+dma_flags_set_attr().

             reply	other threads:[~2007-10-17  1:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-17  1:44 akepner [this message]
2007-10-17  3:33 ` [PATCH 3/3] document dma_flags_set/get_*() Andrew Morton

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=20071017014417.GL5601@sgi.com \
    --to=akepner@sgi.com \
    --cc=James.Bottomley@steeleye.com \
    --cc=akpm@linux-foundation.org \
    --cc=davem@davemloft.net \
    --cc=grundler@parisc-linux.org \
    --cc=jbarnes@virtuousgeek.org \
    --cc=jes@sgi.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=randy.dunlap@oracle.com \
    --cc=rdreier@cisco.com \
    --cc=tony.luck@intel.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 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.