Hello! Currently I am working on a capture driver for the zynq board. And I would like to allocate a memory region that can be access by the fpga and the arm. I am using devm_ioremap_resource, but I don't know how or if it is possible to associate this region with the dma allocation.
does anyone maybe have some advice?
cmm: I'm not sure to understand what you want to do. the FPGA can't access memory by itself, it requires DMA engines, doesn't it ?
pinchartl: yes, it does. What I would like to do is to assign a specific region of the memory that will be dedicated only for the capture buffers, and I am not sure what is the correct way to allocate that memory in the driver.
are you using the Xilinx V4L2 drivers ?
no, I am trying to write my own.
I am using the videobuf2 helper functions, so basically vb2_dc_alloc is the one that will call dma_alloc_coherent. But I would like to try to specify a memory region for that allocation, if that is even possible. I am really not that familiar with the dma api
I know that won't answer your question, but why don't you use the Xilinx V4L2 drivers ?
they're being upstreamed
(I need to spend more time on that)
and they already solve many of the issues you would need to solve
yeah, that would definitely make it easier, but the problem is that we have our own software running on the fpga, and the design of our implementation requires that we have a custom driver, basically because of the way we want to handle the buffers between the arm and the fpga
can you briefly explain that ?
it's hard to help you without more information
cmm: in drivers/media/platform/s5p-mfc/s5p_mfc.c two different memory regions are used to allocate the luma and chroma planes. Search for vb2_dma_contig_init_ctx().
and for s5p_mfc_alloc_memdevs()
videobuf2-dma-contig.c will use the device set by vb2_dma_contig_init_ctx() to allocate the buffer from the required memory area.
pinchartl: of course, thank you for your help. Basically, we have implemented on the fpga side two queues, which are the way of communicating with the driver. So to enqueue buffers there, we write as many addresses as we want to the enqueue queue, the fpga will use these addresses to write the frames and then when we get an interrupt signaling that the frame has been written, we dequeue it and pass it on to user space.
but these addresses should come from an specific region, which I would like to somehow specify to the dma api
are you using axi-vdma cores to transfer frames ?
pinchartl: yes
hverkuil: thanks, I see that you use dma_declare_coherent_memory there, so that basically declares a region that will be passed on to dma_alloc_coherent
cmm: correct. if you need to allocate from reserved memory that's how to do it
why can't you use normal system memory ?
hverkuil: when will you arrive at the fosdem ? 12:00 on Saturday ?
I expect so. I arrive at 11:08 at Brussel-Zuid and need to take subway/bus to fosdem. figuring out how and where to buy tickets for that is usually what takes the longest :-)
:-)
do you think you would have a bit of time before your talk for a discussion with jmleo and me ?
I mean before 12:00
sorry, before 13:00
as I'll likely have a talk to attend from 13:00 to 14:00
I have nothing special until my talk.
or after my talk, although I would like to see a talk at 17:00.
so basically I'm available from 12-14 and 16-17.
I'd like to see the talk after yours
about sync points
so 12-13 it is :-)
that sounds like the best option to me
that's ok for me too
possibly a bit before 12 if you arrive earlier
and if jmleo is available I can discuss more with him until 14.
Shall we meet at the graphics room (K.4.601)?
we can start at 11:00 jmleo and me, 12-13 with you, and 13-14 with you and him
s/at/at or near/
we'll try to find a quiet place at 11:00 and I'll test you where we are