Update polaris-vfio-startup.sh: added novueau, amdgpu-pro, as well as i915(Intel integrated graphics) kernel module to be unloaded just in-case someone is using those drivers.

This commit is contained in:
Ansh Srivastava 2020-10-08 19:40:52 +00:00 committed by Risingprism
parent 2cb70813c6
commit aef8f3c404
5 changed files with 34 additions and 9 deletions

View File

@ -1,3 +1,10 @@
# Single GPU Passthrough Scripts
Scripts for passing a Polaris GPU from a linux host to a windows VM and back.
Scripts for passing a single GPU from a Linux host to a Windows VM and back.
1. Change PCI ids in the vfio-startup and teardown script.
2. Change the VM name in qemu if not already win10
3. Run the install.sh script as root
For suggestions or support, join us on Discord at: https://discord.gg/bh4maVc

13
install.sh Normal file
View File

@ -0,0 +1,13 @@
#!/bin/sh
mv /etc/libvirt/hooks/qemu /etc/libvirt/hooks/qemu_last_backup
mv /bin/vfio-startup.sh /bin/vfio-startup.sh.bkp
mv /bin/vfio-teardown.sh /bin/vfio-teardown.sh.bkp
cp vfio-startup.sh /bin/vfio-startup.sh
cp vfio-teardown.sh /bin/vfio-teardown.sh
cp qemu /etc/libvirt/hooks/qemu
chmod +x /bin/vfio-startup.sh
chmod +x /bin/vfio-teardonw/sh
chmod +x /etc/libvirt/hooks/qemu

7
qemu
View File

@ -1,12 +1,13 @@
#!/bin/sh
#!/bin/bash
# Script for win10
if [[ $1 == "win10" ]]; then
if [[ $2 == "prepare" ]]; then
/bin/polaris-vfio-startup.sh
/bin/vfio-startup.sh 2>&1 | tee -a /var/log/libvirt/custom_hooks.log
fi
if [[ $2 == "release" ]]; then
/bin/polaris-vfio-teardown.sh
/bin/vfio-teardown.sh 2>&1 | tee -a /var/log/libvirt/custom_hooks.log
fi
fi

View File

@ -37,37 +37,41 @@ stop_display_manager_if_running gdm.service
stop_display_manager_if_running lightdm.service
stop_display_manager_if_running lxdm.service
stop_display_manager_if_running xdm.service
stop_display_manager_if_running mdm.service
stop_display_manager_if_running display-manager.service
# Unbind VTconsoles if currently bound
if test -e "/sys/class/vtconsole/vtcon0/bind" ; then
echo 0 > /sys/class/vtconsole/vtcon0/bind
sleep "${long_delay}"
fi
if test -e "/sys/class/vtconsole/vtcon1/bind" ; then
echo 0 > /sys/class/vtconsole/vtcon1/bind
sleep "${long_delay}"
fi
#Unbind EFI-Framebuffer if currently bound
if test -e "/sys/bus/platform/drivers/efi-framebuffer/unbind" ; then
echo efi-framebuffer.0 > /sys/bus/platform/drivers/efi-framebuffer/unbind
sleep "${medium_delay}"
else
echo "Could not find framebuffer to unload!"
fi
sleep "${long_delay}"
# Unload loaded GPU drivers
if test -e "/tmp/vfio-loaded-gpu-modules" ; then
rm -f /tmp/vfio-loaded-gpu-modules
fi
unload_module_if_loaded amdgpu-pro
unload_module_if_loaded amdgpu
unload_module_if_loaded nvidia_drm
unload_module_if_loaded nvidia_modeset
unload_module_if_loaded nvidia_uvm
unload_module_if_loaded nvidia
unload_module_if_loaded ipmi_devintf
unload_module_if_loaded nouveau
unload_module_if_loaded i915
# Unbind the GPU from display driver
virsh nodedev-detach pci_0000_01_00_0
@ -76,4 +80,4 @@ virsh nodedev-detach pci_0000_01_00_1
# Load VFIO kernel module
modprobe vfio-pci
echo "End of startup!"
echo "End of startup!"