You are not logged in.
Pages: 1
Is possible (any method) to switch between Graphics Cards while system is running? And than disabled card bind to KVM/QEMU?
I have 2 GPUs (1x Intel HD 4600 and 1x NVIDIA GeForce 1060)
I would like to have virtual Windows 7 using KVM with GPU passthrough.
Intel Graphics for Linux (host) NVIDIA for Windows 7 (guest)
I know that i have to set stub for NVIDIA.
I would like to have primary GPU Intel Graphics and use sometimes NVIDIA card using Bumblebee (nvidia optimus).
But problem is that then i cant bind NVIDIA card to virtual machine. Is possible to unbind drivers while system is running? I dont think it is problem, because X server is using primary iGPU (Intel Graphics, not NVIDIA)
Thank you very much
PS: I have a desktop
I use several linux distros like: Archlinux, Ubuntu, Fedora, Linux Mint
Offline
If the GPU is not used by X, I think it should be possible. (I know from experience that with X using said GPU, your system will freeze )
What I have used myself to unbind the driver was:
echo $dev > /sys/bus/pci/devices/$dev/driver/unbind
I executed this twice, where (for me) $dev was 0000:02:00.0 (the 2nd nVidia GPU in my system) with the first execution and 0000:02:00.1 (the GPU's audio) for the second.
You should be able to rebind it afterwards with
echo $dev > /sys/bus/pci/drivers/nvidia/bind
for the GPU and
echo $dev > /sys/bus/pci/drivers/snd_hda_intel/bind
for the audio component of the GPU.
If you're using libvirt to manage your VM it should be able to handle things for you automatically. Note that I have not used this much so from memory I can only say it managed to detach it from the host and attach it to the VM. I can't remember if it re-attached it to the host when the VM was shut down.
Last edited by Omar007 (2016-12-19 12:47:30)
Offline
So
echo $dev > /sys/bus/pci/devices/$dev/driver/unbind
Does the same job like pci-stub?
I use several linux distros like: Archlinux, Ubuntu, Fedora, Linux Mint
Offline
Not exactly; pci-stub binds in place of the nVidia driver so the nVidia driver has no chance to bind to the device, whereas with the above command the nVidia driver did bind with the GPU and you manually unbind it.
The end result is the same though; you have a GPU that can be freely used inside a VM.
Last edited by Omar007 (2016-12-19 15:52:56)
Offline
It must be nvidia opensource driver or proprietary driver? Or it doesn't matter?
I use several linux distros like: Archlinux, Ubuntu, Fedora, Linux Mint
Offline
Unbinding works on every driver, you can even boot with pci-stub bound to some device and later unbind pci-stub and bind nvidia. Or switch from nvidia to nouveau and back - as long as the device isn't being used at the moment. There is also analogous functionality on USB devices and possibly others.
Offline
Pages: 1