BAR0 can't be read because of i/o error
Hello,
thanks for pointing me to your repo, very good!
I tried your code but it fails to read the BAR0, is there a solution to that?
./bin/pcileechgen check --bdf 0000:02:00.0
Checking device 0000:02:00.0...
[OK] Device found: 144d:a80a Non-Volatile memory controller
[OK] Config space readable: 4096 bytes
[OK] IOMMU is enabled
[OK] VFIO modules loaded
[OK] IOMMU group: 14
[OK] Already bound to vfio-pci
Capabilities (4):
[01] Power Management at offset 0x40
[05] MSI at offset 0x50
[10] PCI Express at offset 0x70
[11] MSI-X at offset 0xb0
Extended Capabilities (8):
[0001] Advanced Error Reporting at offset 0x100
[000e] Alternative Routing-ID Interpretation at offset 0x168
[0019] Secondary PCI Express at offset 0x178
[0026] Unknown at offset 0x198
[0027] Unknown at offset 0x1bc
[0018] Latency Tolerance Reporting at offset 0x214
[001e] L1 PM Substates at offset 0x21c
[0025] Unknown at offset 0x3a0
BARs:
BAR0: mem64 at 0x81400000, size 16 KB
--- Board Compatibility ---
Donor Link: Unknown (4) x4
[WARN] Donor has no DSN capability (serial number won't be emulated)
Compatible boards:
[WARN] PCIeSquirrel xc7a35tfgg484-2 x1 (link clamped: x4 -> x1)
[WARN] ScreamerM2 xc7a35tcsg325-2 x1 (link clamped: x4 -> x1)
[WARN] pciescreamer xc7a35tfgg484-2 x1 (link clamped: x4 -> x1)
[WARN] EnigmaX1 xc7a75tfgg484-2 x1 (link clamped: x4 -> x1)
[WARN] CaptainDMA_M2_x1 xc7a35tcsg325-2 x1 (link clamped: x4 -> x1)
[OK] CaptainDMA_M2_x4 xc7a35tcsg325-2 x4 (exact match)
[WARN] CaptainDMA_35T xc7a35tfgg484-2 x1 (link clamped: x4 -> x1)
[WARN] CaptainDMA_75T xc7a75tfgg484-2 x1 (link clamped: x4 -> x1)
[WARN] CaptainDMA_100T xc7a100tfgg484-2 x1 (link clamped: x4 -> x1)
[OK] ZDMA xc7a100tfgg484-2 x4 (exact match)
[WARN] GBOX xc7a35tfgg484-2 x1 (link clamped: x4 -> x1)
[WARN] NeTV2_35T xc7a35tfgg484-2 x1 (link clamped: x4 -> x1)
[WARN] NeTV2_100T xc7a100tfgg484-2 x1 (link clamped: x4 -> x1)
[OK] ac701_ft601 xc7a200tfbg676-2 x4 (exact match)
[OK] acorn xc7a200tfbg484-3 x4 (exact match)
[OK] litefury xc7a100tfgg484-2 x4 (exact match)
[WARN] sp605_ft601 xc6slx45tfgg484-2 x1 (link clamped: x4 -> x1)
Total: 17 boards
--- Check complete ---
root@rescue64:~/PCILeechGen# ./bin/pcileechgen build --bdf 0000:02:00.0 --board CaptainDMA_75T --skip-vivado
[pcileechgen] Target device: 0000:02:00.0
[pcileechgen] Stage 1: Collecting donor device data...
[donor] Warning: could not read BAR0 content: failed to read BAR0 content: read /sys/bus/pci/devices/0000:02:00.0/resource0: input/output error
[pcileechgen] Target board: CaptainDMA_75T (xc7a75tfgg484-2)
[pcileechgen] Output: pcileech_datastore
[pcileechgen] Device: 144d:a80a Non-Volatile memory controller (rev 00)
[pcileechgen] Config space: 4096 bytes
[pcileechgen] Capabilities: 4 standard, 8 extended
[pcileechgen] BARs: 6
[build] Stage 2: Generating firmware artifacts...
[firmware] SV patches applied:
pcileech_fifo.sv:
-> Shadow config space: ENABLED (CFGTLP ZERO DATA -> 0)
-> CFG_SUBSYS_VEND_ID: 0x144D
-> CFG_SUBSYS_ID: 0xA801
-> CFG_VEND_ID: 0x144D
-> CFG_DEV_ID: 0xA80A
-> CFG_REV_ID: 0x00
-> _pcie_core_config: all IDs updated
[build] Artifacts written to: pcileech_datastore
- device_context.json
- pcileech_cfgspace.coe
- pcileech_cfgspace_writemask.coe
- pcileech_bar_zero4k.coe
- vivado_generate_project.tcl
- vivado_build.tcl
- src/
[build] Vivado synthesis skipped (--skip-vivado)
Thank you beforehand
(.venv) root@beelink:~/PCILeechGen# sudo ./bin/pcileechgen build --bdf 0000:03:00.0 --board CaptainDMA_100T
[pcileechgen] Target device: 0000:03:00.0
[pcileechgen] Stage 1: Collecting donor device data...
[donor] Warning: could not read BAR0 content: failed to read BAR0 content: read /sys/bus/pci/devices/0000:03:00.0/resource0: input/output error
[pcileechgen] Target board: CaptainDMA_100T (xc7a100tfgg484-2)
[pcileechgen] Output: pcileech_datastore
[pcileechgen] Device: 1912:0014 USB controller (rev 03)
[pcileechgen] Config space: 4096 bytes
[pcileechgen] Capabilities: 4 standard, 2 extended
[pcileechgen] BARs: 6
[build] Stage 2: Generating firmware artifacts...
[firmware] SV patches applied:
pcileech_fifo.sv:
-> Shadow config space: ENABLED (CFGTLP ZERO DATA -> 0)
-> CFG_SUBSYS_VEND_ID: 0xFFFF
-> CFG_SUBSYS_ID: 0xFFFF
-> CFG_VEND_ID: 0x1912
-> CFG_DEV_ID: 0x0014
-> CFG_REV_ID: 0x03
-> _pcie_core_config: all IDs updated
[build] Artifacts written to: pcileech_datastore
- device_context.json
- pcileech_cfgspace.coe
- pcileech_cfgspace_writemask.coe
- pcileech_bar_zero4k.coe
- vivado_generate_project.tcl
- vivado_build.tcl
- src/
[build] Stage 3: Running Vivado synthesis...
[build] Using Vivado 2024.2 at /tools/Xilinx/Vivado/2024.2
[vivado] Running: /tools/Xilinx/Vivado/2024.2/bin/vivado -mode batch -notrace -source vivado_generate_project.tcl
[vivado] Working directory: pcileech_datastore
****** Vivado v2024.2 (64-bit)
**** SW Build 5239630 on Fri Nov 08 22:34:34 MST 2024
**** IP Build 5239520 on Sun Nov 10 16:12:51 MST 2024
**** SharedData Build 5239561 on Fri Nov 08 14:39:27 MST 2024
**** Start of session at: Sat Feb 28 15:38:39 2026
** Copyright 1986-2022 Xilinx, Inc. All Rights Reserved.
** Copyright 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
source vivado_generate_project.tcl -notrace
INFO: [IP_Flow 19-234] Refreshing IP repositories
INFO: [IP_Flow 19-1704] No user IP repositories specified
INFO: [IP_Flow 19-2313] Loaded Vivado IP repository '/tools/Xilinx/Vivado/2024.2/data/ip'.
WARNING: [IP_Flow 19-2162] IP 'drom_pcie_cfgspace_writemask' is locked:
* IP definition 'Distributed Memory Generator (8.0)' for IP 'drom_pcie_cfgspace_writemask' (customized with software release 2023.2.2) has a different revision in the IP Catalog.
WARNING: [IP_Flow 19-2162] IP 'fifo_49_49_clk2' is locked:
* IP definition 'FIFO Generator (13.2)' for IP 'fifo_49_49_clk2' (customized with software release 2023.2.2) has a different revision in the IP Catalog.
WARNING: [IP_Flow 19-2162] IP 'fifo_43_43_clk2' is locked:
* IP definition 'FIFO Generator (13.2)' for IP 'fifo_43_43_clk2' (customized with software release 2023.2.2) has a different revision in the IP Catalog.
WARNING: [IP_Flow 19-2162] IP 'fifo_1_1_clk2' is locked:
* IP definition 'FIFO Generator (13.2)' for IP 'fifo_1_1_clk2' (customized with software release 2023.2.2) has a different revision in the IP Catalog.
WARNING: [IP_Flow 19-2162] IP 'fifo_256_32_clk2_comtx' is locked:
* IP definition 'FIFO Generator (13.2)' for IP 'fifo_256_32_clk2_comtx' (customized with software release 2023.2.2) has a different revision in the IP Catalog.
WARNING: [IP_Flow 19-2162] IP 'fifo_134_134_clk2' is locked:
* IP definition 'FIFO Generator (13.2)' for IP 'fifo_134_134_clk2' (customized with software release 2023.2.2) has a different revision in the IP Catalog.
WARNING: [IP_Flow 19-2162] IP 'fifo_64_64_clk2_comrx' is locked:
* IP definition 'FIFO Generator (13.2)' for IP 'fifo_64_64_clk2_comrx' (customized with software release 2023.2.2) has a different revision in the IP Catalog.
WARNING: [IP_Flow 19-2162] IP 'fifo_34_34' is locked:
* IP definition 'FIFO Generator (13.2)' for IP 'fifo_34_34' (customized with software release 2023.2.2) has a different revision in the IP Catalog.
WARNING: [IP_Flow 19-2162] IP 'fifo_32_32_clk1_comtx' is locked:
* IP definition 'FIFO Generator (13.2)' for IP 'fifo_32_32_clk1_comtx' (customized with software release 2023.2.2) has a different revision in the IP Catalog.
WARNING: [IP_Flow 19-2162] IP 'bram_pcie_cfgspace' is locked:
* IP definition 'Block Memory Generator (8.4)' for IP 'bram_pcie_cfgspace' (customized with software release 2023.2.2) has a different revision in the IP Catalog.
WARNING: [IP_Flow 19-2162] IP 'fifo_64_64_clk1_fifocmd' is locked:
* IP definition 'FIFO Generator (13.2)' for IP 'fifo_64_64_clk1_fifocmd' (customized with software release 2023.2.2) has a different revision in the IP Catalog.
WARNING: [IP_Flow 19-2162] IP 'fifo_141_141_clk1_bar_wr' is locked:
* IP definition 'FIFO Generator (13.2)' for IP 'fifo_141_141_clk1_bar_wr' (customized with software release 2023.2.2) has a different revision in the IP Catalog.
WARNING: [IP_Flow 19-2162] IP 'fifo_129_129_clk1' is locked:
* IP definition 'FIFO Generator (13.2)' for IP 'fifo_129_129_clk1' (customized with software release 2023.2.2) has a different revision in the IP Catalog.
WARNING: [IP_Flow 19-2162] IP 'pcie_7x_0' is locked:
* IP definition '7 Series Integrated Block for PCI Express (3.3)' for IP 'pcie_7x_0' (customized with software release 2023.2.2) has a different revision in the IP Catalog.
WARNING: [IP_Flow 19-2162] IP 'fifo_74_74_clk1_bar_rd1' is locked:
* IP definition 'FIFO Generator (13.2)' for IP 'fifo_74_74_clk1_bar_rd1' (customized with software release 2023.2.2) has a different revision in the IP Catalog.
WARNING: [IP_Flow 19-2162] IP 'fifo_134_134_clk1_bar_rdrsp' is locked:
* IP definition 'FIFO Generator (13.2)' for IP 'fifo_134_134_clk1_bar_rdrsp' (customized with software release 2023.2.2) has a different revision in the IP Catalog.
WARNING: [IP_Flow 19-2162] IP 'fifo_134_134_clk2_rxfifo' is locked:
* IP definition 'FIFO Generator (13.2)' for IP 'fifo_134_134_clk2_rxfifo' (customized with software release 2023.2.2) has a different revision in the IP Catalog.
WARNING: [IP_Flow 19-2162] IP 'fifo_32_32_clk2' is locked:
* IP definition 'FIFO Generator (13.2)' for IP 'fifo_32_32_clk2' (customized with software release 2023.2.2) has a different revision in the IP Catalog.
WARNING: [IP_Flow 19-2162] IP 'fifo_64_64' is locked:
* IP definition 'FIFO Generator (13.2)' for IP 'fifo_64_64' (customized with software release 2023.2.2) has a different revision in the IP Catalog.
WARNING: [IP_Flow 19-2162] IP 'bram_bar_zero4k' is locked:
* IP definition 'Block Memory Generator (8.4)' for IP 'bram_bar_zero4k' (customized with software release 2023.2.2) has a different revision in the IP Catalog.
CRITICAL WARNING: [IP_Flow 19-4309] IP 'drom_pcie_cfgspace_writemask' is locked, parameter file paths could not be changed. Please ensure the IP is unlocked and retry the SaveAs/Import operation.
CRITICAL WARNING: [IP_Flow 19-4309] IP 'bram_pcie_cfgspace' is locked, parameter file paths could not be changed. Please ensure the IP is unlocked and retry the SaveAs/Import operation.
CRITICAL WARNING: [IP_Flow 19-4309] IP 'bram_bar_zero4k' is locked, parameter file paths could not be changed. Please ensure the IP is unlocked and retry the SaveAs/Import operation.
Configuring PCIe IP core with donor device identity...
INFO: [Common 17-17] undo 'set_property'
ERROR: [Common 17-107] Cannot change read-only property 'CONFIG.Class_Code_Base'.
Resolution: Please refer to Vivado Properties Reference Guide (UG912) for more information on setting properties.
INFO: [Common 17-206] Exiting Vivado at Sat Feb 28 15:38:45 2026...
Error: project creation failed: Vivado execution failed: exit status 1
hi @platinum55, thanks for reporting this!
the issue was that when a device is bound to vfio-pci, the kernel blocks direct read() on sysfs resource files. the fix (commit 2d4a5e4) now uses mmap() to read bar content, which works even under vfio-pci.
please pull the latest main branch and rebuild, the warning should be gone.
-- i also see that your donor is giving dsn error in control. this will cause the dsn information to be 0 after build. it might be wiser to use a different donor.
[WARN] Donor has no DSN capability (serial number won't be emulated)
@sthgi i have released an update for this issue. (commit eb0c60a) if this doesn't solve your problem, downgrade to vivado version 2023.2.2. the original pcileech framework was developed with this version.