Hi,
I have created a kernel that just creates a "ramp" and stores it to global memory. First I tried creating a buffer of 1024 elements of data type uint16_t (in total 2048 bytes), and I was suprised when the buffer was allocated outside the CMA region:
[ 0.000000] cma: Reserved 900 MiB at 0x000000003f200000
To be more specific, as indicated by the physical address reported by xclGetBOProperties the buffer was allocated in the high memory address of the device.
EXE: /home/petalinux/ramp_host
[XRT] INFO: shim
INFO: Programming device[0]: edge
[XRT] INFO: xclLoadAxlf: flags 0x0, return 0
[XRT] INFO: xclLoadXclBin: return 0
[XRT] DEBUG: xclAllocBO: size 4096, flags 0x80000000
[XRT] INFO: xclAllocBO: ioctl return 0, bo handle 1
[XRT] DEBUG: xclFreeBO: boHandle -1, ioctl return -1
[XRT] INFO: xclMapBO: mmap return 0xffffbde2a000
[XRT] DEBUG: xclExecBuf: cmdBO handle 1, ioctl return 0
[XRT] DEBUG: xclFreeBO: boHandle 1, ioctl return 0
Device[0]: program successful!
[XRT] DEBUG: xclAllocBO: size 4096, flags 0x80000000
[XRT] INFO: xclAllocBO: ioctl return 0, bo handle 1
[XRT] INFO: xclMapBO: mmap return 0xffffbde2a000
[XRT] DEBUG: xclAllocBO: size 2048, flags 0x1000000
[XRT] INFO: xclAllocBO: ioctl return 0, bo handle 2
[XRT] INFO: xclMapBO: mmap return 0xffffbde29000
Launching Kernel with 1024 elements...
[XRT] DEBUG: xclAllocBO: size 4096, flags 0x80000000
[XRT] INFO: xclAllocBO: ioctl return 0, bo handle 3
[XRT] INFO: xclMapBO: mmap return 0xffffbde28000
**[XRT] DEBUG: xclGetBOProperties: boHandle 2, size 1000, paddr 0x8022a6000**
[XRT] DEBUG: xclExecBuf: cmdBO handle 3, ioctl return 0
[XRT] DEBUG: xclSyncBO: boHandle 2, dir 1, size 2048, offset 0
[XRT] INFO: xclSyncBO: ioctl return 0
Error: Result mismatch:
i = 1 CPU result = 1 Device result = 0
[XRT] DEBUG: xclSyncBO: boHandle 2, dir 0, size 2048, offset 0
[XRT] INFO: xclSyncBO: ioctl return 0
TEST FAILED
[XRT] DEBUG: xclFreeBO: boHandle 3, ioctl return 0
[XRT] DEBUG: xclFreeBO: boHandle 1, ioctl return 0
[XRT] DEBUG: xclFreeBO: boHandle 2, ioctl return 0
[XRT] INFO: ~shim
I was basically losing my mind because I though there was something wrong with my platform. Then I tried to create a larger buffer (specifically >4KB) for this, and I was suprised because this time the buffer was allocated in the CMA region:
XRT build version: 2.16.0
Build hash: 2865a62b6a417dea523d2d5646154aa94a2cbc28
Build date: 2023-10-06 21:08:57
Git branch: 2023.2
PID: 4783
UID: 1000
[Tue Mar 3 15:48:26 2026 GMT]
HOST:
EXE: /home/petalinux/ramp_host
[XRT] INFO: shim
INFO: Programming device[0]: edge
[XRT] INFO: xclLoadAxlf: flags 0x0, return 0
[XRT] INFO: xclLoadXclBin: return 0
[XRT] DEBUG: xclAllocBO: size 4096, flags 0x80000000
[XRT] INFO: xclAllocBO: ioctl return 0, bo handle 1
[XRT] DEBUG: xclFreeBO: boHandle -1, ioctl return -1
[XRT] INFO: xclMapBO: mmap return 0xffff89f5c000
[XRT] DEBUG: xclExecBuf: cmdBO handle 1, ioctl return 0
[XRT] DEBUG: xclFreeBO: boHandle 1, ioctl return 0
Device[0]: program successful!
[XRT] DEBUG: xclAllocBO: size 4096, flags 0x80000000
[XRT] INFO: xclAllocBO: ioctl return 0, bo handle 1
[XRT] INFO: xclMapBO: mmap return 0xffff89f5c000
[XRT] DEBUG: xclAllocBO: size 4098, flags 0x1000000
[XRT] INFO: xclAllocBO: ioctl return 0, bo handle 2
[XRT] INFO: xclMapBO: mmap return 0xffff89f5a000
Launching Kernel with 2049 elements...
[XRT] DEBUG: xclAllocBO: size 4096, flags 0x80000000
[XRT] INFO: xclAllocBO: ioctl return 0, bo handle 3
[XRT] INFO: xclMapBO: mmap return 0xffff89f59000
[XRT] DEBUG: xclGetBOProperties: boHandle 2, size 2000, paddr 0x3f340000
[XRT] DEBUG: xclExecBuf: cmdBO handle 3, ioctl return 0
[XRT] DEBUG: xclSyncBO: boHandle 2, dir 1, size 4098, offset 0
[XRT] INFO: xclSyncBO: ioctl return 0
[XRT] DEBUG: xclSyncBO: boHandle 2, dir 0, size 4098, offset 0
[XRT] INFO: xclSyncBO: ioctl return 0
TEST PASSED
[XRT] DEBUG: xclFreeBO: boHandle 3, ioctl return 0
[XRT] DEBUG: xclFreeBO: boHandle 1, ioctl return 0
[XRT] DEBUG: xclFreeBO: boHandle 2, ioctl return 0
[XRT] INFO: ~shim
I could not find anything related to this issue. Is this related to the linux kernel page size (4KB)? Because if the buffer is smaller than this then zocl just can't place the buffer in the CMA region.
What is the process of allocating a Buffer Object? What does the zocl driver do when it receives an ioctl call to create a new buffer?
On another note, but perhaps related, this has also happened to me with some zynqMP-based platforms that had a dedicated memory bank for the PL (with a MIG) that I wanted to use to connect the kernels. Something similar happened to me; the driver seemed to have a “fallback” to allocate the buffers in the DDR High part. In the case of these platforms with PL-DDR, what does the driver need to be able to use these memory addresses correctly?
Thanks!
Hi,
I have created a kernel that just creates a "ramp" and stores it to global memory. First I tried creating a buffer of 1024 elements of data type uint16_t (in total 2048 bytes), and I was suprised when the buffer was allocated outside the CMA region:
[ 0.000000] cma: Reserved 900 MiB at 0x000000003f200000To be more specific, as indicated by the physical address reported by xclGetBOProperties the buffer was allocated in the high memory address of the device.
I was basically losing my mind because I though there was something wrong with my platform. Then I tried to create a larger buffer (specifically >4KB) for this, and I was suprised because this time the buffer was allocated in the CMA region:
I could not find anything related to this issue. Is this related to the linux kernel page size (4KB)? Because if the buffer is smaller than this then zocl just can't place the buffer in the CMA region.
What is the process of allocating a Buffer Object? What does the zocl driver do when it receives an ioctl call to create a new buffer?
On another note, but perhaps related, this has also happened to me with some zynqMP-based platforms that had a dedicated memory bank for the PL (with a MIG) that I wanted to use to connect the kernels. Something similar happened to me; the driver seemed to have a “fallback” to allocate the buffers in the DDR High part. In the case of these platforms with PL-DDR, what does the driver need to be able to use these memory addresses correctly?
Thanks!