无法在 Petalinux2020.2 上预留内存?

问题描述

我正在使用 petalinux2020.2 和 RFSOC、zcu111 板构建一个项目,对于我的应用程序,我需要从 petalinux 保留一部分内存以用于 DMA,在 FPGA 的可编程逻辑上实现。 我尝试遵循 this tutorial,但在启动时出现错误。

enter image description here

以内核恐慌终止,如下所示:

enter image description here

我尝试使用 petalinux-config 命令修改内存大小,将内存大小设置为 0x70000000,但没有帮助。

此处显示了设备树的条目:

/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>;
    };
};

我怎样才能做到这一点?

解决方法

我在 Zynq-7020 板上运行 PetaLinux 2018.1,可以成功为我的 DMA 操作保留内存。虽然不是您的确切设置,但它应该足够相似。您需要调整内存地址以适合您的系统。

我正在使用 DMA API“shared-dma-pool”属性。这样我的设备驱动程序将使用我的保留空间而不是默认的 CMA 池。

另外,请注意,在将 vmalloc=512M 语句添加到 bootargs 之前,我在保留内存时遇到了问题。虽然我只为 DMA 保留了 256MB,I needed to vmalloc a larger value(在我的情况下是两倍)来让事情工作。

我的设备树条目:

/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>;
    };
}

显示保留内存的控制台:   I

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...