Re: DMA to user space

From: Stephen C. Tweedie (sct@redhat.com)
Date: Fri Mar 17 2000 - 09:15:17 EST


Hi,

On Wed, 15 Mar 2000 17:12:16 -0500, John Wilson <wilson@dbit.dbit.com>
said:

> I hope I'm asking this in the right place, flame away if not! :-)
> I'm writing a driver for a strange DMA device and I would like to be able
> to do DMA directly into the user's buffer. Is this possible?

Yes. In 2.3, look at the the raw IO code in drivers/char/raw.c. It
uses the "kiobuf" mechanism to locate the "struct page *"s associated
with an arbitrary user buffer: map_user_kiobuf() does all the hard
work. The driver can then use those pages in any way it wants.

> So, is it as simple as requiring the user to mlock() the buffer and then
> using virt_to_bus to get the page addresses? Or is it more complicated, or
> just totally hopeless?

It's a bit more complex than that, but map_user_kiobuf() takes care of
it. There's a version for 2.2 if you want it.

--Stephen

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Thu Mar 23 2000 - 21:00:23 EST