Skip to content

GPU Passthrough on Libvirt

Initial state

HP ProLiant DL580 Gen9 with 6 RTX 4060 Ti

Host OS: Ubuntu 24

Guests OS: Windows 10

No direct access to the host, only remote connections.

The goal: start Minecraft (TLauncher) with rendering on GPU.

Configuration host

Find devices IDs

# lspci -nn | grep -E NVIDIA
04:00.0 VGA compatible controller [0300]: NVIDIA Corporation AD106 [GeForce RTX 4060 Ti 16GB] [10de:2805] (rev a1)
04:00.1 Audio device [0403]: NVIDIA Corporation Device [10de:22bd] (rev a1)
44:00.0 VGA compatible controller [0300]: NVIDIA Corporation AD106 [GeForce RTX 4060 Ti 16GB] [10de:2805] (rev a1)
44:00.1 Audio device [0403]: NVIDIA Corporation Device [10de:22bd] (rev a1)
81:00.0 VGA compatible controller [0300]: NVIDIA Corporation AD106 [GeForce RTX 4060 Ti 16GB] [10de:2805] (rev a1)
81:00.1 Audio device [0403]: NVIDIA Corporation Device [10de:22bd] (rev a1)
87:00.0 VGA compatible controller [0300]: NVIDIA Corporation AD106 [GeForce RTX 4060 Ti 16GB] [10de:2805] (rev a1)
87:00.1 Audio device [0403]: NVIDIA Corporation Device [10de:22bd] (rev a1)
c1:00.0 VGA compatible controller [0300]: NVIDIA Corporation AD106 [GeForce RTX 4060 Ti 16GB] [10de:2805] (rev a1)
c1:00.1 Audio device [0403]: NVIDIA Corporation Device [10de:22bd] (rev a1)
c4:00.0 VGA compatible controller [0300]: NVIDIA Corporation AD106 [GeForce RTX 4060 Ti 16GB] [10de:2805] (rev a1)
c4:00.1 Audio device [0403]: NVIDIA Corporation Device [10de:22bd] (rev a1)

Set id to vfio

# cat /etc/modprobe.d/vfio.conf
blacklist nouveau
blacklist nvidia
blacklist nvidiafb
blacklist snd_hda_intel
options vfio-pci ids=10de:2805,10de:22bd

Add options to grub:

# grep GRUB_CMDLINE_LINUX_DEFAULT /etc/default/grub
GRUB_CMDLINE_LINUX_DEFAULT="intel_iommu=on iommu=pt"

Update grub and it

sudo update-grub
sudo update-initramfs -c -k $(uname -r)

Reboot host.

Check result:

# lspci -k | grep -E 'vfio-pci|NVIDIA'
04:00.0 VGA compatible controller: NVIDIA Corporation AD106 [GeForce RTX 4060 Ti 16GB] (rev a1)
    Kernel driver in use: vfio-pci
04:00.1 Audio device: NVIDIA Corporation Device 22bd (rev a1)
    Kernel driver in use: vfio-pci
44:00.0 VGA compatible controller: NVIDIA Corporation AD106 [GeForce RTX 4060 Ti 16GB] (rev a1)
    Kernel driver in use: vfio-pci
44:00.1 Audio device: NVIDIA Corporation Device 22bd (rev a1)
    Kernel driver in use: vfio-pci
81:00.0 VGA compatible controller: NVIDIA Corporation AD106 [GeForce RTX 4060 Ti 16GB] (rev a1)
    Kernel driver in use: vfio-pci
81:00.1 Audio device: NVIDIA Corporation Device 22bd (rev a1)
    Kernel driver in use: vfio-pci
87:00.0 VGA compatible controller: NVIDIA Corporation AD106 [GeForce RTX 4060 Ti 16GB] (rev a1)
    Kernel driver in use: vfio-pci
87:00.1 Audio device: NVIDIA Corporation Device 22bd (rev a1)
    Kernel driver in use: vfio-pci
c1:00.0 VGA compatible controller: NVIDIA Corporation AD106 [GeForce RTX 4060 Ti 16GB] (rev a1)
    Kernel driver in use: vfio-pci
c1:00.1 Audio device: NVIDIA Corporation Device 22bd (rev a1)
    Kernel driver in use: vfio-pci
c4:00.0 VGA compatible controller: NVIDIA Corporation AD106 [GeForce RTX 4060 Ti 16GB] (rev a1)
    Kernel driver in use: vfio-pci
c4:00.1 Audio device: NVIDIA Corporation Device 22bd (rev a1)
    Kernel driver in use: vfio-pci

Configuration guest VM

Select UEFI.

Add 2 PCI devices: - video card - sound output on video card

pci_devices

Install NVIDIA Drivers Install virtio-win drivers: https://github.com/virtio-win/kvm-guest-drivers-windows

win10

Fails via QXL

On the connections via Virt-Manager (QXL), still have the error 65542 : The driver does not appear to support OpenGL

fails

Additionally installed OpenGL drivers https://github.com/pal1000/mesa-dist-win/releases The same fail result: Application started successfully, but use only CPU.

Successfully RDP

Enable Remote access (RDP) on guest host. Using RDP connection:

ok

Not tested cases

  • The test on the real video cards output was not done. - no access, sorry %).
  • https://looking-glass.io/ - not clear final goal of task

https://gitlab.com/risingprismtv/single-gpu-passthrough/-/wikis/home https://github.com/TikZSZ/vfio-gpu-passthrough https://tek.place/en/posts/2024/02/setting-up-gpu-passthrough-with-kvm-on-ubuntu-for-windows/ 1