public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Linh Dang <dang.linh@gmail.com>
To: Paul Mackerras <paulus@samba.org>
Cc: Linux Kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH][PPC32[NEWBIE] enhancement to virt_to_bus/bus_to_virt (try 2)
Date: Sun, 5 Dec 2004 20:56:45 -0500	[thread overview]
Message-ID: <3b2b32004120517563bf408f@mail.gmail.com> (raw)
In-Reply-To: <16819.31194.561882.514591@cargo.ozlabs.ibm.com>

On Mon, 6 Dec 2004 08:12:58 +1100, Paul Mackerras <paulus@samba.org> wrote:
> Linh Dang writes:
> 
> > I wrote a DMA engine (to used by other drivers) that (would like to) accept
> > all kind of buffers as input (vmalloced, dual-access shared RAM mapped
> > by BATs, etc). The DMA engine has to decode the virtual address of the
> > input buffer to (possibly multiple) physical  address(es). virt_to_phys()
> > has the right name for the job except it only works for the kernel virtual
> > addresses initially mapped at KERNELBASE
> 
> Have you read Documentation/DMA-API.txt?  It explains the official
> kernel API for DMA, and drivers should use it in order to be portable
> to more than just one architecture.

>From further reading of that text, I don't think it's what I'm looking for.
The DMA-API.txt file describes the official API for mapping an kernel
virtual address to something usable by the DMA of the bus-master
capable device.

On a many embedded ppc32 platforms, the bridge is capable of
performing DMA  (usually called IDMA) between RAM ram and
NON-busmaster-devices. Examples of such platforms are the
PowerQuiccII, PowerQuiccIII, the Marvell Discovery I,II,II, etc.

Such DMA operations are very useful because CPU cycles are
precious on many embedded platforms.

What I'm looking for is the Linux way or the Linux equivalent of:

  http://fxr.watson.org/fxr/source/dev/marvell/gtidma.c?v=NETBSD


Oh, a side question, in Linux/Unix world, is it acceptable to DMA
data directly from/to the userspace buffer? Something like:

         int fd = open("/dev/my_asic0", O_RDWR);
         int buffer = calloc(40, 4096);
         int n = pread64(fd, buffer, 40 * 4096, SOME_ADDR);

and the IDMA engine would transfer 40 pages from my_asic0's
shared-ram directly into `buffer'.

Thanx
-- 
Linh Dang

      parent reply	other threads:[~2004-12-06  2:01 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-02 14:49 [PATCH][PPC32] enhancement to virt_to_bus/bus_to_virt (resent with spell-checked subject line) Linh Dang
2004-12-02 16:28 ` [PATCH][PPC32[NEWBIE] enhancement to virt_to_bus/bus_to_virt (try 2) Linh Dang
2004-12-02 20:31   ` Paul Mackerras
2004-12-03 14:46     ` Linh Dang
2004-12-05 10:11       ` Eugene Surovegin
2004-12-05 19:18         ` Linh Dang
2004-12-05 20:52           ` Eugene Surovegin
2004-12-05 21:12       ` Paul Mackerras
2004-12-06  1:31         ` Linh Dang
2004-12-06  1:56         ` Linh Dang [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=3b2b32004120517563bf408f@mail.gmail.com \
    --to=dang.linh@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paulus@samba.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox