recently I’ve tried to use the NVIDIA driver for my primary GeForce GT
520 and use VFIO (Virtual Function I/O) framework to passthrough my
secondary GPU to KVM virtual machine. Obviously it failed because the
‘nvidia’ kernel module locks the legacy I/O and memory region. Due to
this ‘qemu’ runs in a deadlock. This works fine with the open-source
‘nouveau’ driver and attached is a fix for the binary driver version
319.23. However I don’t know if it is the proper way. After some testing
(Xorg, DRI, VDPAU, switching between X and text-console) it looks
stable. This patch was also posted on ‘qemu-devel’ and ‘kvm’ mailing
list.
Basically the vga_tryget code doesn’t make much sense at all because the
driver never do a vga_put and vga_tryget is actually locking VGA arbitration.
This makes multi-GPU systems with different GPU vendors mostly
non-working.
Hey guys, Thanks for reporting this issue. Please provide reproduction steps step-by-step so I can reproduce this issue in house. Also attach nvidia bug report.
Thanks for your response, it seems as if I didn’t get a notification for this or something.
I run into problems when using vfio to pass another GPU to a guest and this patch fixed those problems.
The best step-by-step reproduction is probably this forum post which I followed to set this up.
Basically you need a kernel newer than 3.9 with specific options enabled and a very recent version of qemu and seabios. Qemu is then called with some parameters to specify the device to pass through and stuff:
I too have been using this patch for some months already with a GT430 (host) and an elderly 8500GT (guest) in a KVM VFIO VGA passthrough setup. Works just fine, no side effects whatsoever.
Actually, because this setup works so well, I’m thinking of buying a more powerful nVidia card for the windows virtual machine. Seeing this “feature” officially supported (or that bug fixed, whatever you may call it) would second this being a good investment.
Just to bump up. There is a very long discussion in the Arch Linux forum about VFIO primary GPU passthrough already and several people are using this patch.
It becomes more critical to fix it as wider audience is using it. Moreover for now Nvidia is the only binary driver which will work on hostnode using VFIO primary/secondary GPU passthrough with it.
mbroemme, - Could you please provide nvidia bug report of your system?
I’ve tried to use the NVIDIA driver for my primary GeForce GT
520 and use VFIO (Virtual Function I/O) framework to passthrough my
secondary GPU to KVM virtual machine.
What is make and model of you secondary GPU to KVM virtual machine ?
Also when the issue occurs - As soon as you fire command and launch VM?
While launching the VM with AMD GPU pass-through we are seeing below error message:
qemu-system-x86_64: -device vfio-pci,host=06:00.0,x-vga=on,addr=0.0,multifunction=on,bus=root.1: vfio: error no iommu_group for device
qemu-system-x86_64: -device vfio-pci,host=06:00.0,x-vga=on,addr=0.0,multifunction=on,bus=root.1: Device initialization failed.
qemu-system-x86_64: -device vfio-pci,host=06:00.0,x-vga=on,addr=0.0,multifunction=on,bus=root.1: Device ‘vfio-pci’ could not be initialized
Just a suggestion, as I see there’s been no activity on this for 2 months; a lot of people have the error message you have, depending on their exact hardware setup. I would recommend posting on the KVM VGA-Passthrough using the new vfio-vga support in kernel =>3.9 / Kernel & Hardware / Arch Linux Forums thread to help resolve it in order to move forward. There is a lot of activity on that thread and the instructions are updated and kept current on page 1. There is a hardware compatibility list posted on it as well, later in the thread in the 50-60 page area I believe.