Ubuntu – 19.10 Ubuntu host entirely freezes during Windows 10 qemu install

driverskvmnvidiaqemuvirtualization

On Ubuntu 19.10 as a host, I'm trying to do GPU passthrough to Windows 10 as guest. I successfully isolated my GTX 1060 and passed to the insides of a VM in virt-manager (libvirt doc) (home page).

When I try to install Windows, it first copies the files during the installation process. Then it restarts the VM, and when the Windows continues the installation process, Ubuntu freezes forever. I rebooted Ubuntu, tried again, and the same happens at the same spot.

You can see, in details, all I did to enable passthrough here: KVM GPU passthrough: group 15 is not viable. Please ensure all devices within the iommu_group are bound to their vfio bus driver.'

But, in short: I edited /etc/initramfs-tools/modules and /etc/modules to include all the 4 pci devices on my iommu group 15. However, only the GTX 1060 appeared as being used by vfio-pci when I ran lspci -nnv after a reboot. So I manually unbinded them and inserted into vfio-pci with a little script I wrote:

echo -n "0000:07:00.1" > /sys/bus/pci/drivers/snd_hda_intel/unbind
echo -n "0000:07:00.1" > /sys/bus/pci/drivers/vfio-pci/bind

echo -n "0000:07:00.2" > /sys/bus/pci/drivers/xhci_hcd/unbind
echo -n "0000:07:00.2" > /sys/bus/pci/drivers/vfio-pci/bind

echo -n "0000:07:00.3" > /sys/bus/pci/drivers/nvidia-gpu/unbind
echo -n "0000:07:00.3" > /sys/bus/pci/drivers/vfio-pci/bind

after that, I can sucessfully start my Windows 10 VM installation, but it freezes during installation. Is it possibly related to what I did?

PS: I cannot simply block the noveau driver because the host's GPU is also from NVIDIA. So I need to manually unbind each device.

Best Answer

You will almost certainly need to blacklist nouveau and nvidia device drivers, and set up a startup script that does the above binding to vfio-pci, and then explicitly loads nouveau/nvidia kernel drivers to let them bind do the hardware devices you didn't already explicitly bind to vfio-pci in your script prior to that point. Once the host side driver has tainted the device, the device tends not to work for pci passthrough any more on most setups.

Related Question