简体   繁体   English

无法在 Petalinux2020.2 上预留 memory?

[英]Cannot reserve memory on Petalinux2020.2?

I'm building a project using petalinux2020.2 and an RFSOC, zcu111 board, for my application I need to reserve a section of memory from petalinux to use with DMA, implemented on the programmable logic of the FPGA.我正在使用 petalinux2020.2 和 RFSOC、zcu111 板构建一个项目,对于我的应用程序,我需要从 petalinux 中保留一部分 memory 与 DMA 一起使用,在 FPGA 的可编程逻辑上实现。 I tried following this tutorial , but I get an error at boot time.我尝试按照本教程进行操作,但在启动时出现错误。 在此处输入图像描述

Which terminates with a kernel panic, shown here:它以 kernel 恐慌终止,如下所示: 在此处输入图像描述 I've tried to modify Memory Size by using petalinux-config command, setting the Memory Size to 0x70000000 but it did not help.我尝试使用 petalinux-config 命令修改 Memory 大小,将 Memory 大小设置为 0x70000000,但没有帮助。

The entry for the device tree is shown here:设备树的条目如下所示:

/include/ "system-conf.dtsi"
/{
    reserved-memory {
        #address-cells = <2>;
        #size-cells = <2>;
        ranges;
 
        reserved: buffer@0 {
            no-map;
            reg = <0x0 0x70000000 0x0 0x10000000>;
        };
    };
    reserved-driver@0 {
        compatible = "xlnx,reserved-memory";
        memory-region = <&reserved>;
    };
};

How can I make this work?我怎样才能使这项工作?

I'm running PetaLinux 2018.1 on a Zynq-7020 board and can successfully reserve memory for my DMA operations.我在 Zynq-7020 板上运行 PetaLinux 2018.1,并且可以成功地为我的 DMA 操作保留 memory。 While not your exact set up it should be similar enough.虽然不是您的确切设置,但它应该足够相似。 You'll need to adjust the memory addresses to suit your system.您需要调整 memory 地址以适合您的系统。

I'm using the DMA API "shared-dma-pool" property.我正在使用 DMA API “shared-dma-pool”属性。 That way my device driver will use my reserved space instead of the default CMA pool.这样我的设备驱动程序将使用我的保留空间而不是默认的 CMA 池。

Also, note that I had problems reserving the memory until I added the vmalloc=512M statement to the bootargs.另外,请注意,在我将vmalloc=512M语句添加到 bootargs 之前,我在保留 memory 时遇到了问题。 Although I was only reserving 256MB for DMA, I needed to vmalloc a larger value (double in my case) to get things to work.虽然我只为 DMA 保留了 256MB, 但我需要为 vmalloc 设置一个更大的值(在我的例子中是两倍)才能让事情正常工作。

My device tree entry:我的设备树条目:

/include/ "system-conf.dtsi"
/ {
    chosen {
    bootargs = "console=ttyPS0,115200 earlyprintk vmalloc=512M";
    stdout-path = "serial0:115200n8";
    };

reserved-memory {
        #address-cells = <1>;
        #size-cells = <1>;
        ranges;
 
            dma_reserved: buffer@30000000 {
        compatible = "shared-dma-pool";
            no-map;
        reg = <0x30000000 0x10000000>;
            };
    };

    //Required properties: 
    // - dmas: a list of <[DMA device phandle] [Channel ID]> pairs, 
    //         where Channel ID is (if both channels are enabled):
    //      '0' for write/tx channel
    //      '1' for read/rx channel 
    //     If only one channel is enabled, either tx or rx: 
    //      Channel ID is '0'. 
    // - dma-names: a list of DMA channel names, one per "dmas" entry 
    dma_proxy@0 {
        compatible ="xlnx,dma_proxy";
        dmas = <&axi_dma_0 0;
        dma-names = "dma1";
    memory-region = <&dma_reserved>;
    };
}

Console showing reserved memory:显示保留 memory 的控制台: 我

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM