Add USB passthrough notes
parent
ab17ed4a38
commit
c08ccd4111
@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
|
||||
# mafferri (https://bbs.archlinux.org)
|
||||
|
||||
BASE="/sys/kernel/iommu_groups"
|
||||
|
||||
for i in $(find $BASE -maxdepth 1 -mindepth 1 -type d); do
|
||||
GROUP=$(basename $i)
|
||||
echo "### Group $GROUP ###"
|
||||
for j in $(find $i/devices -type l); do
|
||||
DEV=$(basename $j)
|
||||
echo -n " "
|
||||
lspci -s $DEV
|
||||
done
|
||||
done
|
@ -0,0 +1,32 @@
|
||||
#!/bin/sh
|
||||
|
||||
# mafferri (https://bbs.archlinux.org)
|
||||
|
||||
if [ ! -e /sys/kernel/iommu_groups/$1 ]; then
|
||||
echo "IOMMU group $1 not found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -e /sys/bus/pci/drivers/vfio-pci ]; then
|
||||
sudo modprobe vfio-pci
|
||||
fi
|
||||
|
||||
for i in $(ls /sys/kernel/iommu_groups/$1/devices/); do
|
||||
if [ -e /sys/kernel/iommu_groups/$1/devices/$i/driver ]; then
|
||||
if [ "$(basename $(readlink -f \
|
||||
/sys/kernel/iommu_groups/$1/devices/$i/driver))" != \
|
||||
"pcieport" ]; then
|
||||
echo $i | sudo tee \
|
||||
/sys/kernel/iommu_groups/$1/devices/$i/driver/unbind
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
for i in $(ls /sys/kernel/iommu_groups/$1/devices/); do
|
||||
if [ ! -e /sys/kernel/iommu_groups/$1/devices/$i/driver ]; then
|
||||
VEN=$(cat /sys/kernel/iommu_groups/$1/devices/$i/vendor)
|
||||
DEV=$(cat /sys/kernel/iommu_groups/$1/devices/$i/device)
|
||||
echo $VEN $DEV | sudo tee \
|
||||
/sys/bus/pci/drivers/vfio-pci/new_id
|
||||
fi
|
||||
done
|
@ -0,0 +1,21 @@
|
||||
#!/bin/sh
|
||||
|
||||
# mafferri (https://bbs.archlinux.org)
|
||||
|
||||
if [ ! -e /sys/kernel/iommu_groups/$1 ]; then
|
||||
echo "IOMMU group $1 not found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
for i in $(ls /sys/kernel/iommu_groups/$1/devices/); do
|
||||
VEN=$(cat /sys/kernel/iommu_groups/$1/devices/$i/vendor)
|
||||
DEV=$(cat /sys/kernel/iommu_groups/$1/devices/$i/device)
|
||||
echo $VEN $DEV | sudo tee \
|
||||
/sys/bus/pci/drivers/vfio-pci/remove_id
|
||||
echo $i | sudo tee \
|
||||
/sys/kernel/iommu_groups/$1/devices/$i/driver/unbind
|
||||
done
|
||||
|
||||
for i in $(ls /sys/kernel/iommu_groups/$1/devices/); do
|
||||
echo $i | sudo tee /sys/bus/pci/drivers_probe
|
||||
done
|
Loading…
Reference in New Issue