Chuck Zmudzinski
2021-Apr-23 21:16 UTC
[Pkg-xen-devel] Xen VGA passthrough working again in Debian stable!
An old bug (#776742) reported over six years ago by Brian Paterni concerns Xen and VGA passthrough for full graphics performance in a virtual machine, and it was recently closed without being solved. About seven years ago, Xen had the best support for this feature but it has broken for a long time in Xen and that is why most users who want the VGA passthrough feature on their workstations are now using KVM/virtio based solutions instead of Xen/xl. However, I never gave up on Xen and with some workarounds I have been able to do VGA passthrough of an Intel integrated graphics device (IGD) using Xen and Debian but not since the days of wheezy have I been able to do this with unpatched and official up-to-date Debian software? until now! The magic fix came with the backport of Qemu 5.2 to buster. After installing it on my system, I was able to fairly easily configure my Debian system to passthrough the Intel IGD. Thank you Debian Qemu Team and Debian Xen Team! How I configured it: Hardware: Haswell core i5-4590S with Intel HD Graphics 4600 and ASRock B85M-Pro4 Motherboard with 16 GB memory Software: Up-to-date amd64 Debian buster using the Xen metapackage which installs some Qemu 3.1 packages. Then I installed the Qemu 5.2 backport of Qemu and its dependencies from buster-backports. Passthrough configuration: Default bios (seabios), default device model, default toolstack (xl), but a non-default setting for rdm in xl.cfg: rdm = "strategy=host,policy=relaxed" This rdm setting might not be needed for newer Intel IGD devices. Mine is about seven years old. n To make the IGD assignable, in Xen it is very simple, no need to blacklist drivers (assuming the Intel IGD is not running an X or Wayland display): sudo xl pci-assignable-add 0000:02.0 In /etc/default/grub I have: GRUB_CMDLINE_XEN="dom0_mem=2G,max:2G smt=false pv-l1tf=false iommu=1" Not all these settings in grub are necessary, but this is a setting to tweak, as well as the GRUB_CMDLINE_LINUX_DEFAULT setting in /etc/default/grub if it doesn?t work on the first try. Windows 10 works great with this setup ? I also passed through the USB 3.0 controller and the onboard realtekHD audio device and do not experience any crackling sounds or any problems that are sometimes reported when using KVM. Also, Xen?s GPLPV drivers installed fairly easily for accelerated disk and network performance. A Debian buster virtual machine did not work, because the 4.19 kernel did not successfully configure the passed through hardware with default settings. I will try a newer backported kernel and see if that works and file a bug report about that if it isn't fixed in the latest kernels. Going forward, I think Xen might be worth a try again for the difficult problem of getting VGA passthrough to Windows working on Linux. I think even the infamous code 43 error that Nvidia GeForce cards trigger is being fixed by Nvidia so the fact that Xen does not have a workaround for that problem like KVM does is not a deal breaker for Xen even for Nvidia users.