Pcornel
Virtualization · PCI & Device Passthrough

PCI Passthrough

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

Back to the Topic

Answer

PCI passthrough assigns a physical PCI device directly to a VM, so the guest's own driver controls it with near-native performance. The device is then unavailable to the host and other VMs, and snapshots and live migration are usually lost.

Remember

  • Device leaves host and other VMs.
  • Snapshots/migration usually lost.
  • Reset bugs exist on some devices.

First checks

  • lspci -nnk -s <bdf> — kernel driver in use: vfio-pci?
  • qm set <vmid> --hostpci0 <bdf> — assign (Proxmox)
  • virsh nodedev-detach pci_0000_01_00_0 — detach from host

Commands

qm set 101 --machine q35 --bios ovmf --hostpci0 0000:01:00,pcie=1
qm set 101 --hostpci0 01:00,pcie=1

Verify in this order

host device → vfio-pci → VM

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=3543

Confirmation

Confirm action

Continue?