I used Ubuntu 20.04 as host and create a Windows 10 VM (21H1) in KVM (via the GUI). In the VM I pass my graphics card (RTX2070) and the whole group via PCI passthrough, which works thanks to various guides.
After I installed updates/drivers in the VM, the graka is also recognized. I can also install programs or restart the VM without any problems, but as soon as I restart the host (with the VM switched off), the Windows 10 VM boots into a blue screen (TDR Video Failure).
Here is my XML for the Windows 10 VM:
domain type="kvm">
<name>win10</name>
<uuid>39bd2708-4c4e-4ce4-8ef9-e8d322214990</uuid>
<metadata>
<libosinfo:libosinfo xmlns:libosinfo="http://libosinfo.org/xmlns/libvirt/domain/1.0">
<libosinfo:os id="http://microsoft.com/win/10"/>
</libosinfo:libosinfo>
</metadata>
<memory>8388608</memory>
<currentMemory>8388608</currentMemory>
<vcpu>4</vcpu>
<os>
<type arch="x86_64" machine="q35">hvm</type>
<boot dev="hd"/>
</os>
<features>
<acpi/>
<apic/>
<hyperv>
<relaxed state="on"/>
<vapic state="on"/>
<spinlocks state="on" retries="8191"/>
<vendor_id state="on" value="1234567890ab"/>
</hyperv>
<kvm>
<hidden state="on"/>
</kvm>
<vmport state="off"/>
</features>
<cpu mode="host-model"/>
<clock offset="localtime">
<timer name="rtc" tickpolicy="catchup"/>
<timer name="pit" tickpolicy="delay"/>
<timer name="hpet" present="no"/>
<timer name="hypervclock" present="yes"/>
</clock>
<pm>
<suspend-to-mem enabled="no"/>
<suspend-to-disk enabled="no"/>
</pm>
<devices>
<emulator>/usr/bin/qemu-system-x86_64</emulator>
<disk type="file" device="disk">
<driver name="qemu" type="qcow2"/>
<source file="/var/lib/libvirt/images/win10.qcow2"/>
<target dev="sda" bus="sata"/>
</disk>
<disk type="file" device="cdrom">
<driver name="qemu" type="raw"/>
<source file="/home/bob/Downloads/Win10_21H1_German_x64.iso"/>
<target dev="sdb" bus="sata"/>
<readonly/>
</disk>
<controller type="usb" index="0" model="qemu-xhci" ports="15"/>
<interface type="network">
<source network="default"/>
<mac address="52:54:00:35:be:e2"/>
<model type="e1000e"/>
</interface>
<console type="pty"/>
<channel type="spicevmc">
<target type="virtio" name="com.redhat.spice.0"/>
</channel>
<graphics type="spice" port="-1" tlsPort="-1" autoport="yes">
<image compression="off"/>
</graphics>
<sound model="ich9"/>
<video>
<model type="qxl"/>
</video>
<hostdev mode="subsystem" type="pci" managed="yes">
<source>
<address domain="0" bus="1" slot="0" function="0"/>
</source>
</hostdev>
<hostdev mode="subsystem" type="pci" managed="yes">
<source>
<address domain="0" bus="1" slot="0" function="1"/>
</source>
</hostdev>
<hostdev mode="subsystem" type="pci" managed="yes">
<source>
<address domain="0" bus="1" slot="0" function="2"/>
</source>
</hostdev>
<hostdev mode="subsystem" type="pci" managed="yes">
<source>
<address domain="0" bus="1" slot="0" function="3"/>
</source>
</hostdev>
<redirdev bus="usb" type="spicevmc"/>
<redirdev bus="usb" type="spicevmc"/>
</devices>
</domain>
Results of kvm --version
:
QEMU emulator version 4.2.1 (Debian 1:4.2-3ubuntu6.17)
Copyright (c) 2003-2019 Fabrice Bellard and the QEMU Project developers
Results of lspci -knn | grep NVIDIA -A 2
:
01:00.0 VGA compatible controller [0300]: NVIDIA Corporation TU106 [GeForce RTX 2070] [10de:1f02] (rev a1)
Subsystem: NVIDIA Corporation TU106 [GeForce RTX 2070] [10de:12fe]
Kernel driver in use: vfio-pci
Kernel modules: nvidiafb, nouveau, nvidia_drm, nvidia
01:00.1 Audio device [0403]: NVIDIA Corporation TU106 High Definition Audio Controller [10de:10f9] (rev a1)
Subsystem: NVIDIA Corporation TU106 High Definition Audio Controller [10de:12fe]
Kernel driver in use: vfio-pci
Kernel modules: snd_hda_intel
01:00.2 USB controller [0c03]: NVIDIA Corporation TU106 USB 3.1 Host Controller [10de:1ada] (rev a1)
Subsystem: NVIDIA Corporation TU106 USB 3.1 Host Controller [10de:12fe]
Kernel driver in use: vfio-pci
Kernel modules: xhci_pci
01:00.3 Serial bus controller [0c80]: NVIDIA Corporation TU106 USB Type-C UCSI Controller [10de:1adb] (rev a1)
Subsystem: NVIDIA Corporation TU106 USB Type-C UCSI Controller [10de:12fe]
Kernel driver in use: vfio-pci
Kernel modules: i2c_nvidia_gpu