Jump to content
  • 0

dma-proxy device tree


mbritton

Question

Hello:

I am using PetaLinux and Vivado to compile PS/PL projects for a Zybo z7-20 board.   I would like to extend these projects to DMA between PS and PL.  To this end, I'm trying to create a device tree entry under PetaLinux for the xilinx dma-proxy kernel driver by following this example:

https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/1027702787/Linux+DMA+From+User+Space+2.0

based on the software available here:

https://github.com/Xilinx-Wiki-Projects/software-prototypes/tree/master/linux-user-space-dma

I have succeeded in configuring PetaLinux to compile the kernel module dma-proxy.ko and to compile the user-space test program dma-proxy-test.  These are bundled via petalinux-package, transmitted to the board via SD card, and are available when the board boots into linux.

My difficulty arises in the device tree.  As I understand from the online documentation at the first link above, modification of the device tree is required to utilize the driver.  Specifically, the section on the proxy device tree

https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/1027702787/Linux+DMA+From+User+Space+2.0?_ga=2.122547469.780816548.1679153960-1996714108.1676942251&_gac=1.16575362.1678039293.EAIaIQobChMIsL2du6_F_QIVYgetBh0UfAbkEAAYASAAEgL7BfD_BwE#Proxy-Device-Tree

 

Following this series of steps:

1) petalinux-create --type project --name zyboZ7 --source Zybo-Z7-20-Petalinux-2022-1.bsp

2) petalinux-config -p PetaLinux/zyboZ7/

 3) under DTG-settings enter full path to an extra dts/dtsi file, save and exit

4) create the dts/dtsi file based on guidance in the first link above.  The file I tried to use is called dma-proxy.dts and its entire contents appear below.  The file may be improperly formatted:  I have difficulty finding examples of Yocto dts/dtsi syntax online.

dma_proxy {  
  compatible ="xlnx,dma_proxy";
  dmas = <&axi_dma_0 0  &axi_dma_0 1>;
  dma-names = "dma_proxy_tx", "dma_proxy_rx";  
  dma-coherent;
} ;

5) petalinux-build -c kernel --project PetaLinux/zyboZ7

This command yields the error report below. 

 

[INFO] Sourcing buildtools
[INFO] Building kernel
[INFO] Sourcing build environment
[INFO] Generating workspace directory
INFO: bitbake virtual/kernel
NOTE: Started PRServer with DBfile: /mnt/2Tb/local/src/zyboZ7/build79/PetaLinux/zyboZ7/build/cache/prserv.sqlite3, Address: 127.0.0.1:34341, PID: 1250748
Loading cache: 100% |                                                                                            | ETA:  --:--:--
Loaded 0 entries from dependency cache.
Parsing recipes: 100% |###########################################################################################| Time: 0:03:19
Parsing of 3592 .bb files complete (0 cached, 3592 parsed). 5394 targets, 554 skipped, 0 masked, 0 errors.
NOTE: Resolving any missing task queue dependencies
NOTE: Fetching uninative binary shim file:///mnt/2Tb/local/src/zyboZ7/build79/PetaLinux/zyboZ7/components/yocto/downloads/uninative/126f4f7f6f21084ee140dac3eb4c536b963837826b7c38599db0b512c3377ba2/x86_64-nativesdk-libc-3.4.tar.xz;sha256sum=126f4f7f6f21084ee140dac3eb4c536b963837826b7c38599db0b512c3377ba2 (will check PREMIRRORS first)
Initialising tasks: 100% |########################################################################################| Time: 0:00:06
Checking sstate mirror object availability: 100% |################################################################| Time: 0:00:48
Sstate summary: Wanted 1966 Local 0 Network 1684 Missed 282 Current 0 (85% match, 0% complete)
NOTE: Executing Tasks
ERROR: device-tree-xilinx-v2022.1+gitAUTOINC+1b364a44fa-r0 do_compile: Error executing a python function in exec_func_python() autogenerated:

The stack trace of python calls that resulted in this exception/failure was:
File: 'exec_func_python() autogenerated', lineno: 2, function: <module>
     0001:
 *** 0002:devicetree_do_compile(d)
     0003:
File: '/mnt/2Tb/local/src/zyboZ7/build79/PetaLinux/zyboZ7/components/yocto/layers/core/meta/classes/devicetree.bbclass', lineno: 131, function: devicetree_do_compile
     0127:            if not(os.path.isfile(dtspath)) or not(dts.endswith(".dts") or devicetree_source_is_overlay(dtspath)):
     0128:                continue # skip non-.dts files and non-overlay files
     0129:        except:
     0130:            continue # skip if can't determine if overlay
 *** 0131:        devicetree_compile(dtspath, includes, d)
     0132:}
     0133:
     0134:devicetree_do_install() {
     0135:    for DTB_FILE in `ls *.dtb *.dtbo`; do
File: '/mnt/2Tb/local/src/zyboZ7/build79/PetaLinux/zyboZ7/components/yocto/layers/core/meta/classes/devicetree.bbclass', lineno: 119, function: devicetree_compile
     0115:        dtcargs += ["-i", i]
     0116:    dtcargs += ["-o", "{0}.{1}".format(dtname, "dtbo" if isoverlay else "dtb")]
     0117:    dtcargs += ["-I", "dts", "-O", "dtb", "{0}.pp".format(dts)]
     0118:    bb.note("Running {0}".format(" ".join(dtcargs)))
 *** 0119:    subprocess.run(dtcargs, check = True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
     0120:
     0121:python devicetree_do_compile() {
     0122:    includes = expand_includes("DT_INCLUDE", d)
     0123:    listpath = d.getVar("DT_FILES_PATH")
File: '/mnt/2Tb/tools/Xilinx/PetaLinux/2022.1/components/yocto/buildtools/sysroots/x86_64-petalinux-linux/usr/lib/python3.9/subprocess.py', lineno: 528, function: run
     0524:            # We don't call process.wait() as .__exit__ does that for us.
     0525:            raise
     0526:        retcode = process.poll()
     0527:        if check and retcode:
 *** 0528:            raise CalledProcessError(retcode, process.args,
     0529:                                     output=stdout, stderr=stderr)
     0530:    return CompletedProcess(process.args, retcode, stdout, stderr)
     0531:
     0532:
Exception: subprocess.CalledProcessError: Command '['dtc', '-@', '-p', '0x1000', '-@', '-i', '/mnt/2Tb/local/src/zyboZ7/build79/PetaLinux/zyboZ7/project-spec/configs/../../components/plnx_workspace/device-tree/device-tree', '-i', '/mnt/2Tb/local/src/zyboZ7/build79/PetaLinux/zyboZ7/build/tmp/work/zynq_generic-xilinx-linux-gnueabi/device-tree/xilinx-v2022.1+gitAUTOINC+1b364a44fa-r0/git/device_tree/data/kernel_dtsi/2022.1/BOARD/', '-i', '/mnt/2Tb/local/src/zyboZ7/build79/PetaLinux/zyboZ7/build/tmp/work/zynq_generic-xilinx-linux-gnueabi/device-tree/xilinx-v2022.1+gitAUTOINC+1b364a44fa-r0', '-i', '/mnt/2Tb/local/src/zyboZ7/build79/PetaLinux/zyboZ7/build/tmp/work-shared/zynq-generic/kernel-source/scripts/dtc/include-prefixes', '-i', '/mnt/2Tb/local/src/zyboZ7/build79/PetaLinux/zyboZ7/build/tmp/work-shared/zynq-generic/kernel-source/arch/arm/boot/dts', '-o', 'dma-proxy.dtb', '-I', 'dts', '-O', 'dtb', 'dma-proxy.dts.pp']' returned non-zero exit status 1.

Subprocess output:
Error: /mnt/2Tb/local/src/zyboZ7/build79/PetaLinux/zyboZ7/project-spec/configs/../../components/plnx_workspace/device-tree/device-tree/dma-proxy.dts:3.1-10 syntax error
FATAL ERROR: Unable to parse input tree

ERROR: Logfile of failure stored in: /mnt/2Tb/local/src/zyboZ7/build79/PetaLinux/zyboZ7/build/tmp/work/zynq_generic-xilinx-linux-gnueabi/device-tree/xilinx-v2022.1+gitAUTOINC+1b364a44fa-r0/temp/log.do_compile.1289115
ERROR: Task (/mnt/2Tb/local/src/zyboZ7/build79/PetaLinux/zyboZ7/components/yocto/layers/meta-xilinx/meta-xilinx-core/recipes-bsp/device-tree/device-tree.bb:do_compile) failed with exit code '1'
NOTE: Tasks Summary: Attempted 4873 tasks of which 4657 didn't need to be rerun and 1 failed.

 

Can you pls advise?

 

Many thanks
Matthew

 


 

 

 

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

After learning more about the device tree, I've found that I can decompile the system.dtb file created by petalinux:

 

dtc -I dtb -O dts -f system.dtb -o system.dts

 

This allows me to inspect the system.dts file and compare them to those at Xilinx's Linux Soft DMA Driver website.

https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/18842337/Linux+Soft+DMA+Driver?showComments=true&showCommentArea=true

 

When I do so, I find entries in system.dts that correspond to the video DMA entry at the above link:

        dma@43000000 {
            #dma-cells = <0x01>;
            clock-names = "s_axi_lite_aclk\0m_axi_s2mm_aclk\0s_axis_s2mm_aclk";
            clocks = <0x01 0x0f 0x1c 0x1c>;
            compatible = "generic-uio";
            interrupt-names = "s2mm_introut";
            interrupt-parent = <0x04>;
            interrupts = <0x00 0x1e 0x04>;
            reg = <0x43000000 0x10000>;
            xlnx,addrwidth = <0x20>;
            xlnx,flush-fsync = <0x01>;
            xlnx,num-fstores = <0x01>;
            phandle = <0x54>;

            dma-channel@43000030 {
                compatible = "xlnx,axi-vdma-s2mm-channel";
                interrupts = <0x00 0x1e 0x04>;
                xlnx,datawidth = <0x18>;
                xlnx,device-id = <0x00>;
                xlnx,genlock-mode;
                xlnx,include-dre;
            };
        };

The corresponding entry at the above link is

 

axi_vdma_0: dma@43000000 {
                        #dma-cells = <1>;
                        clock-names = "s_axi_lite_aclk", "m_axi_mm2s_aclk", "m_axi_mm2s_aclk", "m_axi_s2mm_aclk", "m_axi_s2mm_aclk";
                        clocks = <&clkc 15>, <&clkc 15>, <&clkc 15>, <&clkc 15>, <&clkc 15>;
                        compatible = "xlnx,axi-vdma-1.00.a";
                        interrupt-parent = <&intc>;
                        interrupts = <0 32 4 0 33 4>;
                        reg = <0x43000000 0x10000>;
                        xlnx,addrwidth = <0x20>;
                        xlnx,flush-fsync = <0x1>;
                        xlnx,num-fstores = <0x1>;
                        dma-channel@43000000 {
                                compatible = "xlnx,axi-vdma-mm2s-channel";
                                interrupts = <0 32 4>;
                                xlnx,datawidth = <0x20>;
                                xlnx,device-id = <0x0>;
                                xlnx,genlock-mode ;
                                xlnx,include-dre ;
                        };
                        dma-channel@43000030 {
                                compatible = "xlnx,axi-vdma-s2mm-channel";
                                interrupts = <0 33 4>;
                                xlnx,datawidth = <0x20>;
                                xlnx,device-id = <0x0>;
                                xlnx,genlock-mode ;
                                xlnx,include-dre ;
                        };
                };

 

I do not find entries that correspond to the DMA, CDMA, or MCDMA entries at the above link.  For example, a DMA entry starting with 

axi_dma_1: dma@40400000 {

 

Am I misconfiguring the petalinux device tree?  I've tried compiling with a project-spec/meta-user/recipes-kernel/linux/linux-xlnx/bsp.cfg file containing

# CONFIG_PL330_DMA is not set
CONFIG_DMADEVICES=y
CONFIG_XILINX_DMA=y
CONFIG_XILINX_DMATEST=m
CONFIG_XILINX_FRMBUF=y
 

This does not produce a different outcome.

 

Many thanks

Matthew

 

 

 

Link to comment
Share on other sites

  • 0

File <petalinux_project>components/plnx_workspace/device-tree/device-tree/pl.dtsi is where node axi_dma_0 or axi_dma_1 is generated according to hardware description in .xsa file imported with petalinux-config --get-hw-description=<path-to-xsa> (see UG1144).

Dose your design(exported from Vivado) contains any axi_dma component? Only then a node in device tree is added for it.

You need to also understand where dma_proxy node should be placed inside device tree. Normally under amba_pl. Use & when extending in system-user.dtsi

example:

&amba_pl {
  dma_proxy {
    ..
  };
};

Does axi_dma_0 component exist in pl.dtsi because it is referred by dma_proxy?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...