cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Lordlothard
Observer
Observer
518 Views
Registered: ‎03-12-2021

AXI DMA Proxy Driver : help !

Welcome everyone on (again) a topic about Xilinx DMA Proxy Driver. 

I'm developping a simple DMA loopback on an UltraScale+ MPSoC ZU3EG Avnet UTRA96V2 dev Board. 

I'm using Avnet's Linux Image, rootfs, FSBL & PMUFW.  I build the Device-tree on OSL Flow (Build Device Tree Blob - Xilinx Wiki - Confluence (atlassian.net)) . I can't use Petalinux for connection reasons .  

I followed the tutorials : 

Linux DMA From User Space - Xilinx Wiki - Confluence (atlassian.net)

Linux DMA From User Space 2.0 - Xilinx Wiki - Confluence (atlassian.net)

The Kernel contains DMA Engine Driver and Xilinx DMA Driver. 

My PL layout is a simple AXI DMA looped back, with Scatter Gather but without Cache coherency. 

At boot, It seems to be functional  : 

 

root@ultra96v2-2020-1:~# dmesg | grep dma
[    2.871537] xilinx-vdma a0000000.dma: failed to get axi_aclk (-517)
[    3.457323] xilinx-vdma a0000000.dma: Xilinx AXI DMA Engine Driver Probed!!

 

Given that, I decided to compile dma-proxy driver in .ko to have a module that I could activate using insmod.  

I tried the two versions of the dma-proxy , the one given in the first tutorial and the second in this Git : GitHub - Xilinx-Wiki-Projects/software-prototypes 

The first one works when installing it : 

root@ultra96v2-2020-1:/usr/src/dma-proxy# insmod dma-proxy.ko
[  715.767643] dma_proxy module initialized
[  715.774339] Allocating uncached memory at virtual address 0x0000000015caefdd, physical address 0x0000000035bea828
[  715.786785] Allocating uncached memory at virtual address 0x00000000bc8cd663, physical address 0x000000005f2128b0

// verifying channels :
root@ultra96v2-2020-1:/dev# ls | grep dma
cpu_dma_latency
dma_proxy_rx
dma_proxy_tx

But the test application shows that data is not received:

 

root@ultra96v2-2020-1:/usr/src/dma-proxy# ./dma-proxy-test 5 5
DMA proxy test
buffer not equal, index = 1, data = 0 expected data = 1
buffer not equal, index = 2, data = 0 expected data = 2
buffer not equal, index = 3, data = 0 expected data = 3
buffer not equal, index = 4, data = 0 expected data = 4
buffer not equal, index = 0, data = 0 expected data = 1
buffer not equal, index = 1, data = 0 expected data = 2
buffer not equal, index = 2, data = 0 expected data = 3
buffer not equal, index = 3, data = 0 expected data = 4
buffer not equal, index = 4, data = 0 expected data = 5
buffer not equal, index = 0, data = 0 expected data = 2
buffer not equal, index = 1, data = 0 expected data = 3
buffer not equal, index = 2, data = 0 expected data = 4
buffer not equal, index = 3, data = 0 expected data = 5
buffer not equal, index = 4, data = 0 expected data = 6
buffer not equal, index = 0, data = 0 expected data = 3
buffer not equal, index = 1, data = 0 expected data = 4
buffer not equal, index = 2, data = 0 expected data = 5
buffer not equal, index = 3, data = 0 expected data = 6
buffer not equal, index = 4, data = 0 expected data = 7
buffer not equal, index = 0, data = 0 expected data = 4
buffer not equal, index = 1, data = 0 expected data = 5
buffer not equal, index = 2, data = 0 expected data = 6
buffer not equal, index = 3, data = 0 expected data = 7
buffer not equal, index = 4, data = 0 expected data = 8
DMA proxy test complete

 

, However the dma seems to be alive because there is no timeouts ; Timeouts occurs at the second test :

 

root@ultra96v2-2020-1:/usr/src/dma-proxy# ./dma-proxy-test 5 5
DMA proxy test
buffer not equal, index = 1, data = 0 expected data = 1
buffer not equal, index = 2, data = 0 expected data = 2
buffer not equal, index = 3, data = 0 expected data = 3
buffer not equal, index = 4, data = 0 expected data = 4
[  736.786438] DMA timed out
[  736.786440] DMA timed out
Proxy rx transfer error
Proxy tx transfer error
buffer not equal, index = 0, data = 0 expected data = 1
buffer not equal, index = 1, data = 0 expected data = 2
buffer not equal, index = 2, data = 0 expected data = 3
buffer not equal, index = 3, data = 0 expected data = 4
buffer not equal, index = 4, data = 0 expected data = 5
[  739.858440] DMA timed out
Proxy rx transfer error[  739.858441] DMA timed out

Proxy tx transfer error
buffer not equal, index = 0, data = 0 expected data = 2
buffer not equal, index = 1, data = 0 expected data = 3
buffer not equal, index = 2, data = 0 expected data = 4
buffer not equal, index = 3, data = 0 expected data = 5
buffer not equal, index = 4, data = 0 expected data = 6
[  742.930438] DMA timed out
[  742.930440] DMA timed out
Proxy tx transfer error
Proxy rx transfer error
buffer not equal, index = 0, data = 0 expected data = 3
buffer not equal, index = 1, data = 0 expected data = 4
buffer not equal, index = 2, data = 0 expected data = 5
buffer not equal, index = 3, data = 0 expected data = 6
buffer not equal, index = 4, data = 0 expected data = 7
[  746.002432] DMA timed out
[  746.002434] DMA timed out
Proxy tx transfer error
Proxy rx transfer error
buffer not equal, index = 0, data = 0 expected data = 4
buffer not equal, index = 1, data = 0 expected data = 5
buffer not equal, index = 2, data = 0 expected data = 6
buffer not equal, index = 3, data = 0 expected data = 7
buffer not equal, index = 4, data = 0 expected data = 8
DMA proxy test complete
[  749.074741] DMA timed out
root@ultra96v2-2020-1:/usr/src/dma-proxy#

 

 

For the second version of the driver from the Github   ,  it gets worse : the insmod command fail to install the driver. 

root@ultra96v2-2020-1:/usr/src/linux-user-space-dma/Software/Kernel# insmod dma-proxy.ko
[  902.577740] dma_proxy module initialized
[  902.583385] dma_proxy_driver dma_proxy: swiotlb: coherent allocation failed, size=4227072
[  902.591597] CPU: 2 PID: 6562 Comm: insmod Tainted: G           O      4.19.0-xilinx-v2019.2 #1
[  902.600196] Hardware name: Avnet Ultra96 Rev1 (DT)
[  902.604970] Call trace:
[  902.607414]  dump_backtrace+0x0/0x148
[  902.611066]  show_stack+0x14/0x20
[  902.614377]  dump_stack+0x90/0xb4
[  902.617683]  swiotlb_alloc+0x160/0x168
[  902.621421]  __dma_alloc+0x130/0x1e0
[  902.624988]  dmam_alloc_coherent+0xa8/0x160
[  902.629171]  create_channel+0x1f0/0x288 [dma_proxy]
[  902.634034]  dma_proxy_probe+0x54/0x180 [dma_proxy]
[  902.638904]  platform_drv_probe+0x50/0xa0
[  902.642905]  really_probe+0x1c8/0x280
[  902.646558]  driver_probe_device+0x54/0xe8
[  902.650646]  __driver_attach+0xe4/0xe8
[  902.654387]  bus_for_each_dev+0x70/0xc0
[  902.658215]  driver_attach+0x20/0x28
[  902.661782]  bus_add_driver+0x1dc/0x208
[  902.665609]  driver_register+0x60/0x110
[  902.669429]  __platform_driver_register+0x44/0x50
[  902.674118]  dma_proxy_init+0x20/0x1000 [dma_proxy]
[  902.678986]  do_one_initcall+0x74/0x178
[  902.682816]  do_init_module+0x54/0x1c8
[  902.686554]  load_module+0x1b5c/0x20e0
[  902.690287]  __se_sys_finit_module+0xb8/0xc8
[  902.694549]  __arm64_sys_finit_module+0x18/0x20
[  902.699067]  el0_svc_common+0x84/0xd8
[  902.702717]  el0_svc_handler+0x68/0x80
[  902.706448]  el0_svc+0x8/0xc
[  902.709339] Allocating memory, virtual address: 0000000000000000 physical address: 0000000000000000
[  902.718386] dma_proxy_driver dma_proxy: DMA allocation error
[  902.724065] dma_proxy_driver: probe of dma_proxy failed with error -1

Hey is there some page that gather all the different errors and solutions ? I get tired of searching this forum and i think pros get tired of answering the same responses to noobs like me ! 

I don't understand why the errors deal about coherency because i didn't activate them ! do I need to change something in the driver itself ? 

If you have any tips to make the second driver working please let me now ! I don't want to give up but i'm close this dma is a real struggle  ! 

Many Thanks for your future help.

dma_loopback.PNG
0 Kudos
2 Replies
martineben
Visitor
Visitor
278 Views
Registered: ‎11-12-2018

Hi, I´ve got the same problem did you find a solution?

0 Kudos
Lordlothard
Observer
Observer
263 Views
Registered: ‎03-12-2021

Hi, yes for me it was related to Fsbl generation.

I didn't re-generated components in Vitis when I built the boot.bin file.

My old set up was the pre-built design of my board (ultra96V2 Oob). In my new vivado design i changed the AXI port bus sizes. As I didn't rebuilt FSBL, the MpSoC initialized itself with the old bus size. So I noticed I had alignement issues.

Rebuilding FSBL & PMUFW solved driver timeouts (for me) .

However I advise you to use Bperez77 axidma driver on GitHub it works very well for me.

I hope this post will be usefull for you. 

 

Kind regards,

Gautier 

Tags (1)
0 Kudos