How DMA transfers > 2MB are being performed?
Dave Hylands
dhylands at gmail.com
Wed Jun 1 02:00:38 EDT 2011
Hi Sandeep,
On Tue, May 31, 2011 at 10:10 PM, sandeep kumar
<coolsandyforyou at gmail.com> wrote:
> Hi all
> A very limited (1-2MB) address space is mapped to dma_alloc() in ARM
> architecture..what if a DMA transfer of >2MB is needed at a time? As DMA
> transfer starts asynchronously..CPU relinquishes data buses..so CPU cant
> control. So the excess data which is >2MB will be overflown or lost..So how
> this large data transfers are being managed?
Huh?
The dma_alloc space can be upto 14 Mb on ARM. It's up to the machine's
memory.h file to set exactly how big it is. The appropriate constant
is called CONSISTENT_DMA_SIZE and the machine is free to set it to be
2Mb multiple between 2Mb and 14 Mb. If the machine's memory.h file
doesn't set a size, then it defaults to 2Mb. See:
<http://lxr.linux.no/linux+v2.6.39/arch/arm/include/asm/memory.h#L80>
You can also DMA from memory allocated outside of the dma_alloc space.
It's just more work.
I have code that DMAs from kmalloc space, vmalloc space, user-space
and dma_alloc space. Each one has its own quirks, and ones like
vmalloc space and user-space require walking through the pages to
determine the correct physical addresses, and then you need to take
care of cache coherency.
The video guys have been working on code to allow user-mode buffers to
be dma'd as well. I think that there are a few different APIs and some
work is happening to get it down to one API.
--
Dave Hylands
Shuswap, BC, Canada
http://www.davehylands.com
More information about the Kernelnewbies
mailing list