-
Notifications
You must be signed in to change notification settings - Fork 184
Description
I'm building a Xilinx K26 MPSoC based system with DMA controllers which can access physical memory in the first 2GB of physical memory. This is mapped to lower half of the DRAM on this system (called HP0_DDR_LOW). With a single DMA controller, I have been successfully using udmabuf by loading the module manually with e.g. sudo insmod u-dma-buf.ko udmabuf0=0x20000000 which ends up in this memory region (presumably because this is where the CMA is located). However, I now want to add 2 DMA controllers and have given each one access to its own block in the middle of the top 1GB of HP0_DDR_LOW so, following your excellent instructions and a little bit of generative AI, I have added the following to my overlay device tree:
// Add your custom fragments, like the reserved memory
/{
fragment@1 {
target-path = "/reserved-memory";
__overlay__ {
core_0_dma_buf: core_0_dma_buf_mem@40000000 {
compatible = "shared-dma-pool";
reusable;
reg = <0x00 0x40000000 0x00 0x08000000>;
label = "core_0_dma_buf";
};
core_1_dma_buf: core_1_dma_buf_mem@60000000 {
compatible = "shared-dma-pool";
reusable;
reg = <0x00 0x60000000 0x00 0x08000000>;
label = "core_1_dma_buf";
};
};
};
fragment@2 {
target-path = "/"; // Target the root node
__overlay__ {
udmabuf_core0: udmabuf_core0 {
compatible = "ikwzm,u-dma-buf";
device-name = "udmabuf1";
size = <0x00 0x08000000>;
memory-region = <&core_0_dma_buf>;
};
udmabuf_core1: udmabuf_core1 {
compatible = "ikwzm,u-dma-buf";
device-name = "udmabuf2";
size = <0x00 0x08000000>;
memory-region = <&core_1_dma_buf>;
};
};
};
};which I believe should create two 128MB reserved regions in the region managed by CMA. However, after loading the device tree overlay with the bitstream using FPGA manager I am getting
u-dma-bug udmabuf_core0: of_reserved_mem_device_init failed. return=-22
errors for both cores. I'm a bit out of my depth here - am I missing something somewhere in the device tree overlay hence the invalid argument? As I understand it both u-dma-buf and reserved regions configured like this are allocated from the CMA so why can't I place my reserved regions there?
According to dmesg:
cma: Reserved 1000 MiB at 0x0000000037000000
so there is definitely enough space. Thank you in advance for your help, especially as I'm aware this is almost certainly not a udma-buf issue rather my lack of understanding of the Linux Kernel.