Passthrough checklist

Choose your CPU, your hypervisor and what the GPU is for. The list below rebuilds itself with the steps in order. Sharing the GPU with a container and handing the whole card to a virtual machine are different jobs, so the two paths share almost no steps.

Tune the receiver

CPU (VM goal only)
Hypervisor
What the GPU is for

Your checklist

JavaScript is off, so every step is shown. The labels say which goal and setup each one is for.

Goal: transcoding in a container

Before you start

  1. Skip the IOMMU steps

    A container shares the host's kernel, so the GPU stays with the host's normal driver and the container is only given its device file. Firmware IOMMU settings, kernel options and vfio-pci are for handing a whole card to a VM. A card bound to vfio-pci cannot be shared with containers this way.

  2. Know which device file you need

    These steps cover x86 hosts and the render node under /dev/dri that the Intel and AMD graphics drivers create. NVIDIA's own driver uses /dev/nvidia* devices and NVIDIA's container toolkit instead, which this checklist does not cover.

On the host

  1. Identify the GPU and check its host driver

    Run lspci -nnk. Find the VGA or display controller that is the GPU you want, note its address (for example 01:00.0) and read its “Kernel driver in use” line. Intel graphics normally show i915 or xe, and AMD graphics normally show amdgpu; some older AMD cards can use the radeon driver instead, so read the line rather than assuming. This does not depend on the CPU you chose: a CPU's maker does not tell you which GPU is installed.

  2. Find the render node for that GPU, and its group

    Run ls -l /dev/dri/by-path/. The entry ending in -render that carries your GPU's PCI address points at its render node, for example renderD128. The name renderD128 is only an example; use the node your listing shows. Then run stat -c '%F %a %g' /dev/dri/<renderDnnn> with that name. It should report a character special file; the last number is the group ID (GID).

    Proxmox VE only On Proxmox VE, run these on the Proxmox host.

    plain KVM only Run these on the Linux host where Docker runs.

Pass it in

  1. Find the group ID inside the containerProxmox VE only

    Inside the container, run getent group render | cut -d: -f3 to get the GID of the group that should own the device. If it prints nothing, the container has no such group: create one or pick the group your media service already uses, and do not continue until you have a number.

  2. Pass the render node into the LXCProxmox VE only

    On the host, run pct config <ctid> and pick a device slot that is not already in use. Shut the container down, then run pct set <ctid> --dev<n> path=/dev/dri/<renderDnnn>,gid=<gid>,mode=0660 with that slot, your render node and the GID from the container, and start it again. Device entries work from the command line in Proxmox VE 8.1 and in the web interface from 8.2 (see the 8.2 release notes and the pct reference).

  3. If Docker runs inside the LXCProxmox VE only

    Do the LXC steps first, then pass the node on to Docker with --device and --group-add, using the GID that stat reports inside the LXC. That is the GID assigned by the LXC step, not the GID the Proxmox host showed.

  4. Pass the render node into Dockerplain KVM only

    Add --device /dev/dri/<renderDnnn>:/dev/dri/<renderDnnn>:rw --group-add <gid> to docker run, with the GID from stat on the Docker host. This assumes a rootful Docker daemon without user-namespace remapping; with remapping or rootless Docker the GID mapping differs, so read Docker's UID and GID mapping page first. In Compose, the same goes under the service's devices and group_add keys.

Check

  1. Check from inside the container

    Repeat the stat command inside the container: it should show the same character device with the GID you set. Then check that the account your media service runs as can open it: sudo -u <user> sh -c 'test -r /dev/dri/<renderDnnn> && test -w /dev/dri/<renderDnnn> && echo ok'. A successful stat alone does not prove that account has access. Finally turn on hardware acceleration in your media server and read its log during a transcode to see whether the GPU or the CPU did the work.

Step by step, with checks at each layer: Pass renderD128 to Docker and Unprivileged Proxmox LXC

Goal: full GPU passthrough to a VM

Before you start

  1. Keep a second way into the host

    Once the card is handed to a VM, the host cannot use it, including for its own screen. Check that you can reach the host over SSH or its web interface from another computer before you change anything.

  2. Check the hardware can do it

    Passthrough needs a CPU, chipset and firmware with an IOMMU (Intel VT-d or AMD-Vi), and the platform has to support interrupt remapping as well. The board's manual says whether the firmware has the option; the kernel messages in the steps below show what the system reports.

Firmware

  1. Turn on VT-d in the firmwareIntel only

    In the BIOS or UEFI setup, enable Intel VT-d (Virtualization Technology for Directed I/O). Menu names differ between board makers.

  2. Turn on the IOMMU (AMD-Vi) in the firmwareAMD only

    In the BIOS or UEFI setup, enable the IOMMU option (AMD-Vi). Menu names differ between board makers.

Kernel

  1. Check the IOMMU and interrupt remapping are reported as enabledIntel only

    After a reboot, run dmesg | grep -e DMAR -e IOMMU -e remapping and look for messages saying the IOMMU and interrupt remapping are enabled. If they are not, the kernel's own documentation for your version says whether an option such as intel_iommu=on is needed on the kernel command line; if it is, add it and reboot.

    Proxmox VE only The Proxmox VE guide says its kernels from 6.8 onward enable the Intel IOMMU by default, so the option is only needed on older Proxmox kernels or when the check shows the IOMMU is off. Its “Editing the Kernel Command Line” section shows where the line lives for GRUB and for systemd-boot, and the command that applies it.

    plain KVM only Defaults differ between distributions and kernel versions, so read the documentation for the kernel you run. If an option is needed, the line is usually set in the bootloader configuration and applied with your distribution's tool.

  2. Check the IOMMU and interrupt remapping are reported as enabledAMD only

    After a reboot, run dmesg | grep -e AMD-Vi -e IOMMU -e remapping and look for messages saying the IOMMU and interrupt remapping are enabled. On AMD the IOMMU is normally enabled automatically once the firmware option is on, so no extra kernel option is usually needed. If nothing is reported, check the firmware setting again, then your kernel's documentation.

Groups and IDs

  1. Look at the IOMMU groups

    The IOMMU group is the smallest set of devices the kernel can isolate (Linux VFIO documentation), so every device in the GPU's group has to be released by the host before the GPU can go to a VM. List the groups with find /sys/kernel/iommu_groups/ -type l. The tidy case is a group holding only the GPU and its own audio function.

    Proxmox VE only The Proxmox VE guide also describes an API command that lists PCI devices together with their IOMMU groups.

  2. Stop if an unrelated device shares the group

    If the GPU's group also holds an unrelated device that the host is using (a network, storage or USB controller, for example), stop here: handing the group over would take that device from the host too. A PCI bridge to which the host has bound no driver is a different case from a working endpoint device; the VFIO documentation explains groups in more detail.

  3. Note the card's address and IDs

    lspci -nn lists each device with its bus address (for example 01:00.0) and its vendor and device IDs in square brackets ([vvvv:dddd]). Note the GPU, and its audio function if it has one, which usually has the same address ending in .1.

Give it to the VM

  1. Add the card to the VMProxmox VE only

    In the VM's Hardware tab choose Add, then PCI Device, and pick the GPU. “All Functions” passes its audio function as well. The “PCI-Express” option needs the VM to use the q35 machine type. The Proxmox VE guide says Proxmox VE tries to release the card from its host driver when the VM starts; the early-binding step below is for a card that will not release.

  2. Add the card to the VMplain KVM only

    Add a <hostdev mode='subsystem' type='pci' managed='yes'> entry to the VM's definition, with a <source> that holds the card's PCI address. With managed='yes', libvirt detaches the device from its host driver when the VM starts and reattaches it when the VM exits. The libvirt page has the complete example. If the card has an audio function, add that as its own entry.

  3. Only if the card will not release: bind it to vfio-pci at bootOnly if needed

    If the host driver does not let go of the card when the VM starts, you can have vfio-pci claim it early instead. Give the vfio-pci driver the card's vendor and device IDs (its ids option, set in a file under /etc/modprobe.d/), make sure it loads before the card's normal driver, rebuild the initramfs and reboot. Then run lspci -nnk -s 01:00.0, with your own address, and look for Kernel driver in use: vfio-pci; check the audio function too if there is one.

    Proxmox VE only The Proxmox VE guide's “PCI(e) Passthrough” section gives the exact lines, including the VFIO modules to load at boot.

    plain KVM only The Linux VFIO documentation describes the driver; the exact file names depend on your distribution.

  4. Check inside the VM

    Start the VM, install the GPU's driver in the guest, and confirm the guest lists the card (lspci in a Linux guest, Device Manager in Windows). Transcoding on this card now runs inside the VM, not on the host.

How this checklist works

  • There is no calculation. Your three choices only show or hide fixed steps written from the documentation listed below.
  • It is a general list, not instructions for your exact board, card or software version. Menu names, file paths and defaults change between releases, so check each step against the current documentation for your system.
  • Your choices are kept in this browser only, so the list looks the same when you come back. Nothing is sent anywhere.
  • Scope: x86 hosts, and either sharing a render node under /dev/dri with a container (Intel and AMD graphics) or handing the whole card to one VM. NVIDIA's own driver and container toolkit, splitting one card between several VMs and non-x86 hosts are not covered.
  • The Docker examples assume a rootful Docker daemon without user-namespace remapping. With remapping or rootless Docker the group IDs map differently.

Sources

  1. Proxmox VE documentation source: PCI(e) Passthrough (qm-pci-passthrough.adoc) (Proxmox, on GitHub)
  2. Proxmox VE documentation source: Host Bootloader, Editing the Kernel Commandline (system-booting.adoc) (Proxmox, on GitHub)
  3. pct.conf options (generated reference, pve-docs) (Proxmox, on GitHub)
  4. pct command synopsis (generated reference, pve-docs) (Proxmox, on GitHub)
  5. Proxmox Virtual Environment 8.2 release announcement (Proxmox Server Solutions)
  6. VFIO - "Virtual Function I/O" (The Linux Kernel documentation)
  7. Userland interfaces: Render nodes (The Linux Kernel documentation)
  8. amdgpu module parameters (The Linux Kernel documentation)
  9. Domain XML format: Host device assignment (libvirt)
  10. docker container run (Docker Docs)
  11. Compose file reference: services, group_add (Docker Docs)
  12. Rootless mode: UID and GID mapping (Docker Docs)