Created
September 25, 2018 21:47
-
-
Save hyperparabolic/ecdf900f4a32139fb3967436464f50c7 to your computer and use it in GitHub Desktop.
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/sh | |
# This is a script for binding vfio-pci drivers to | |
# video cards when there are multiple copies of the | |
# same card and ids cannot be used. | |
# install this to /sbin, and add this to modprobe.d: | |
# install vfio-pci /sbin/vfio-pci-override.sh | |
for i in /sys/devices/pci*/*/*/boot_vga; do | |
if [ $(cat "$i") -eq 0 ]; then | |
GPU="${i%/boot_vga}" | |
AUDIO="$(echo "$GPU" | sed -e "s/0$/1/")" | |
echo "vfio-pci" > "$GPU/driver_override" | |
if [ -d "$AUDIO" ]; then | |
echo "vfio-pci" > "$AUDIO/driver_override" | |
fi | |
fi | |
done | |
modprobe -i vfio-pci |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment