Last active
December 1, 2019 08:27
-
-
Save pluser/9b702f2df59cba2f4d8749779942a7f4 to your computer and use it in GitHub Desktop.
VFIO amdgpu related scripts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
modprobe amdgpu | |
for dev in "$@"; do | |
vendor=$(cat /sys/bus/pci/devices/$dev/vendor) | |
device=$(cat /sys/bus/pci/devices/$dev/device) | |
if [ -e /sys/bus/pci/devices/$dev/driver ]; then | |
echo $dev > /sys/bus/pci/devices/$dev/driver/unbind | |
fi | |
echo $vendor $device > /sys/bus/pci/drivers/amdgpu/new_id | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
modprobe pcieport | |
for dev in "$@"; do | |
vendor=$(cat /sys/bus/pci/devices/$dev/vendor) | |
device=$(cat /sys/bus/pci/devices/$dev/device) | |
if [ -e /sys/bus/pci/devices/$dev/driver ]; then | |
echo $dev > /sys/bus/pci/devices/$dev/driver/unbind | |
fi | |
echo $vendor $device > /sys/bus/pci/drivers/pcieport/new_id | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
modprobe vfio-pci | |
for dev in "$@"; do | |
vendor=$(cat /sys/bus/pci/devices/$dev/vendor) | |
device=$(cat /sys/bus/pci/devices/$dev/device) | |
if [ -e /sys/bus/pci/devices/$dev/driver ]; then | |
echo $dev > /sys/bus/pci/devices/$dev/driver/unbind | |
fi | |
echo $vendor $device > /sys/bus/pci/drivers/vfio-pci/new_id | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment