Pcornel
Virtualization · PCI & Device Passthrough

PCIe Passthrough

Cheat sheet · https://pcornel.dk/topic.php?topic=3544

Back to the Topic

Answer

PCIe passthrough is device assignment for PCI Express hardware such as GPUs, NVMe drives and NICs. Use a PCIe-capable machine type (for example q35) and UEFI firmware so the guest sees the device on a proper PCIe topology.

Remember

  • Use q35/PCIe machine type.
  • UEFI firmware recommended.
  • Large BARs need Above 4G decoding.

First checks

  • lspci -vv -s <bdf> | grep -i -e LnkSta -e ACS — PCIe link and ACS
  • qm set <vmid> --hostpci0 <bdf>,pcie=1 — PCIe on q35 (Proxmox)
  • dmesg | grep -i vfio — VFIO errors

Commands

qm set 120 --hostpci0 0000:01:00.0,pcie=1

Verify in this order

PCIe device → vfio → q35 root port → guest

Where it usually breaks

First mismatch in host capability/IOMMU/NUMA → hypervisor allocation/mapping → virtual hardware model → guest driver/enumeration → workload use; preserve identity/native error/pre-state before mutation.

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=3544

Confirmation

Confirm action

Continue?