Allocate fails with error

PYNQ Version =3.0.1
Board = Zynq Mini ITX XC7Z045

Code snippet
import traceback
import numpy as np
from pynq import allocate
from pynq import Overlay

overlays = Overlay(“./pynq/overlays/dma.bit”, download=False)
dma = overlays.ADC_DAC_DMA
input_buffer = allocate(shape=(5,), dtype=‘u4’)
output_buffer = allocate(shape=(5,), dtype=‘u4’)

Error:
oot@pynq:/home/xilinx/daffodil-app# python dma.py
XRT build version: 2.13.0
Build hash: f5505e402c2ca1ffe45eb6d3a9399b23a0dc8776
Build date: 2022-10-21 17:40:17
Git branch: temp
PID: 6450
UID: 0
[Tue Jan 7 17:21:21 2025 GMT]
HOST:
EXE: /usr/bin/python3.10
[XRT] ERROR: boost::filesystem::directory_iterator::construct: No such file or directory: “/dev/dri/by-path/”
Traceback (most recent call last):
File “/home/xilinx/daffodil-app/dma.py”, line 8, in
input_buffer = allocate(shape=(5,), dtype=‘u4’)
File “/home/xilinx/daffodil-app/pynq/buffer.py”, line 158, in allocate
return target.allocate(shape, dtype, **kwargs)
File “/home/xilinx/daffodil-app/pynq/pl_server/device.py”, line 145, in allocate
return self.default_memory.allocate(shape, dtype, **kwargs)
File “/home/xilinx/daffodil-app/pynq/pl_server/xrt_device.py”, line 156, in allocate
buf = _xrt_allocate(shape, dtype, self.device, self.idx, **kwargs)
File “/home/xilinx/daffodil-app/pynq/pl_server/xrt_device.py”, line 104, in _xrt_allocate
bo = device.allocate_bo(size, memidx, cacheable)
File “/home/xilinx/daffodil-app/pynq/pl_server/xrt_device.py”, line 410, in allocate_bo
raise RuntimeError("Allocate failed: " + str(bo))
RuntimeError: Allocate failed: 4294967274

Hi @Karthick_Ramu,

Looks like you built your own PYNQ SD card image for this board.
This error could be because the reserved CMA memory is not part of the device tree.

If you check the dmesg log, you may find more information.

Have you tried MMIO access?

Mario

My device tree does have DMA in it

ADC_DAC_DMA_axi_dma_0: dma@4101c000 {
#dma-cells = <1>;
clock-names = “s_axi_lite_aclk”, “m_axi_mm2s_aclk”;
clocks = <&clkc 15>, <&clkc 15>;
compatible = “xlnx,axi-dma-7.1”, “xlnx,axi-dma-1.00.a”;
interrupt-names = “mm2s_introut”;
interrupt-parent = <&intc>;
interrupts = <0 32 4>;
reg = <0x4101c000 0x1000>;
xlnx,addrwidth = <0x20>;
xlnx,sg-length-width = <0xe>;
dma-channel@4101c000 {
compatible = “xlnx,axi-dma-mm2s-channel”;
dma-channels = <0x1>;
interrupts = <0 32 4>;
xlnx,datawidth = <0x20>;
xlnx,device-id = <0x0>;
};

No I have not tried MMIO

I am referring to the CMA (Contiguous Memory Allocation) entry, not DMA.
allocate needs CMA.

Did you check dmesg?

There is no entry for CMA in device tree. Can you show me an example of how it looks?

Here is my dmesg entry

[ 0.000000] Memory: 892868K/1048576K available (9216K kernel code, 326K rwdata, 2540K rodata, 1024K init, 294K bss, 24636K reserved, 131072K cma-reserved, 131072K highmem)

Also , what does XRT error below mean
XRT] ERROR: boost::filesystem::directory_iterator::construct: No such file or directory: “/dev/dri/by-path/”

You can find information here:

https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/18841683/Linux+Reserved+Memory

I will also suggest you check dmesg to see if CMA is enabled as it can also be defined in the kernel boot args.

Also , what does XRT error below mean
XRT] ERROR: boost::filesystem::directory_iterator::construct: No such file or directory: “/dev/dri/by-path/”

Does xbutil examine show any device found?

System Configuration
OS Name : Linux
Release : 5.15.19-xilinx-v2022.1
Version : #1 SMP PREEMPT Mon Apr 11 17:52:14 UTC 2022
Machine : armv7l
CPU Cores : 2
Memory : 1000 MB
Distribution : PynqLinux, based on Ubuntu 22.04
GLIBC : 2.35
Model : unknown

XRT
Version : 2.13.0
Branch : temp
Hash : f5505e402c2ca1ffe45eb6d3a9399b23a0dc8776
Hash Date : 2022-10-21 17:40:17
ZOCL : 2.13.0, f5505e402c2ca1ffe45eb6d3a9399b23a0dc8776

Devices present
0 devices found
BDF : Shell Platform UUID Device ID Device Ready*

  • Devices that are not ready will have reduced functionality when using XRT tools

XRT is in my .spec file
STAGE4_PACKAGES_7z045_daffodil2 := xrt pynq ethernet precached_metadata

XRT and ZOCL has same version.
What other compatibility should I check?