UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

Reply

AXI DMA with Zynq Running Linux

Accepted Solution Solved
Highlighted
Contributor
Posts: 17
Registered: ‎04-28-2014
Accepted Solution

AXI DMA with Zynq Running Linux

Hello Dear All,

 

I would like to use AXI DMA in order to pass data to my custom ip. I think it is not a hard job for bare metal applications(an example tutorial: http://www.fpgadeveloper.com/2014/08/using-the-axi-dma-in-vivado.html) however, I couldn't find any complete guide to use AXI DMA in Linux. I am trying to put pieces together but I couldn't do what I want so far.

 

Would you please help me with that, do you have any suggestion or do you know any sources related to this subject?

 

Thanks,


Accepted Solutions
Scholar
Posts: 1,536
Registered: ‎09-10-2008

Re: AXI DMA with Zynq Running Linux

Hi,

 

I've been doing some work in this area so I attached a pdf and some source code.  DMA in Linux is not that well documented IMHO.  There are some other threads with these same files attached. 

 

Thanks,

John

View solution in original post


All Replies
Moderator
Posts: 3,051
Registered: ‎10-24-2013

Re: AXI DMA with Zynq Running Linux

Hi,
Moving to Embedded linux board.
Thanks,Vijay
--------------------------------------------------------------------------------------------
Please mark the post as an answer "Accept as solution" in case it helped resolve your query.
Give kudos in case a post in case it guided to the solution.
Scholar
Posts: 1,536
Registered: ‎09-10-2008

Re: AXI DMA with Zynq Running Linux

Hi,

 

I've been doing some work in this area so I attached a pdf and some source code.  DMA in Linux is not that well documented IMHO.  There are some other threads with these same files attached. 

 

Thanks,

John

Contributor
Posts: 17
Registered: ‎04-28-2014

Re: AXI DMA with Zynq Running Linux

Awesome! This is what I was looking for. Thank you very much!

 

Is this presentation from a workshop/lecture series? I mean, If there are some smilar presentations, I would like to get them also.

Scholar
Posts: 1,536
Registered: ‎09-10-2008

Re: AXI DMA with Zynq Running Linux

http://forums.xilinx.com/t5/Embedded-Linux/mmap-problems-device-tree-problem/td-p/523043

 

This thread has more posted and we are going to make a lot of this stuff more public in the future.

 

Glad you liked it.  I also attached a new one that I'm just finishing for user space DMA.  I'm putting this out here hoping that some of you will start using the methods and give some feedback.

 

Thanks

John

 

 

Contributor
Posts: 17
Registered: ‎04-28-2014

Re: AXI DMA with Zynq Running Linux

Looking forward to see for more in the future. I see a lot of questions about DMA but there are not enough resources, I think. Now, I feel like I found a treat. 

 

Thanks for helping. Have a great day!

Visitor
Posts: 15
Registered: ‎03-23-2010

Re: AXI DMA with Zynq Running Linux

Hello probus;

 

I am working on AXI DMA on petalinux and when i modprobe xilinx_axidma.c i always get the error : 

 

Unhandled fault: imprecise external abort (0x406) at 0x000a58a7
Internal error: : 406 [#1] PREEMPT SMP ARM

 

as far as i understandi get an error at dma_reset function which try to read the control_register. So i couldnot reach the registers. But, when i check the /proc/iomem, system handle the correct register addresses.

 

root@Xilinx-ZC702-2013_3:~# cat /proc/iomem
00000000-1fffffff : System RAM
00008000-00522053 : Kernel code
00c80000-00ccec2f : Kernel data
40400000-4040ffff : /amba@0/axidma@40400000
e0001000-e0001ffe : xuartps
e0002000-e0002fff : /amba@0/ps7-usb@e0002000
e0002000-e0002fff : e0002000.ps7-usb
e000a000-e000afff : e000a000.ps7-gpio
e000d000-e000dfff : e000d000.ps7-qspi
e0100000-e0100fff : mmc0
f8003000-f8003fff : /amba@0/ps7-dma@f8003000
f8003000-f8003fff : dma-pl330
f8007000-f80070ff : xdevcfg
f8007100-f800711f : f8007100.ps7-xadc
root@Xilinx-ZC702-2013_3:~#

 

 

So do you have an idea what could be the problem. I also added the system.dts.

 

Best Regards

Participant
Posts: 35
Registered: ‎09-02-2014

Re: AXI DMA with Zynq Running Linux

Hello,

i started a few days ago to move my simple DMA implementation from standalone to linux.
this is the first "usefull" thread i found about this step. Is there also a lab discription or example code for

the hardware design which is described in this documentation from linnj.

 

at the moment i dont know how and where i should start.

 

thank you

 

Max

 

Explorer
Posts: 125
Registered: ‎03-13-2014

Re: AXI DMA with Zynq Running Linux

Hi,

 

Just to comment a little. As a Linux newbe I have been working on DMA device drivers for a few months now. I started just using everything in user space. I reserved the DMA buffers as a memory hole (memory linux did not touch). things such as the AXI DMA registers and the buffers were mapped to user space using device /dev/mem mmap. I did not use interrupts. I had everthing working, however there was a big problem, it was too slow. Copy from user space to DMA buffers was very slow. I am sure clever people who understand caching etc could tell you why but suffice to say don't use a user space only DMA.

 

I have now written my own char device driver, I ignore the Linux and Xilinx DMA drivers and program the AXI DMA directly. This works fine, if it will help anyone I attach the source.

 

good luck

 

Dave

 

P.S. Thanks to John Linn who was very helpful when I had problems

 

Scholar
Posts: 1,536
Registered: ‎09-10-2008

Re: AXI DMA with Zynq Running Linux

Hi Max and Dave,

 

Dave, based on your small description, the only reason I can think of for it being slow was used /dev/mem to map buffers to user space such that they were maybe cached.  It takes CPU time to do the cache operations.  

 

I believe that a user/kernel space hybrid approach is likely best and I think you should be able to map the buffers into user space without sacrificing performance. The kernel space lets you use interrupts more effectively and control buffers with respect to caching also.  Allocating non-cached memory for buffers (dma_alloc_coherent) may be the best answer to avoid cache issues (depending on the application).  

 

I see a lot of people trying user space stuff only without wanting to get into the kernel. Knowing more details about what the kernel is doing is a big benefit and likely a requirement even when doing user space code for devices like this.

 

Max, the systems I used in the past were built in Vivado and were extremely simple. An AXI DMA connected to Zynq using the interrupts and then a loopback from the Tx stream to the Rx stream on the DMA.  My work has been more focused on using the Linux DMA drivers since they are provided and work.

 

Thanks

John