Re: [PATCH][PPC32[NEWBIE] enhancement to virt_to_bus/bus_to_virt (try 2)

From: Linh Dang
Date: Sun Dec 05 2004 - 21:03:50 EST


On Mon, 6 Dec 2004 08:12:58 +1100, Paul Mackerras <paulus@xxxxxxxxx> 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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/