Use this when giving a VM direct control of a PCI device.
PCI Passthrough · PCI & Device Passthrough
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.
1. PCI passthrough assigns a device to one VM.
2. Bind to vfio-pci.
3. Whole IOMMU group goes together.
4. Host loses the device.
5. Test reset after VM shutdown.
host device → vfio-pci → VM
Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
qm config 101 | grep hostpciVerification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 Checks Verify boundary
lspci -nnk -s 01:00.0 # Kernel driver in use: vfio-pci
qm config 101 | grep hostpci
Step 2 Common mistakes Narrow the fault
- Host driver still bound (check
Kernel driver in use). - i440fx machine type for PCIe devices.
Evidence · 1 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
- Device leaves host and other VMs.
- Snapshots/migration usually lost.
- Reset bugs exist on some devices.
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
ReferenceWhy it matters1 section · depth on demand
How it works
PCI passthrough gives a VM direct control of a physical device (GPU, NIC, HBA) using the IOMMU to map the device's DMA safely into the VM's memory. The VM gets near-native performance, but live migration and snapshots of that VM are usually not possible.
ReferenceImportant terms & boundaries2 sections · depth on demand
In depth
Host preparation
1. Enable VT-d/AMD-Vi in firmware.
2. Kernel command line: intel_iommu=on iommu=pt (Intel; AMD enables the IOMMU by default on current kernels).
3. Verify: dmesg | grep -e DMAR -e IOMMU shows the IOMMU enabled and remapping active.
IOMMU groups decide what can be passed through
The kernel VFIO documentation defines a group as the set of devices isolatable from all others; every device in a group must be bound to VFIO before the group can be used.
$ for g in /sys/kernel/iommu_groups/*; do echo "Group ${g##*/}:"; for d in $g/devices/*; do echo " $(lspci -nns ${d##*/})"; done; done
Group 14:
01:00.0 VGA compatible controller [0300]: NVIDIA ... [10de:2204]
01:00.1 Audio device [0403]: NVIDIA ... [10de:1aef]
Both functions of the GPU are in group 14, so both are passed to the same VM. A group that also contains a SATA controller or NIC the host needs cannot be passed through cleanly.
Bind to vfio-pci early
echo "options vfio-pci ids=10de:2204,10de:1aef" > /etc/modprobe.d/vfio.conf
update-initramfs -u -k all && reboot
$ lspci -nnk -s 01:00.0 | grep driver
Kernel driver in use: vfio-pci
Attach to the VM
| Platform | Configuration |
|---|---|
| Proxmox VE | qm set 101 --machine q35 --bios ovmf --hostpci0 0000:01:00,pcie=1 |
| libvirt | <hostdev mode='subsystem' type='pci' managed='yes'><source><address domain='0x0000' bus='0x01' slot='0x00' function='0x0'/></source></hostdev> |
What you give up
| Feature | With passthrough |
|---|---|
| Live migration | Not possible (except vendor mediated devices / SR-IOV designs) |
| Snapshots including RAM | Not possible |
| Memory ballooning / overcommit | Guest RAM must be pinned for DMA |
| HA restart on another node | Only if an identical device exists there |
SR-IOV virtual functions (NICs) are passed through the same way but share one physical device between several VMs.
*The IOMMU group listing and VFIO driver binding above are illustrative examples, not captured from a lab or production host.*
Setup steps (KVM/Proxmox)
1. Enable VT-d/AMD-Vi in firmware.
2. Kernel: IOMMU on (intel_iommu=on iommu=pt).
3. Load VFIO: vfio, vfio_iommu_type1, vfio_pci.
4. Bind device: options vfio-pci ids=10de:2204 in /etc/modprobe.d/vfio.conf, then update-initramfs -u.
5. Add to VM: qm set 101 --hostpci0 01:00,pcie=1 (q35 machine).
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in PCI & Device Passthrough → PCI Passthrough. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://docs.kernel.org/driver-api/vfio.html · confidence 94%