bmartini / zynq-xdma

Linux Driver for the Zynq FPGA DMA engine
86 stars 38 forks source link

Interrupt issue with the test application #5

Closed kuldeepj closed 9 years ago

kuldeepj commented 9 years ago

Hello, I tried ur code with a loopback AXI DMA on zc702 board. the relevant dts is

    &ps7_axi_interconnect_0 {
        ranges;
        axi_dma_0: axi-dma@40400000 {
            compatible = "xlnx,axi-dma";
            interrupt-parent = <&ps7_scugic_0>;
            interrupts = <0 30 4>, <0 29 4>;
            reg = <0x40400000 0x10000>;
            dma-channel@40400000 {
                compatible = "xlnx,axi-dma-mm2s-channel";
                interrupts = <0 30 4>;
                xlnx,datawidth = <0x20>;
                xlnx,device-id = <0x0>;
                xlnx,include-dre ;
            } ;
            dma-channel@40400030 {
                compatible = "xlnx,axi-dma-s2mm-channel";
                interrupts = <0 29 4>;
                xlnx,datawidth = <0x20>;
                xlnx,device-id = <0x0>;
                xlnx,include-dre ;
            } ;
        } ;

I am using the latest kernel 3.18 of linux-xlnx the module is properly getting loaded but I am getting a following error in the dmesg listing below

<xdma> init: registered
<xdma> probe: number of devices found: 1
<xdma> file: open()
<xdma> ioctl: XDMA_TEST_TRANSFER
<xdma> test: rx buffer before transmit:
Y   Y   Y   Y   Y   Y   Y   Y   Y   Y   
<xdma> test: xdma_start_transfer rx
<xdma> test: xdma_start_transfer tx
<xdma> test: time to prepare DMA channels [us]: 30
irq 61: nobody cared (try booting with the "irqpoll" option)
CPU: 0 PID: 0 Comm: swapper/0 Tainted: G           O   3.18.0-xilinx-06499-ge753fa3-dirty #7
[<400148b8>] (unwind_backtrace) from [<40010da4>] (show_stack+0x10/0x14)
[<40010da4>] (show_stack) from [<404697bc>] (dump_stack+0x90/0xd4)
[<404697bc>] (dump_stack) from [<40050bf0>] (__report_bad_irq+0x28/0xb8)
[<40050bf0>] (__report_bad_irq) from [<4005109c>] (note_interrupt+0x1ec/0x290)
[<4005109c>] (note_interrupt) from [<4004f258>] (handle_irq_event_percpu+0xd0/0xe0)
[<4004f258>] (handle_irq_event_percpu) from [<4004f2a4>] (handle_irq_event+0x3c/0x5c)
[<4004f2a4>] (handle_irq_event) from [<40051b38>] (handle_fasteoi_irq+0xa4/0x11c)
[<40051b38>] (handle_fasteoi_irq) from [<4004ea1c>] (generic_handle_irq+0x20/0x30)
[<4004ea1c>] (generic_handle_irq) from [<4004ecb0>] (__handle_domain_irq+0x7c/0xa0)
[<4004ecb0>] (__handle_domain_irq) from [<400085ac>] (gic_handle_irq+0x38/0x5c)
[<400085ac>] (gic_handle_irq) from [<40011740>] (__irq_svc+0x40/0x74)
Exception stack(0x40667e70 to 0x40667eb8)
7e60:                                     40667eb8 00000000 00000000 00000000
7e80: 00000040 40666038 00000000 7e002000 00000001 4069b238 00200000 406a3480
7ea0: 0000000a 40667eb8 40057ce0 400233ac 60070113 ffffffff
[<40011740>] (__irq_svc) from [<400233ac>] (__do_softirq+0x78/0x1c8)
[<400233ac>] (__do_softirq) from [<400236f0>] (irq_exit+0x58/0xac)
[<400236f0>] (irq_exit) from [<4004ecb4>] (__handle_domain_irq+0x80/0xa0)
[<4004ecb4>] (__handle_domain_irq) from [<400085ac>] (gic_handle_irq+0x38/0x5c)
[<400085ac>] (gic_handle_irq) from [<40011740>] (__irq_svc+0x40/0x74)
Exception stack(0x40667f30 to 0x40667f78)
7f20:                                     a6990950 00000069 00000018 fffffff8
7f40: a6970ccd 00000069 00000000 7e7d0f30 4069b238 4069b238 4066e4d4 00000000
7f60: 00000008 40667f78 4005e07c 40362edc 90070013 ffffffff
[<40011740>] (__irq_svc) from [<40362edc>] (cpuidle_enter_state+0x4c/0xc0)
[<40362edc>] (cpuidle_enter_state) from [<40048170>] (cpu_startup_entry+0x17c/0x204)
[<40048170>] (cpu_startup_entry) from [<40631bc0>] (start_kernel+0x328/0x388)
handlers:
[<4020b000>] dma_intr_handler
Disabling IRQ #61
<xdma> Error: transfer timed out
<xdma> test: DMA transfer time [us]: -3682
<xdma> test: DMA bytes sent: 1024
<xdma> test: DMA speed in Mbytes/s: 0
<xdma> test: rx buffer after transmit:
Y   Y   Y   Y   Y   Y   Y   Y   Y   Y   
<xdma> file: close()

I could see a similar query on the net at link http://stackoverflow.com/questions/29213401/linux-interrupt-is-not-handled-by-the-wrapper-driver the gentleman is trying to implement similar wrapper as u have implemented.

I guess I must be missing out something, ur help in this regard will be greatly appreciated. Thank you in advance.

bmartini commented 9 years ago

The zynq-xdma project is not being actively updated by me. I'll accept any patches or fixes but the rapid change of Xilinx code changes got too much for me to keep up with.

I have an alternative project that replaced the Xilinx DMA Engine, kernel driver etc:

https://github.com/bmartini/zynq-axis

The zynq-aixs project does everything that the zynq-xdma project does but is also easier to control from the FPGA. When I replaced all the xdma to axis in my projects I was able to get a reduced resource utilization and a better speed.

If you do fine a solution to your problem feel, free to send me the patch and I'll pull.

kuldeepj commented 9 years ago

Thank you for the prompt response. I am presently going through the zynq-axis, I see that you have made your custom logic and interfaced it to the S_AXI_HP bus . I am presently using the AXI DMA IP. Any pointers in regards of using the zynq-axis with AXI DMA IP will be greatly appreciated. I could understand mapping of the configuration registers using the UIO framework, however I could not understand the mapping of MM2S and S2MM channels (wrt to the address map of the vivado hardware project)

As soon as I am able to debug the DMA engine wrapper code I will post it.

Thank you in advance.

kuldeepj commented 9 years ago

I checked the devicetree/bindings/dma/xilinx documentation and commented out the following line

interrupts = <0 30 4>, <0 29 4>;

the irqpoll error vanished. Now I am getting this output

<xdma> init: registered
<xdma> probe: number of devices found: 1
random: nonblocking pool is initialized
<xdma> file: open()
<xdma> ioctl: XDMA_TEST_TRANSFER
<xdma> test: rx buffer before transmit:
Y   Y   Y   Y   Y   Y   Y   Y   Y   Y
<xdma> test: xdma_start_transfer rx
<xdma> test: xdma_start_transfer tx
<xdma> test: time to prepare DMA channels [us]: 29
<xdma> Error: transfer timed out
<xdma> test: DMA transfer time [us]: -3405
<xdma> test: DMA bytes sent: 1024
<xdma> test: DMA speed in Mbytes/s: 0
<xdma> test: rx buffer after transmit:
Y   Y   Y   Y   Y   Y   Y   Y   Y   Y
<xdma> file: close()
root@linaro-ubuntu-desktop:~# /build/zynq-xdma/demo/app
test: dst buffer before transmit:
A   A   A   A   A   A   A   A   A   A
test: dst buffer after transmit:
A   A   A   A   A   A   A   A   A   A
root@linaro-ubuntu-desktop:~# /build/zynq-xdma/demo/
.Xil/      .settings/ app        demo       test       
root@linaro-ubuntu-desktop:~# /build/zynq-xdma/demo/demo 
test: rx buffer before transmit:
C   C   C   C   C   C   C   C   C   C
Number of devices: 1
devices tx chan: 7e0bb8b4, tx cmp:7e145080, rx chan: 7e0bb7f4, rx cmp: 7e145100
config rx chans
config tx chans
config rx buffer
config tx buffer
config rx trans
config tx trans
test: rx buffer after transmit:
C   C   C   C   C   C   C   C   C   C

I am unable to transfer the data. I am checking for bugs. Will the difference between address range/map in Vivado and the driver cause this problem? Will keep you posted though. Thank you in advance.

kuldeepj commented 9 years ago

Your code is working fine for Direct DMA. I had limited the addresses mapping in the Vivado to just 4MB for the AXI DMA. I guess the DMA engine was using some other base address, and hence the Address Decode Error as

xilinx-dma 40400000.dma: Channel 8dfe8590 has errors 41, cdr 0 tdr 0

After changing the address map in Vivado to cover the whole 1GB, the error is no longer present. One curious question though, If I wish to restrict the physical address used by the dmaengine/axidma driver, how do you go about it? Thank you for your help and sharing great piece of code.

Chihhsiangchen commented 6 years ago

Hi Kildeepj and bmartini,

I encounter the same Error as belows: xilinx-vdma 40400000.dma: Channel 8dfe8590 has errors 41, cdr 0 tdr 0

I have tried your solutions to change the address map in Vivado to 1GB. But the issue still there.

Do you have any idea?