To preface this, my setup: Ryzen 1700, kernel 5.0.10 with ACS patch on Debian Sid, a GTX 970 & 980ti both under the proprietary drivers.
I’ve been trying to get a VM running under libvirt that will passthrough the 980ti (which has no displays connected) and use it
for looking glass, then after shutting down the VM return the 980ti to the host for extra CUDA rendering horsepower, preferably without Xorg restart.
So far what i have tried is having scripts run before and after libvirt startup using this (yes i have also tested that the scripts actually work by touching an unrelated file). These scripts try to detach the gpu from the nvidia driver to vfio-pci using echo calls to files in /sys/bus/pci suggested in this thread. But I have no clue what calls will work, and the ones i have tryed in that thread and others (of course modifying the PCI ids for to one for my card) will lead to Xorg freezing and the system becoming totally unresponsive (not even Ctrl-Alt-F* terminals work). And i know this isnt a problem with vfio because i can passthrough one of my pci wireless cards just fine. I’ve also tried this guide and adapted it for my setup.
My scripts looks like this:
VM Startup
VM Shutdown
I cannot find any good documentation on how to do this or even if this is possible. This is driving me crazy, any help would be appreciated.
My libvirt xml too: https://hastebin.com/idotemikuy.xml