<div dir="ltr"><div><div><div>For streaming DMA, you can use the function dma_map_single(). <br>Alternatively, you can create your own DMA pool using dma_pool_create(), and allocate memory from that using dma_pool_alloc((). <br>
<br></div>The later case will be more suitable for you, since you want a 8MB DMA buffer for your DMA.<br></div><div>Hope that helps/<br></div><div><br></div>Thanks,<br></div>Saumendra<br></div><div class="gmail_extra"><br>
<br><div class="gmail_quote">On Mon, Jan 6, 2014 at 11:48 AM, Steven Bell <span dir="ltr"><<a href="mailto:botsnlinux@gmail.com" target="_blank">botsnlinux@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">On Sun, Jan 5, 2014 at 8:02 AM, Peter Teoh <span dir="ltr"><<a href="mailto:htmldeveloper@gmail.com" target="_blank">htmldeveloper@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">I think this discussion should help you:<div><br></div><div><a href="http://e2e.ti.com/support/embedded/linux/f/354/t/89419.aspx" target="_blank">http://e2e.ti.com/support/embedded/linux/f/354/t/89419.aspx</a><br>
</div><div><br></div><div>other failures:</div><div><br></div><div><a href="http://stackoverflow.com/questions/14625919/allocating-a-large-dma-buffer" target="_blank">http://stackoverflow.com/questions/14625919/allocating-a-large-dma-buffer</a><br>
</div><div><br></div><div>and some guideline here:</div><div><br></div><div><a href="https://www.kernel.org/doc/Documentation/DMA-API.txt" target="_blank">https://www.kernel.org/doc/Documentation/DMA-API.txt</a><br></div>
<div><br></div><div>
<a href="https://lkml.org/lkml/2011/3/25/19" target="_blank">https://lkml.org/lkml/2011/3/25/19</a><br></div><div><br></div><div>As I don't have any specific crashdump or error information, nothing I can comment further about your problem. It is quite difficult to make general comment.</div>
<div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote"><div><div>On Fri, Jan 3, 2014 at 7:20 AM, Steven Bell <span dir="ltr"><<a href="mailto:botsnlinux@gmail.com" target="_blank">botsnlinux@gmail.com</a>></span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div><div dir="ltr"><div>Hi,<br><br></div><div>I'm working on a device driver for a video device which continuously reads and writes image frames using DMA. The frames are fairly large, in the range of 2-8MB, and I would like the buffers for them to be contiguous because of my hardware. My understanding is that using the contiguous memory allocator is the current "right way" to get the buffers, and that CMA operates entirely behind the scenes when calls are made to dma_alloc_coherent().<br>
</div><div><br></div><div>However, it seems that for this system, a streaming DMA setup would be more appropriate. The buffer gets filled with data once, handed to the device, and then isn't touched again until it gets reused with new data. The resources I've read have hinted that streaming DMA has some performance benefits over coherent DMA, so this seems like the way to go. But I haven't seen any discussion of how to use CMA with streaming DMA (or whether such a thing is even necessary).<br>
<br></div><div>Does the CMA also work behind get_free_pages, or other kernel memory allocation methods? Does it matter? The kernel newbies page on memory allocation (<a href="http://kernelnewbies.org/KernelMemoryAllocation" target="_blank">http://kernelnewbies.org/KernelMemoryAllocation</a>) says that get_free_pages up to about 8MB are ok. Is that a generalization based on typical memory fragmentation, or a guarantee?<br>
</div><div><br></div><div>Thanks,</div>Steven<br></div>
<br></div></div>_______________________________________________<br>
Kernelnewbies mailing list<br>
<a href="mailto:Kernelnewbies@kernelnewbies.org" target="_blank">Kernelnewbies@kernelnewbies.org</a><br>
<a href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" target="_blank">http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a><br>
<br></blockquote></div><span><font color="#888888"><br><br clear="all"><div><br></div>-- <br>Regards,<br>Peter Teoh
</font></span></div></blockquote><div><br></div></div></div><div>Thanks for the reply and the links. Unfortunately, they don't really answer my basic question - which is a general conceptual question, not a specific error or problem that I'm running into.<br>
<br></div><div>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?<br>
</div><div><br></div><div>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?<br></div><div><br>Thanks,<br>Steven<br></div>
<div><br><br></div></div><br></div></div>
<br>_______________________________________________<br>
Kernelnewbies mailing list<br>
<a href="mailto:Kernelnewbies@kernelnewbies.org">Kernelnewbies@kernelnewbies.org</a><br>
<a href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" target="_blank">http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a><br>
<br></blockquote></div><br></div>