You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
644 B
Plaintext
21 lines
644 B
Plaintext
4 years ago
|
#!/bin/bash
|
||
4 years ago
|
#sudo rmmod vfio-pci
|
||
4 years ago
|
for dev in "$@"; do
|
||
|
vendor=$(cat /sys/bus/pci/devices/$dev/vendor)
|
||
|
device=$(cat /sys/bus/pci/devices/$dev/device)
|
||
|
echo "Removing ${dev} from vfio-pci id list"
|
||
4 years ago
|
echo "${vendor} ${device}" | sudo tee /sys/bus/pci/drivers/vfio-pci/remove_id
|
||
4 years ago
|
sleep 0.1
|
||
|
echo "Remove PCI device"
|
||
4 years ago
|
echo 1 | sudo tee /sys/bus/pci/devices/${dev}/remove
|
||
4 years ago
|
while [[ -e "/sys/bus/pci/devices/${dev}" ]]; do
|
||
|
sleep 0.1
|
||
|
done
|
||
|
echo "Rescanning..."
|
||
4 years ago
|
echo 1 | sudo tee /sys/bus/pci/rescan
|
||
4 years ago
|
while [[ ! -e "/sys/bus/pci/devices/${dev}" ]]; do
|
||
|
sleep 0.1
|
||
|
done
|
||
|
done
|
||
4 years ago
|
sudo rmmod vfio-pci
|