Sorry, you need to enable JavaScript to visit this website.

Xilinx Forum Dup: Linux DMA Cleanup after transaction timeout

Solved
2 posts / 0 new
bkamen's picture
bkamen
Junior(0)
Xilinx Forum Dup: Linux DMA Cleanup after transaction timeout

I have the following over on the Xilinx forum - so far no one's looked at it. (so few people doing DMA? ;) )

------------------------------------------------------------

I'm using dma_alloc_coherent for dma operations -- and it works great as long as the transaction doesn't timeout. (which is a condition that's expected to occur).

After the initial timeout, DMA stops working for every subsequent attempt. (see below)

dma_terminate_all() looks like should be what I should use, but I get first time use dmesg of:
 

[ 35.146414] xilinx-dma 40400000.dma: Cannot stop channel eeaff410: 0
[ 36.151393] xilinx-dma 40400000.dma: Cannot stop channel eea30350: 0

(DMA doesn't clean  up -- and doesn't go back to working -- and no more messages like the above occur on sequential timeouts.)

Is there some cleanup step I'm missing? (this is Petalinux 2015.4)

Thanks,

 -Ben
 
 

I originally used kzalloc with small buffers combined with the sequence of:  (get/release dma channel is on open/close of driver)
 

dma_map_single ()
dmaengine_prep_slave_single ()
init_completion()
dma_async_issue()
wait_for_completion_timeout()
ucpi_dma_ch_unmap()

it worked fine.

I switched to dma_mmap_coherent() and the sequence is now: (get/release dma channel is on open/close of driver)
 

dmaengine_prep_slave_single ()
init_completion()
dma_async_issue()
wait_for_completion_timeout()
(tried with dma_terminate_call() and without)
ucpi_dma_ch_unmap()

bkamen's picture
bkamen
Junior(0)
I found the problem....

I found the problem....

it turns out dma_terminate_all(chan); is the way to go...

but I found 2 bugs in the FPGA DMA IP and 2 (maybe 3) bugs in the XIlinx Driver code.

Soooo... yay.