You make it sound so simple. Unfortunately it isn't.
c) as you describe not possible: In the kernel, a "kernel address" that
can be DMA'd using the documented method (virt_to_bus) is in the direct
mapped region. On i386, that's the region from 0xc0000000 up.
You can set up a kernel-space mapping (similar to vmalloc), however DMA
using virt_to_bus doesn't work for them.
The device driver must be written to divide its DMA requirements into
regions that don't cross non-contiguous page boundaries. It must look
up the physical address from user-space (an architecture specific thing
for which there is no reliable macro yet). It must translate the
physical address to a bus address. (Possible using
virt_to_bus(phys_to_virt()) for the moment).
As a future problem, some user-space pages will not be reachable by DMA
anyway, because they are outside the bus address range of the device
doing DMA. (cf. 32-bit PCI cards on >4GB memory machines, or
complexities of multi-bus machines).
The kmalloc()/mmap() method, while not as automatic from user-space, is
still by far the easiest method.
Enjoy,
-- Jamie
-
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/