DMA, CMA, coherence and performance

manty kuma mantykuma at gmail.com
Tue Jan 7 02:39:47 EST 2014


Hi,
Ion memory, i think, is the solution to the scenario. This is boot time
carved out memory which only you would have the access to.

To have your own share, you can declare some in device tree files if you
have access to them. You may want to read more about it
here<http://lwn.net/Articles/480055/>.
One more link <http://lwn.net/Articles/565469/>. In general you can search
for ION memory and study the proper api's.

Regards,
Manty


On Tue, Jan 7, 2014 at 10:45 AM, haresh langaraman <hareshel at gmail.com>wrote:

> 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 at gmail.com> 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 at gmail.com>
>> 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 at kernelnewbies.org
>> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>>
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20140107/b4ff4213/attachment.html 


More information about the Kernelnewbies mailing list