Skip to contentSkip to conversation

Strange delay on PCI-DMA-transfer completion by wait_event_interruptible()

DISCUSSION Robert Hancock 1 participant 1 message Dec 15, 2005 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 4 lines · Burkhard Schölpen

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

Quoted 8 lines

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.

Signature · 3 lines
Robert Hancock      Saskatoon, SK, Canada
To email, remove "nospam" from [email protected]
Home Page: http://www.roberthancock.com/