Re: Strange delay on PCI-DMA-transfer completion bywait_event_interruptible()
From: Robert Hancock
Date: Wed Dec 14 2005 - 20:22:03 EST
Burkhard Schölpen wrote:
I'm glad to meet somebody with dma experience, because I have
some other difficulties concerning DMA buffers in RAM. The PCI-Board
is to be applied in a large size copying machine, so it essentially
has to transfer tons of data in 2 directions very fast without wasting
cpu time (because the cpu has to run many image processing algorithms
meanwhile on this data). So my approach is to allocate a quite large
ringbuffer in kernel space (or more precisely one ringbuffer for each
direction) which is capable of dma. Afterwards I would map this buffer
to user space to avoid unnecessary memcopies/cpu usage. My problem is
for now to get such a large DMA buffer. I tried out several things I
read in O'Reilly's book, but they all failed so far. My current
attempt is to take a high memory area with ioremap:
You can't ioremap normal memory like that. ioremap is only for MMIO
address regions.
Better than trying to allocate lots of memory in the kernel (which you
can't, really), would be to make the userspace application allocate the
ringbuffer and do DMA from the device to userspace memory. To do this,
you'll have to either make the device do a separate DMA for every
contiguous chunk, or better yet make the device support scatter-gather
DMA so that it can read/write from discontiguous physical blocks of
memory. Have a look at Documentation/DMA-mapping.txt and
Documentation/DMA-API.txt, also at the Linux Device Drivers 3rd ed.
online book, these all have info on how this can be done.
--
Robert Hancock Saskatoon, SK, Canada
To email, remove "nospam" from hancockr@xxxxxxxxxxxxx
Home Page: http://www.roberthancock.com/
-
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/