mirror of
https://gitlab.com/risingprismtv/single-gpu-passthrough.git
synced 2024-12-22 13:45:22 +00:00
Initial commit
This commit is contained in:
commit
9b8f02a845
3
README.md
Normal file
3
README.md
Normal file
@ -0,0 +1,3 @@
|
||||
# Single GPU Passthrough Scripts
|
||||
|
||||
Scripts for passing a Polaris GPU from a linux host to a windows VM and back.
|
37
polaris-vfio-startup.sh
Executable file
37
polaris-vfio-startup.sh
Executable file
@ -0,0 +1,37 @@
|
||||
#!/bin/bash
|
||||
# Helpful to read output when debugging
|
||||
set -x
|
||||
|
||||
# Stop display manager
|
||||
#systemctl stop x11vnc.service
|
||||
systemctl stop sddm.service
|
||||
|
||||
# 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
|
||||
|
||||
sleep 5
|
||||
|
||||
# Unload AMD drivers
|
||||
modprobe -r amdgpu
|
||||
|
||||
#/bin/polaris-unbind-and-reset.sh 0000:01:00.0
|
||||
#echo -n "0000:01:00.0" > /sys/bus/pci/drivers/amdgpu/unbind || echo "Failed to unbind gpu from amdgpu"
|
||||
#echo -n "0000:01:00.1" > /sys/bus/pci/drivers/snd_hda_intel/unbind || echo "Failed to unbind hdmi audio in gpu"
|
||||
|
||||
|
||||
# Unbind the GPU from display driver
|
||||
virsh nodedev-detach pci_0000_01_00_0
|
||||
virsh nodedev-detach pci_0000_01_00_1
|
||||
|
||||
# Load VFIO kernel module
|
||||
modprobe vfio-pci
|
||||
#tell vfio-pci that it takes care of gpu
|
||||
#echo -n "1002 67df" > /sys/bus/pci/drivers/vfio-pci/new_id
|
||||
#echo -n "1002 aaf0" > /sys/bus/pci/drivers/vfio-pci/new_id
|
||||
|
||||
|
39
polaris-vfio-teardown.sh
Executable file
39
polaris-vfio-teardown.sh
Executable file
@ -0,0 +1,39 @@
|
||||
#!/bin/bash
|
||||
set -x
|
||||
|
||||
# Unload VFIO-PCI Kernel Driver
|
||||
modprobe -r vfio-pci
|
||||
modprobe -r vfio_iommu_type1
|
||||
modprobe -r vfio
|
||||
|
||||
# Re-Bind GPU to AMD Driver
|
||||
virsh nodedev-reattach pci_0000_01_00_1
|
||||
virsh nodedev-reattach pci_0000_01_00_0
|
||||
|
||||
# Rebind VT consoles
|
||||
echo 1 > /sys/class/vtconsole/vtcon0/bind
|
||||
#echo 1 > /sys/class/vtconsole/vtcon1/bind
|
||||
|
||||
# Re-Bind EFI-Framebuffer
|
||||
#echo "efi-framebuffer.0" > /sys/bus/platform/drivers/efi-framebuffer/bind
|
||||
|
||||
#Load amd driver
|
||||
modprobe amdgpu
|
||||
|
||||
# Restart Display Manager
|
||||
systemctl start sddm.service
|
||||
#systemctl start x11vnc.service
|
||||
|
||||
#echo -n 0000:01:00.0 > /sys/bus/pci/drivers/vfio-pci/unbind || echo "Failed to unbind gpu from vfio-pci"
|
||||
#echo -n 0000:01:00.1 > /sys/bus/pci/drivers/vfio-pci/unbind || echo "Failed to unbind gpu-audio from vfio-pci"
|
||||
|
||||
#echo -n 1002 67df > /sys/bus/pci/drivers/vfio-pci/remove_id
|
||||
#echo -n 1002 aaf0 > /sys/bus/pci/drivers/vfio-pci/remove_id
|
||||
|
||||
#modprobe -r vfio-pci
|
||||
|
||||
#echo -n 0000:01:00.0 > /sys/bus/pci/drivers/amdgpu/bind || echo "Failed to bind amdgpu"
|
||||
#echo -n 0000:01:00.1 > /sys/bus/pci/drivers/snd_hda_intel/bind || echo "Failed to bind amd hdmi audio"
|
||||
|
||||
#systemctl isolate graphical.target
|
||||
#systemctl suspend
|
Loading…
Reference in New Issue
Block a user