There are two ways to do this 1. Allocate a physical memory at boot time itself by reserve_mem fn pointer and you could use this large buffer when you need dma using dma map single fn.
2. Patch the kernel with bigphysarea patch and allocate large buffer with that patch. And you can use that buffer for dma.
I have used both methods it works for large physical buffer you need for dma.
Thanks,
Haresh
Thanks,
Haresh.
On 7 Jan 2014 03:27, "Steven Bell" <botsnlinux@xxxxxxxxx> wrote:
>> I want to allocate a contiguous 8MB buffer and use it for streaming DMA. I don't need or want
>> a coherent buffer, since I'm using streaming DMA, and so dma_alloc_coherent() seems like
>> the wrong method to use. Is that true, or should I use it anyway? If not, what method do I use?
>>
>> The DMA-API and DMA-API-HOWTO documents don't seem to say anything about allocating
>> memory for streaming DMA operations. Have I missed something?
On Mon, Jan 6, 2014 at 1:29 AM, saumendra dash <saumendradash@xxxxxxxxx> wrote:
>
> For streaming DMA, you can use the function dma_map_single().
> Alternatively, you can create your own DMA pool using dma_pool_create(), and allocate memory from that using dma_pool_alloc(().
>
> The later case will be more suitable for you, since you want a 8MB DMA buffer for your DMA.
> Hope that helps/
I am using dma_map_single, but it doesn't allocate any memory. From
what I understand, it takes a pointer to a buffer and performs the
necessary cache flushes or invalidations to make sure that the memory
is safe to DMA. Is there a correct way to allocate large buffers for
streaming DMA? Right now, I'm allocating memory with get_free_pages,
but that is prone to fail on large allocations, and only works up to
4MB on my system (i.e get_free_pages order 10).
>From reading LDD3 and DMA-API.txt, DMA pools are for allocating "small
dma-coherent memory regions". LDD3 specifically states that pools are
useful where the driver needs regions smaller than 1 page. Since I
want large, non-coherent buffers, I don't see how this helps.
Steven
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@xxxxxxxxxxxxxxxxx http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies