Open RobCod opened 1 year ago
have the same problem I never found a solution myself, about to edit the tare down scrip to just restart the whole system as a hot fix
have the same problem I never found a solution myself, about to edit the tare down scrip to just restart the whole system as a hot fix
So I combined multiple pass-through techniques to get it to work, replace your start/stop scripts with the following. Obviously if you are with an AMD GPU you're on your own to figure out what modules need to be loaded and unloaded. But this should be plug and play with nvidia.
Start.sh
#!/bin/bash
## Helpful to read output when debugging
set -x
# Stop display manager
systemctl stop display-manager.service
## Uncomment the following line if you use GDM
#killall gdm-x-session
# Unbind VTconsoles
echo 0 > /sys/class/vtconsole/vtcon0/bind
echo 0 > /sys/class/vtconsole/vtcon1/bind
# Unbind EFI-Framebuffer
echo efi-framebuffer.0 > /sys/bus/platform/drivers/efi-framebuffer/unbind
# Avoid a Race condition by waiting 2 seconds. This can be calibrated to be shorter or longer if required for your system
sleep 2
# Unload all Nvidia drivers
modprobe -r nvidia_drm
modprobe -r nvidia_modeset
modprobe -r nvidia_uvm
modprobe -r nvidia
## Load vfio
modprobe vfio
modprobe vfio_iommu_type1
modprobe vfio_pci
Stop.sh
#!/bin/bash
set -x
## Unload vfio
modprobe -r vfio_pci
modprobe -r vfio_iommu_type1
modprobe -r vfio
# Rebind VT consoles
echo 1 > /sys/class/vtconsole/vtcon0/bind
echo 1 > /sys/class/vtconsole/vtcon1/bind
nvidia-xconfig --query-gpu-info > /dev/null 2>&1
echo "efi-framebuffer.0" > /sys/bus/platform/drivers/efi-framebuffer/bind
modprobe nvidia_drm
modprobe nvidia_modeset
modprobe nvidia_uvm
modprobe nvidia
# Restart Display Manager
systemctl start display-manager.service
Booting up the vm works perfect, but upon shutting down the gpu is never given control of the gpu back and the screen stays black until restart. Either that or startx isn't run
Did I miss a step?