PCILeechGen icon indicating copy to clipboard operation
PCILeechGen copied to clipboard

Error: device data collection failed

Open WeiXiaoBlueRabbit opened this issue 8 months ago • 3 comments

Description

i'm sure iommu is properly enabled:

dmesg | grep -i iommu
[    0.000000] Command line: BOOT_IMAGE=/boot/vmlinuz-6.8.0-101-generic root=UUID=90d46359-9b58-461f-8ca5-1b991379c5ea ro quiet splash intel_iommu=on iommu=pt vt.handoff=7
[    0.025086] Kernel command line: BOOT_IMAGE=/boot/vmlinuz-6.8.0-101-generic root=UUID=90d46359-9b58-461f-8ca5-1b991379c5ea ro quiet splash intel_iommu=on iommu=pt vt.handoff=7
[    0.025144] DMAR: IOMMU enabled
[    0.074657] DMAR-IR: IOAPIC id 2 under DRHD base  0xfed91000 IOMMU 0
[    0.763553] iommu: Default domain type: Passthrough (set via kernel command line)
[    0.869721] pci 0000:00:00.0: Adding to iommu group 0
[    0.869731] pci 0000:00:01.0: Adding to iommu group 1
[    0.869738] pci 0000:00:04.0: Adding to iommu group 2
[    0.869745] pci 0000:00:08.0: Adding to iommu group 3
[    0.869754] pci 0000:00:12.0: Adding to iommu group 4
[    0.869765] pci 0000:00:14.0: Adding to iommu group 5
[    0.869771] pci 0000:00:14.2: Adding to iommu group 5
[    0.869778] pci 0000:00:14.3: Adding to iommu group 6
[    0.869787] pci 0000:00:15.0: Adding to iommu group 7
[    0.869796] pci 0000:00:16.0: Adding to iommu group 8
[    0.869809] pci 0000:00:1b.0: Adding to iommu group 9
[    0.869818] pci 0000:00:1d.0: Adding to iommu group 10
[    0.869827] pci 0000:00:1d.5: Adding to iommu group 11
[    0.869838] pci 0000:00:1e.0: Adding to iommu group 12
[    0.869845] pci 0000:00:1e.3: Adding to iommu group 12
[    0.869862] pci 0000:00:1f.0: Adding to iommu group 13
[    0.869869] pci 0000:00:1f.3: Adding to iommu group 13
[    0.869876] pci 0000:00:1f.4: Adding to iommu group 13
[    0.869883] pci 0000:00:1f.5: Adding to iommu group 13
[    0.869885] pci 0000:01:00.0: Adding to iommu group 1
[    0.869888] pci 0000:01:00.1: Adding to iommu group 1
[    0.869891] pci 0000:01:00.2: Adding to iommu group 1
[    0.869894] pci 0000:01:00.3: Adding to iommu group 1
[    0.869907] pci 0000:06:00.0: Adding to iommu group 14
[    0.869916] pci 0000:07:00.0: Adding to iommu group 15
[    0.869925] pci 0000:08:00.0: Adding to iommu group 16

and the device is awakened:

sudo ./bin/pcileechgen check --bdf 0000:08:00.0
Checking device 0000:08:00.0...

[OK] Device found: 10ec:8168 Ethernet controller
[OK] Config space readable: 4096 bytes
[OK] IOMMU is enabled
[OK] VFIO modules loaded
[OK] IOMMU group: 16
[OK] Device is alone in its IOMMU group
[OK] Power state: D0 (active)
[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 (5):
  [0001] Advanced Error Reporting at offset 0x100
  [0002] Virtual Channel (No MFVC) at offset 0x140
  [0003] Device Serial Number at offset 0x160
  [0018] Latency Tolerance Reporting at offset 0x170
  [001e] L1 PM Substates at offset 0x178

BARs:
  BAR0: io at 0x3000, size 256 B
  BAR2: mem64 at 0xb2204000, size 4 KB
  BAR4: mem64 at 0xb2200000, size 16 KB

--- Board Compatibility ---
Donor Link: Gen1 (2.5 GT/s) x1
Donor DSN:  0x01000000684CE000

Compatible boards:
  [OK] PCIeSquirrel           xc7a35tfgg484-2 x1 (exact match)
  [OK] ScreamerM2             xc7a35tcsg325-2 x1 (exact match)
  [OK] pciescreamer           xc7a35tfgg484-2 x1 (exact match)
  [OK] EnigmaX1               xc7a75tfgg484-2 x1 (exact match)
  [OK] CaptainDMA_M2_x1       xc7a35tcsg325-2 x1 (exact match)
  [OK] CaptainDMA_M2_x4       xc7a35tcsg325-2 x4
  [OK] CaptainDMA_35T         xc7a35tfgg484-2 x1 (exact match)
  [OK] CaptainDMA_75T         xc7a75tfgg484-2 x1 (exact match)
  [OK] CaptainDMA_100T        xc7a100tfgg484-2 x1 (exact match)
  [OK] ZDMA                   xc7a100tfgg484-2 x4
  [OK] GBOX                   xc7a35tfgg484-2 x1 (exact match)
  [OK] NeTV2_35T              xc7a35tfgg484-2 x1 (exact match)
  [OK] NeTV2_100T             xc7a100tfgg484-2 x1 (exact match)
  [OK] ac701_ft601            xc7a200tfbg676-2 x4
  [OK] acorn                  xc7a200tfbg484-3 x4
  [OK] litefury               xc7a100tfgg484-2 x4
  [OK] sp605_ft601            xc6slx45tfgg484-2 x1 (exact match)

Total: 17 boards

--- Summary ---
[OK] Device is ready for firmware generation

but still error: device data collection failed:

sudo ./bin/pcileechgen build --bdf 0000:08:00.0 --board CaptainDMA_75T --skip-vivado
2026/03/11 18:51:09 INFO target device bdf=0000:08:00.0
2026/03/11 18:51:09 INFO collecting donor device data
2026/03/11 18:51:09 INFO PCI memory space enabled bdf=0000:08:00.0
2026/03/11 18:51:09 WARN sysfs BAR read returned all 0xFF, will retry via VFIO bar=2
2026/03/11 18:51:09 INFO BAR read complete bar=2 bytes=4096
2026/03/11 18:51:09 WARN sysfs BAR read returned all 0xFF, will retry via VFIO bar=4
2026/03/11 18:51:09 INFO BAR read complete bar=4 bytes=4096
2026/03/11 18:51:09 INFO retrying BAR reads via VFIO
2026/03/11 18:51:09 INFO BAR read via VFIO bar=0 bytes=256
2026/03/11 18:51:10 INFO BAR profiled bar=2 active_registers=1024
2026/03/11 18:51:10 INFO BAR profiled bar=4 active_registers=1024
2026/03/11 18:51:10 INFO MSI-X detected vectors=4 table_bar=4 table_offset=0x0 pba_bar=4 pba_offset=0x800
2026/03/11 18:51:10 WARN BAR content is all 0xFF - device may be inaccessible or in D3 power state bar=2 bytes=4096 class=0x020000
2026/03/11 18:51:10 WARN BAR content is all 0xFF - device may be inaccessible or in D3 power state bar=4 bytes=4096 class=0x020000
Error: device data collection failed: BAR content for class 0x020000 is all 0xFF (driver "vfio-pci"). The device is not responding - possible causes:
  • device is in D3 (sleep) power state
  • IOMMU/VT-d not enabled or misconfigured
  • PCI Command Register memory space not enabled
  • device requires native driver initialization (e.g. CNVi WiFi, firmware-dependent devices)
Without valid BAR data, Windows will produce Code 10 and DMA will not work

Workarounds:
  1. Try: sudo setpci -s 0000:08:00.0 COMMAND=0x06
  2. For CNVi/WiFi: boot with native driver, dump BAR with a tool, then use --from-json
Usage:
  pcileechgen build [flags]

Flags:
      --bdf string           donor device BDF address (e.g. 0000:03:00.0)
      --board string         target FPGA board name (required, e.g. PCIeSquirrel)
      --from-json string     load donor device data from JSON file (offline build)
  -h, --help                 help for build
      --jobs int             number of parallel Vivado jobs (default 4)
      --lib-dir string       path to pcileech-fpga library (default "lib/pcileech-fpga")
      --output string        output directory (default "pcileech_datastore")
      --skip-vivado          skip Vivado synthesis (only generate artifacts)
      --timeout int          Vivado synthesis timeout in seconds (default 3600)
      --vivado-path string   path to Vivado installation

device data collection failed: BAR content for class 0x020000 is all 0xFF (driver "vfio-pci"). The device is not responding - possible causes:
  • device is in D3 (sleep) power state
  • IOMMU/VT-d not enabled or misconfigured
  • PCI Command Register memory space not enabled
  • device requires native driver initialization (e.g. CNVi WiFi, firmware-dependent devices)
Without valid BAR data, Windows will produce Code 10 and DMA will not work

Workarounds:
  1. Try: sudo setpci -s 0000:08:00.0 COMMAND=0x06
  2. For CNVi/WiFi: boot with native driver, dump BAR with a tool, then use --from-json
08:00.0 Ethernet controller [0200]: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller [10ec:8168] (rev 16)
	Subsystem: QUANTA Computer Inc RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller [152d:126e]
	Kernel driver in use: vfio-pci
	Kernel modules: r8169

I tried to unbind the driver in two ways:

echo "options vfio-pci ids=10ec:8168" | sudo tee /etc/modprobe.d/vfio.conf

edit /etc/initramfs-tools/modules:
vfio
vfio_iommu_type1
vfio_pci
vfio_virqfd

and:

sudo modprobe vfio && sudo modprobe vfio-pci
echo "0000:08:00.0" | sudo tee /sys/bus/pci/devices/0000:08:00.0/driver/unbind
echo "10ec 8168" | sudo tee /sys/bus/pci/drivers/vfio-pci/new_id

still get error.

Error Type

Collection failure

Device Context File

NA

Windows Event Log


Device Manager Error Details

No response

Terminal Output


WeiXiaoBlueRabbit avatar Mar 11 '26 11:03 WeiXiaoBlueRabbit

thanks for reporting it.

your rtl8168 has an io bar (bar0) that returns valid data, but the memory bars (bar2/bar4) are 0xFF. the recovery mechanism (native driver rebind) exists but was accidentally skipped because the io bar's valid data made it look like everything was fine.

fixed now please rebuild from main and retry.

sercanarga avatar Mar 11 '26 13:03 sercanarga

Thank you very much for your work! However, another issue has arisen. The check command works normally, but when I execute the build command, Thank you very much for your work! However, another issue has arisen. The check command works normally, but when I execute the build command, an error appears: WARN native driver rebind: re-bind to vfio-pci failed, discarding recovered BARs error="failed to unbind from current driver: open ../../../../bus/pci/drivers/unbind: no such file or directory", I think the complete path should be /sys/bus/pci/drivers/r8169/unbind or /sys/bus/pci/drivers/vfio-pci/unbind? :

sudo ./bin/pcileechgen check --bdf 0000:08:00.0
Checking device 0000:08:00.0...

[OK] Device found: 10ec:8168 Ethernet controller
[OK] Config space readable: 4096 bytes
[OK] IOMMU is enabled
[OK] VFIO modules loaded
[OK] IOMMU group: 16
[OK] Device is alone in its IOMMU group
[OK] Power state: D0 (active)
[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 (5):
  [0001] Advanced Error Reporting at offset 0x100
  [0002] Virtual Channel (No MFVC) at offset 0x140
  [0003] Device Serial Number at offset 0x160
  [0018] Latency Tolerance Reporting at offset 0x170
  [001e] L1 PM Substates at offset 0x178

BARs:
  BAR0: io at 0x3000, size 256 B
  BAR2: mem64 at 0xb2204000, size 4 KB
  BAR4: mem64 at 0xb2200000, size 16 KB

--- Board Compatibility ---
Donor Link: Gen1 (2.5 GT/s) x1
Donor DSN:  0x01000000684CE000

Compatible boards:
  [OK] PCIeSquirrel           xc7a35tfgg484-2 x1 (exact match)
  [OK] ScreamerM2             xc7a35tcsg325-2 x1 (exact match)
  [OK] pciescreamer           xc7a35tfgg484-2 x1 (exact match)
  [OK] EnigmaX1               xc7a75tfgg484-2 x1 (exact match)
  [OK] CaptainDMA_M2_x1       xc7a35tcsg325-2 x1 (exact match)
  [OK] CaptainDMA_M2_x4       xc7a35tcsg325-2 x4
  [OK] CaptainDMA_35T         xc7a35tfgg484-2 x1 (exact match)
  [OK] CaptainDMA_75T         xc7a75tfgg484-2 x1 (exact match)
  [OK] CaptainDMA_100T        xc7a100tfgg484-2 x1 (exact match)
  [OK] ZDMA                   xc7a100tfgg484-2 x4
  [OK] GBOX                   xc7a35tfgg484-2 x1 (exact match)
  [OK] NeTV2_35T              xc7a35tfgg484-2 x1 (exact match)
  [OK] NeTV2_100T             xc7a100tfgg484-2 x1 (exact match)
  [OK] ac701_ft601            xc7a200tfbg676-2 x4
  [OK] acorn                  xc7a200tfbg484-3 x4
  [OK] litefury               xc7a100tfgg484-2 x4
  [OK] sp605_ft601            xc6slx45tfgg484-2 x1 (exact match)

Total: 17 boards

--- Summary ---
[OK] Device is ready for firmware generation
sudo ./bin/pcileechgen build --bdf 0000:08:00.0 --board CaptainDMA_75t --skip-vivado
2026/03/11 22:54:47 INFO target device bdf=0000:08:00.0
2026/03/11 22:54:47 INFO collecting donor device data
2026/03/11 22:54:47 INFO PCI memory space enabled bdf=0000:08:00.0
2026/03/11 22:54:47 WARN sysfs BAR read returned all 0xFF, will retry via VFIO bar=2
2026/03/11 22:54:47 INFO BAR read complete bar=2 bytes=4096
2026/03/11 22:54:47 WARN sysfs BAR read returned all 0xFF, will retry via VFIO bar=4
2026/03/11 22:54:47 INFO BAR read complete bar=4 bytes=4096
2026/03/11 22:54:47 INFO retrying BAR reads via VFIO
2026/03/11 22:54:48 INFO all memory BAR contents are 0xFF, attempting native driver rebind cycle
2026/03/11 22:54:48 INFO waiting for native driver to initialize device... delay=3s
2026/03/11 22:54:51 WARN native driver rebind: re-bind to vfio-pci failed, discarding recovered BARs error="failed to unbind from current driver: open ../../../../bus/pci/drivers/unbind: no such file or directory"
2026/03/11 22:54:51 INFO BAR profiled bar=2 active_registers=1024
2026/03/11 22:54:51 INFO BAR profiled bar=4 active_registers=1024
2026/03/11 22:54:51 INFO MSI-X detected vectors=4 table_bar=4 table_offset=0x0 pba_bar=4 pba_offset=0x800
2026/03/11 22:54:51 WARN BAR content is all 0xFF - device may be inaccessible or in D3 power state bar=2 bytes=4096 class=0x020000
2026/03/11 22:54:51 WARN BAR content is all 0xFF - device may be inaccessible or in D3 power state bar=4 bytes=4096 class=0x020000
Error: device data collection failed: BAR content for class 0x020000 is all 0xFF (driver "vfio-pci"). The device is not responding - possible causes:
  • device is in D3 (sleep) power state
  • IOMMU/VT-d not enabled or misconfigured
  • PCI Command Register memory space not enabled
  • device requires native driver initialization (e.g. CNVi WiFi, firmware-dependent devices)
Without valid BAR data, Windows will produce Code 10 and DMA will not work

Workarounds:
  1. Try: sudo setpci -s 0000:08:00.0 COMMAND=0x06
  2. For CNVi/WiFi: boot with native driver, dump BAR with a tool, then use --from-json
Usage:
  pcileechgen build [flags]

Flags:
      --bdf string           donor device BDF address (e.g. 0000:03:00.0)
      --board string         target FPGA board name (required, e.g. PCIeSquirrel)
      --from-json string     load donor device data from JSON file (offline build)
  -h, --help                 help for build
      --jobs int             number of parallel Vivado jobs (default 4)
      --lib-dir string       path to pcileech-fpga library (default "lib/pcileech-fpga")
      --output string        output directory (default "pcileech_datastore")
      --skip-vivado          skip Vivado synthesis (only generate artifacts)
      --timeout int          Vivado synthesis timeout in seconds (default 3600)
      --vivado-path string   path to Vivado installation

device data collection failed: BAR content for class 0x020000 is all 0xFF (driver "vfio-pci"). The device is not responding - possible causes:
  • device is in D3 (sleep) power state
  • IOMMU/VT-d not enabled or misconfigured
  • PCI Command Register memory space not enabled
  • device requires native driver initialization (e.g. CNVi WiFi, firmware-dependent devices)
Without valid BAR data, Windows will produce Code 10 and DMA will not work

Workarounds:
  1. Try: sudo setpci -s 0000:08:00.0 COMMAND=0x06
  2. For CNVi/WiFi: boot with native driver, dump BAR with a tool, then use --from-json

WeiXiaoBlueRabbit avatar Mar 11 '26 15:03 WeiXiaoBlueRabbit

good catch. BindToVFIO was using the raw symlink target from readlink (e.g. ../../../../bus/pci/drivers/r8169) to build the unbind path. that relative path only makes sense relative to the symlink itself, not the working directory.

fixed by using the sysfs device path directly (/sys/bus/pci/devices/<bdf>/driver/unbind) which lets the os resolve the symlink transparently.

sercanarga avatar Mar 11 '26 18:03 sercanarga