Subject: Re: Bus mastering to user space
To: Todd T. Fries <toddf@acm.org>
From: Per Fogelstrom <pefo@opsycon.se>
List: tech-kern
Date: 07/19/1997 08:38:01
On 18-Jul-97 Todd T. Fries wrote:
>On Jul 18, G. Scott Lloyd wrote
>> Do the *BSD's support bus mastering DMA devices that transfer to/from user
>> memory? I've been told that Linux does not and will not.
>> 
>> The goal here is to reduce the copying of data to support 100-200
>> MBytes/sec devices. What is the fastest throughput anyone has achieved?
>
>If you are talking about dma, it is not possible to do this because
>of the fact that userspace is virtualized memory, which is fragmented,
>and cannot be guaranteed in 64k chunks, which is required in pc hardware.
>
It is very much possible if the bus-mastering device support scatter gather
operations. In fact many drivers do. I belive we do talk bus-mastering devs
here and not dma-slave devices?

>However, if you are talking about sparc workstations, then I understand
>some/all (not sure) are capable of doing dma transfers to the virtual
>memory addresses (meaning possible to do it to userland).
>
Normally the userland I/O area is wired down and mapped into the kernel as
contigous kernel space. Thus viritual address dma has no problem doing
the transfer. Physical address dma has to support scatter gather and when
setting up the dma, the viritual to physical address has to be digged out
via the paging table or similar. I did this for several of the drivers when
ported to the mips/arc systems.

So the answer is yes. OpenBSD can support dma directly to user space if the
above is true (busmastering, scatter gather capable) 


Fastest throughput is a combination of the dma setup overhead and your dma
bandwidth. I haven't seen other than high end systems support up to 200Mb/s
memory transfer speed (sustained).


Per