Author SHA1 Message Date
Void fa22cf6c0a Merge branch 'WORMSTweaker-master-patch-96744' into 'master'
Add link to the wiki in the README (why wasn't this done before?)

See merge request risingprismtv/single-gpu-passthrough!20
2023-07-07 12:55:21 +00:00
Void d1a8e2c6a3 Merge branch 'master' into 'master'
No longer touch system directories where not needed.

See merge request risingprismtv/single-gpu-passthrough!15
2023-07-07 12:51:26 +00:00
Balázs Vadász e70f12845e No longer touch system directories where not needed. 2023-07-07 12:51:25 +00:00
WORMSTweaker 3dd1af49e7 Add link to the wiki in the README (why wasn't this done before?) 2023-07-03 15:09:00 +00:00
5 changed files with 36 additions and 34 deletions
+2
View File
@@ -9,5 +9,7 @@ Note the PCI ids and display manager should be detected automatically. If you ar
If using startx, add a line `killall -u user_name` to qemu/vfio-startup.sh script towards the beginning and you can add a line to vfio-teardown.sh to start your window manager/ desktop environment again. Don't just add startx because it will be run as root. Instead add `su -s /bin/bash -c "/usr/bin/startx" -g username username` replacing username with your username to the end of the vfio-teardown.sh script.
For a detailled guide on how to use these scripts, [check out the the wiki of this repo.](https://gitlab.com/risingprismtv/single-gpu-passthrough/-/wikis/home)
For suggestions or support, join us on Discord at: https://discord.gg/bh4maVc
+2 -2
View File
@@ -7,12 +7,12 @@ if [[ $OBJECT == "win10" ]]; then
case "$OPERATION" in
"prepare")
systemctl start libvirt-nosleep@"$OBJECT" 2>&1 | tee -a /var/log/libvirt/custom_hooks.log
/bin/vfio-startup.sh 2>&1 | tee -a /var/log/libvirt/custom_hooks.log
/usr/local/bin/vfio-startup 2>&1 | tee -a /var/log/libvirt/custom_hooks.log
;;
"release")
systemctl stop libvirt-nosleep@"$OBJECT" 2>&1 | tee -a /var/log/libvirt/custom_hooks.log
/bin/vfio-teardown.sh 2>&1 | tee -a /var/log/libvirt/custom_hooks.log
/usr/local/bin/vfio-teardown 2>&1 | tee -a /var/log/libvirt/custom_hooks.log
;;
esac
fi
+14 -14
View File
@@ -15,7 +15,7 @@
## Void for testing and helping out in general ## ## ##
## .Chris. for testing and helping out in general ## ## Run this command ##
## WORMS for helping out with testing ## ## if you dont have ##
##################################################### ## names in your ##
##################################################### ## names in you're ##
## The VFIO community for using the scripts and ## ## lspci feedback ##
## testing them for us! ## ## in your terminal ##
##################################################### #######################
@@ -23,21 +23,21 @@
################################# Variables #################################
## Adds current time to var for use in echo for a cleaner log and script ##
DATETIME=$(date +"%m/%d/%Y %R:%S :")
DATE=$(date +"%m/%d/%Y %R:%S :")
## Sets dispmgr var as null ##
DISPMGR="null"
################################## Script ###################################
echo "$DATETIME Beginning of Startup!"
echo "$DATE Beginning of Startup!"
function stop_display_manager_if_running {
## Get display manager on systemd based distros ##
if [[ -x /run/systemd/system ]] && echo "$DATETIME Distro is using Systemd"; then
if [[ -x /run/systemd/system ]] && echo "$DATE Distro is using Systemd"; then
DISPMGR="$(grep 'ExecStart=' /etc/systemd/system/display-manager.service | awk -F'/' '{print $(NF-0)}')"
echo "$DATETIME Display Manager = $DISPMGR"
echo "$DATE Display Manager = $DISPMGR"
## Stop display manager using systemd ##
if systemctl is-active --quiet "$DISPMGR.service"; then
@@ -58,7 +58,7 @@ function stop_display_manager_if_running {
function kde-clause {
echo "$DATETIME Display Manager = display-manager"
echo "$DATE Display Manager = display-manager"
## Stop display manager using systemd ##
if systemctl is-active --quiet "display-manager.service"; then
@@ -81,10 +81,10 @@ function kde-clause {
####################################################################################################################
if pgrep -l "plasma" | grep "plasmashell"; then
echo "$DATETIME Display Manager is KDE, running KDE clause!"
echo "$DATE Display Manager is KDE, running KDE clause!"
kde-clause
else
echo "$DATETIME Display Manager is not KDE!"
echo "$DATE Display Manager is not KDE!"
stop_display_manager_if_running
fi
@@ -109,7 +109,7 @@ do
if test -x /sys/class/vtconsole/vtcon"${i}"; then
if [ "$(grep -c "frame buffer" /sys/class/vtconsole/vtcon"${i}"/name)" = 1 ]; then
echo 0 > /sys/class/vtconsole/vtcon"${i}"/bind
echo "$DATETIME Unbinding Console ${i}"
echo "$DATE Unbinding Console ${i}"
echo "$i" >> /tmp/vfio-bound-consoles
fi
fi
@@ -118,7 +118,7 @@ done
sleep "1"
if lspci -nn | grep -e VGA | grep -s NVIDIA ; then
echo "$DATETIME System has an NVIDIA GPU"
echo "$DATE System has an NVIDIA GPU"
grep -qsF "true" "/tmp/vfio-is-nvidia" || echo "true" >/tmp/vfio-is-nvidia
echo efi-framebuffer.0 > /sys/bus/platform/drivers/efi-framebuffer/unbind
@@ -131,11 +131,11 @@ if lspci -nn | grep -e VGA | grep -s NVIDIA ; then
modprobe -r drm_kms_helper
modprobe -r drm
echo "$DATETIME NVIDIA GPU Drivers Unloaded"
echo "$DATE NVIDIA GPU Drivers Unloaded"
fi
if lspci -nn | grep -e VGA | grep -s AMD ; then
echo "$DATETIME System has an AMD GPU"
echo "$DATE System has an AMD GPU"
grep -qsF "true" "/tmp/vfio-is-amd" || echo "true" >/tmp/vfio-is-amd
echo efi-framebuffer.0 > /sys/bus/platform/drivers/efi-framebuffer/unbind
@@ -145,7 +145,7 @@ if lspci -nn | grep -e VGA | grep -s AMD ; then
modprobe -r radeon
modprobe -r drm
echo "$DATETIME AMD GPU Drivers Unloaded"
echo "$DATE AMD GPU Drivers Unloaded"
fi
## Load VFIO-PCI driver ##
@@ -153,4 +153,4 @@ modprobe vfio
modprobe vfio_pci
modprobe vfio_iommu_type1
echo "$DATETIME End of Startup!"
echo "$DATE End of Startup!"
+10 -10
View File
@@ -15,7 +15,7 @@
## Void for testing and helping out in general ## ## ##
## .Chris. for testing and helping out in general ## ## Run this command ##
## WORMS for helping out with testing ## ## if you dont have ##
##################################################### ## names in your ##
##################################################### ## names in you're ##
## The VFIO community for using the scripts and ## ## lspci feedback ##
## testing them for us! ## ## in your terminal ##
##################################################### #######################
@@ -23,11 +23,11 @@
################################# Variables #################################
## Adds current time to var for use in echo for a cleaner log and script ##
DATETIME=$(date +"%m/%d/%Y %R:%S :")
DATE=$(date +"%m/%d/%Y %R:%S :")
################################## Script ###################################
echo "$DATETIME Beginning of Teardown!"
echo "$DATE Beginning of Teardown!"
## Unload VFIO-PCI driver ##
modprobe -r vfio_pci
@@ -37,7 +37,7 @@ modprobe -r vfio
if grep -q "true" "/tmp/vfio-is-nvidia" ; then
## Load NVIDIA drivers ##
echo "$DATETIME Loading NVIDIA GPU Drivers"
echo "$DATE Loading NVIDIA GPU Drivers"
modprobe drm
modprobe drm_kms_helper
@@ -47,20 +47,20 @@ if grep -q "true" "/tmp/vfio-is-nvidia" ; then
modprobe nvidia_drm
modprobe nvidia_uvm
echo "$DATETIME NVIDIA GPU Drivers Loaded"
echo "$DATE NVIDIA GPU Drivers Loaded"
fi
if grep -q "true" "/tmp/vfio-is-amd" ; then
## Load NVIDIA drivers ##
echo "$DATETIME Loading AMD GPU Drivers"
echo "$DATE Loading AMD GPU Drivers"
modprobe drm
modprobe amdgpu
modprobe radeon
modprobe drm_kms_helper
echo "$DATETIME AMD GPU Drivers Loaded"
echo "$DATE AMD GPU Drivers Loaded"
fi
## Restart Display Manager ##
@@ -69,7 +69,7 @@ while read -r DISPMGR; do
if command -v systemctl; then
## Make sure the variable got collected ##
echo "$DATETIME Var has been collected from file: $DISPMGR"
echo "$DATE Var has been collected from file: $DISPMGR"
systemctl start "$DISPMGR.service"
@@ -89,11 +89,11 @@ while read -r consoleNumber; do
if test -x /sys/class/vtconsole/vtcon"${consoleNumber}"; then
if [ "$(grep -c "frame buffer" "/sys/class/vtconsole/vtcon${consoleNumber}/name")" \
= 1 ]; then
echo "$DATETIME Rebinding console ${consoleNumber}"
echo "$DATE Rebinding console ${consoleNumber}"
echo 1 > /sys/class/vtconsole/vtcon"${consoleNumber}"/bind
fi
fi
done < "$input"
echo "$DATETIME End of Teardown!"
echo "$DATE End of Teardown!"
+8 -8
View File
@@ -8,13 +8,13 @@ if test -e /etc/libvirt/hooks/qemu;
then
mv /etc/libvirt/hooks/qemu /etc/libvirt/hooks/qemu_last_backup
fi
if test -e /bin/vfio-startup.sh;
if test -e /usr/local/bin/vfio-startup;
then
mv /bin/vfio-startup.sh /bin/vfio-startup.sh.bkp
mv /usr/local/bin/vfio-startup /usr/local/bin/vfio-startup.bkp
fi
if test -e /bin/vfio-teardown.sh;
if test -e /usr/local/bin/vfio-teardown;
then
mv /bin/vfio-teardown.sh /bin/vfio-teardown.sh.bkp
mv /usr/local/bin/vfio-teardown /usr/local/bin/vfio-teardown.bkp
fi
if test -e /etc/systemd/system/libvirt-nosleep@.service;
then
@@ -22,10 +22,10 @@ then
fi
cp systemd-no-sleep/libvirt-nosleep@.service /etc/systemd/system/libvirt-nosleep@.service
cp hooks/vfio-startup.sh /bin/vfio-startup.sh
cp hooks/vfio-teardown.sh /bin/vfio-teardown.sh
cp hooks/vfio-startup /usr/local/bin/vfio-startup
cp hooks/vfio-teardown /usr/local/bin/vfio-teardown
cp hooks/qemu /etc/libvirt/hooks/qemu
chmod +x /bin/vfio-startup.sh
chmod +x /bin/vfio-teardown.sh
chmod +x /usr/local/bin/vfio-startup
chmod +x /usr/local/bin/vfio-teardown
chmod +x /etc/libvirt/hooks/qemu