Guide · GPU passthrough

GPU and PCI passthrough for KVM virtual machines.

Passthrough gives one virtual machine a whole physical device — a GPU for compute or graphics, a network card, an NVMe drive — with the guest's own driver talking to it directly.

By · Checked against LexiVirt 2.1 on

Before you start

  • Passthrough on KVM uses VFIO, which needs the CPU's and motherboard's IOMMU (Intel VT-d or AMD-Vi) switched on.
  • A device must be bound to vfio-pci on its node, not held by a host driver. The GPU page says, for each card, whether it is bound to a passthrough driver or still held by the host, and Why not? explains what is in the way and what to change.
  • A passed-through device belongs to the node it is plugged into, so the VM runs on that node.

Pass a GPU to a VM

  1. Open GPU. Each card on each node is listed; choose Rescan after adding hardware.
  2. Shut the VM down: a card is attached at boot, not while the machine runs.
  3. Choose Assign to VM, pick the Virtual machine and confirm with Assign.
  4. Start the VM; the whole card is now its own. Detach, with the VM off, gives the card back.

Other PCI devices

Since 2.1, SR-IOV virtual functions, network cards, NVMe drives and any other device bound to vfio-pci on its node can be given to a VM whole, from the same page.

CPU pinning, NUMA and hugepages

Each node reports its topology. A powered-off VM can be pinned to chosen host CPUs, kept on one NUMA node and backed by hugepages, from Performance in the VM's tools.

Limits to know

LimitsWhole-device passthrough only: no vGPU, no time-slicing, no sharing one card between guests. CPU pinning, NUMA and hugepages were tested in 2.1 against a simulation, not yet on hardware.

Go further

The capability behind this guide: KVM Virtual Machine Management. Every console page with its limits: the feature reference. Stuck? Ask the community or get support.

Run it on your own servers.

Free, with no licence per VM, socket or core. One command per server.