Closed rockybulwinkle closed 3 years ago
1GiB seems to be working fine. Here's the fragment for that. I think the most notable difference, besides the change to 1GiB instead of 512MiB, is I remove the #size-cells=<2>.
/include/ "system-conf.dtsi"
/ {
memory {
device_type = "memory";
/*
Notes:
first 512MB is normal
next 1GB at HPM0 is for u-dma-buf
next 1GB is PS DRAM
Final 2GB is the rest of PS Ram
*/
reg = <0x0 0x0 0x0 0x20000000
0x4 0x00000000 0x0 0x40000000
0x0 0x40000000 0x0 0x40000000
0x8 0x0 0x0 0x80000000
>;
};
reserved-memory {
#address-cells = <2>;
#size-cells = <2>;
ranges;
image_buf0: image_buf@400000000 {
compatible = "shared-dma-pool";
reusable;
reg = <0x4 0x00000000 0x0 0x40000000>;
label = "image_buf0";
};
};
udmabuf@400000000 {
compatible = "ikwzm,u-dma-buf";
device-name = "udmabuf0";
size = <0x40000000>;
dma-mask = <64>;
memory-region = <&image_buf0>;
};
};
Thank you for the issue.
From the logs, it seems that dma_alloc_coherent() is trying to allocate a 4GiB buffer and is failing. dma_alloc_coherent() is a dma-mapping API inside the Linux Kernel, and if you guess it from the phenomenon that it succeeds at 1GiB and fails at 4GiB, it might be something of a Linux Kernel limitation.
Solving this problem is difficult. Because I can't have enough hardware to reserve 4GiB for reserved-memory.
Please let me know if you know anything else.
I'll let you know. In the meantime I'm going to see if I can work around the issue by creating multiple smaller regions. We're using this in conjunction with https://github.com/electrorys/smalloc to allocate for our programs. If I can create multiple regions, I'll just mmap them into adjacent virtual addresses for the smalloc pool.
Thanks again!
This technique seems to be working well enough, thankfully.
This technique seems to be working well enough, thankfully.
This technique seems to be working well enough, thankfully.
We have had success using u-dma-buf with a 512MiB address space. Now we're trying to use the full 4GiB of our device and are running into an issue when we load the kernel module. Below is our dmesg output. We are running u-dma-buf version 3.2.2
Here is my device tree fragment for petalinux:
Do you see where this could be going wrong? Admittedly I jumped from 512MiB straight to 4GiB. I'm going to try a 1024MiB buffer size and report back.
Thanks again!
EDIT: corrected the previous sizes I tried