Git Product home page Git Product logo

Comments (7)

durellinux avatar durellinux commented on August 17, 2024

from zedboard_linux_dma_driver.

nick1chao avatar nick1chao commented on August 17, 2024

Thank you for your answer.
The addresses used in the Vivado project is:

axi_dma_0 0x40400000
axi_dma_1 0x40410000
axi_dma_2 0x40420000
axi_dma_3 0x40430000

And here is my device tree:
amba_pl: amba_pl {
#address-cells = <1>;
#size-cells = <1>;
compatible = "simple-bus";
ranges ;
axi_dma_0: dma@40400000 {
#dma-cells = <1>;
clock-names = "s_axi_lite_aclk", "m_axi_sg_aclk", "m_axi_mm2s_aclk", "m_axi_s2mm_aclk";
clocks = <&clkc 15>, <&clkc 15>, <&clkc 15>, <&clkc 15>;
compatible = "xlnx,axi-dma-1.00.a";
interrupt-parent = <&intc>;
interrupts = <0 29 4 0 30 4>;
reg = <0x40400000 0x10000>;
xlnx,addrwidth = <0x20>;
dma-channel@40400000 {
compatible = "xlnx,axi-dma-mm2s-channel";
dma-channels = <0x1>;
interrupts = <0 29 4>;
xlnx,datawidth = <0x20>;
xlnx,device-id = <0x0>;
};
dma-channel@40400030 {
compatible = "xlnx,axi-dma-s2mm-channel";
dma-channels = <0x1>;
interrupts = <0 30 4>;
xlnx,datawidth = <0x20>;
xlnx,device-id = <0x0>;
};
};
axi_dma_1: dma@40410000 {
#dma-cells = <1>;
clock-names = "s_axi_lite_aclk", "m_axi_sg_aclk", "m_axi_mm2s_aclk", "m_axi_s2mm_aclk";
clocks = <&clkc 15>, <&clkc 15>, <&clkc 15>, <&clkc 15>;
compatible = "xlnx,axi-dma-1.00.a";
interrupt-parent = <&intc>;
interrupts = <0 31 4 0 32 4>;
reg = <0x40410000 0x10000>;
xlnx,addrwidth = <0x20>;
dma-channel@40410000 {
compatible = "xlnx,axi-dma-mm2s-channel";
dma-channels = <0x1>;
interrupts = <0 31 4>;
xlnx,datawidth = <0x20>;
xlnx,device-id = <0x1>;
};
dma-channel@40410030 {
compatible = "xlnx,axi-dma-s2mm-channel";
dma-channels = <0x1>;
interrupts = <0 32 4>;
xlnx,datawidth = <0x20>;
xlnx,device-id = <0x1>;
};
};
axi_dma_2: dma@40420000 {
#dma-cells = <1>;
clock-names = "s_axi_lite_aclk", "m_axi_sg_aclk", "m_axi_mm2s_aclk", "m_axi_s2mm_aclk";
clocks = <&clkc 15>, <&clkc 15>, <&clkc 15>, <&clkc 15>;
compatible = "xlnx,axi-dma-1.00.a";
interrupt-parent = <&intc>;
interrupts = <0 33 4 0 34 4>;
reg = <0x40420000 0x10000>;
xlnx,addrwidth = <0x20>;
dma-channel@40420000 {
compatible = "xlnx,axi-dma-mm2s-channel";
dma-channels = <0x1>;
interrupts = <0 33 4>;
xlnx,datawidth = <0x20>;
xlnx,device-id = <0x2>;
};
dma-channel@40420030 {
compatible = "xlnx,axi-dma-s2mm-channel";
dma-channels = <0x1>;
interrupts = <0 34 4>;
xlnx,datawidth = <0x20>;
xlnx,device-id = <0x2>;
};
};
axi_dma_3: dma@40430000 {
#dma-cells = <1>;
clock-names = "s_axi_lite_aclk", "m_axi_sg_aclk", "m_axi_mm2s_aclk", "m_axi_s2mm_aclk";
clocks = <&clkc 15>, <&clkc 15>, <&clkc 15>, <&clkc 15>;
compatible = "xlnx,axi-dma-1.00.a";
interrupt-parent = <&intc>;
interrupts = <0 35 4 0 36 4>;
reg = <0x40430000 0x10000>;
xlnx,addrwidth = <0x20>;
dma-channel@40430000 {
compatible = "xlnx,axi-dma-mm2s-channel";
dma-channels = <0x1>;
interrupts = <0 35 4>;
xlnx,datawidth = <0x20>;
xlnx,device-id = <0x3>;
};
dma-channel@40430030 {
compatible = "xlnx,axi-dma-s2mm-channel";
dma-channels = <0x1>;
interrupts = <0 36 4>;
xlnx,datawidth = <0x20>;
xlnx,device-id = <0x3>;
};
};
};

The addresses is same.
Where there is a problem?

from zedboard_linux_dma_driver.

fspada avatar fspada commented on August 17, 2024

Hi,
it seems there are 2 errors here:
1 - the compatible string doesn't match with the driver: To correctly use the driver change the compatible attribute in:
compatible = "ds_axidma";
2 - in the dts change the description of the device from

axi_dma_0: dma@4040000 {
#dma-cells = <1>;
clock-names = "s_axi_lite_aclk", "m_axi_sg_aclk", "m_axi_mm2s_aclk", "m_axi_s2mm_aclk";
clocks = <&clkc 15>, <&clkc 15>, <&clkc 15>, <&clkc 15>;
compatible = "xlnx,axi-dma-1.00.a";
interrupt-parent = <&intc>;
interrupts = <0 29 4 0 30 4>;
reg = <0x40400000 0x10000>;
xlnx,addrwidth = <0x20>;
dma-channel@4040000 {
compatible = "xlnx,axi-dma-mm2s-channel";
dma-channels = <0x1>;
interrupts = <0 29 4>;
xlnx,datawidth = <0x20>;
xlnx,device-id = <0x0>;
};
dma-channel@4040003 {
compatible = "xlnx,axi-dma-s2mm-channel";
dma-channels = <0x1>;
interrupts = <0 30 4>;
xlnx,datawidth = <0x20>;
xlnx,device-id = <0x0>;
};
};

to
axi_dma_1: axi-dma1@4040000 {
compatible = "ds_axidma";
reg = <0x40400000 0x10000>;
} ;
also for axi_dma_1 axi_dma_2 and axi_dma_3.
The driver only needs the compatible and reg attributes. All the rest (interrupts, dual channel) is not supported.

from zedboard_linux_dma_driver.

fspada avatar fspada commented on August 17, 2024

Use this https://github.com/durellinux/ZedBoard_Linux_DMA_driver/blob/master/bootFiles/xilinx.dts
as an example of correct dts.

from zedboard_linux_dma_driver.

nick1chao avatar nick1chao commented on August 17, 2024

Hi
I have already changed the device tree,the compatible is same with the driver.But the error is still on.
Here is my device tree:

           axi-dma1@40400000 {
                    compatible = "ds_axidma";
                    reg = <0x40400000 0x10000>;
            };

            axi-dma2@40410000 {
                    compatible = "ds_axidma";
                    reg = <0x40410000 0x10000>;
            };

            axi-dma3@40420000 {
                    compatible = "ds_axidma";
                    reg = <0x40420000 0x10000>;
            };

            axi-dma4@40430000 {
                    compatible = "ds_axidma";
                    reg = <0x40430000 0x10000>;
            };

The insmod command is ok:
root@dmaRegister:/lib/modules/4.6.0-xilinx/extra# insmod dmatest.ko
init: registered
DMA_LENGTH = 32768
init: registered
DMA_LENGTH = 32768
init: registered
DMA_LENGTH = 32768
init: registered
DMA_LENGTH = 32768

But run the application,the error log:

ARM 1 3 0.333333 0
Unhandled fault: page domain fault (0x01b) at 0x00022008
pgd = de5e4000
[00022008] *pgd=1e4d5831, *pte=00ae375f, *ppte=00ae3c7f
Internal error: Oops - BUG: 1b [#2] PREEMPT SMP ARM
Modules linked in: dmatest(O) ipv6 [last unloaded: dmatest]
CPU: 1 PID: 1039 Comm: dmaapp Tainted: G D O 4.6.0-xilinx #4
Hardware name: Xilinx Zynq Platform
task: de5f85c0 ti: ddcba000 task.ti: ddcba000
PC is at memcpy+0xc0/0x330
LR is at ds_axidma_write+0x30/0xa4 [dmatest]
pc : [] lr : [] psr: 800c0013
sp : ddcbbedc ip : 0f400000 fp : 00000003
r10: 00000000 r9 : ddcba000 r8 : c0107084
r7 : 00022008 r6 : 00022008 r5 : de428080 r4 : 00000001
r3 : de4280d8 r2 : 80000000 r1 : 00022008 r0 : df048000
Flags: Nzcv IRQs on FIQs on Mode SVC_32 ISA ARM Segment none
Control: 18c5387d Table: 1e5e404a DAC: 00000051
Process dmaapp (pid: 1039, stack limit = 0xddcba210)
Stack: (0xddcbbedc to 0xddcbc000)
bec0: df048000
bee0: 00000001 bf061408 00000001 bf0613d8 ddcbbf88 00022008 c0107084 c01c5ff0
bf00: 00000000 00000000 00000000 ddcbbf10 00000000 00000000 00000400 de48e000
bf20: 00000006 de63bb18 00000006 de63bb40 00000002 de63bb00 00000001 de594600
bf40: ddcbbf88 00000001 de594600 00000001 de594600 ddcbbf88 00022008 c01c6c0c
bf60: de594600 00022008 00000001 de594600 de594600 00022008 00000001 c0107084
bf80: ddcba000 c01c775c 00000000 00000000 00000001 00000000 00000001 00000001
bfa0: 00000004 c0106ec0 00000000 00000001 00000003 00022008 00000001 00022008
bfc0: 00000000 00000001 00000001 00000004 00000006 00000005 00000004 00000003
bfe0: 00000000 befd9c2c 00010b40 b6f308e0 600c0010 00000003 4241403f 46454443
[] (memcpy) from [] (ds_axidma_write+0x30/0xa4 [dmatest])
[] (ds_axidma_write [dmatest]) from [] (__vfs_write+0x1c/0x)
[] (__vfs_write) from [] (vfs_write+0xa8/0x130)
[] (vfs_write) from [] (SyS_write+0x40/0x80)
[] (SyS_write) from [] (ret_fast_syscall+0x0/0x3c)
Code: e4808004 e480e004 e8bd01e0 e1b02f82 (14d13001)
---[ end trace ec921171af79cdd8 ]---
Segmentation fault

I use the petalinux 2016.3,kernel version is 4.6.0 and the board is zedboard.
Where is the problem may occur.

from zedboard_linux_dma_driver.

fspada avatar fspada commented on August 17, 2024

It seems that the page fault is generated by the memcpy.
In the ds_axidma_write function substitute the memcpy with copy_from_user function, here the signature:
static inline long copy_from_user(void *to, const void __user * from, unsigned long n)

also in ds_axidma_read substitute memcpy with copy_to_user function, here the signature:
static inline long copy_to_user(void __user *to, const void *from, unsigned long n)

I think we have to fix the driver.

from zedboard_linux_dma_driver.

fspada avatar fspada commented on August 17, 2024

Let me know if this works.

from zedboard_linux_dma_driver.

Related Issues (6)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.