summaryrefslogtreecommitdiffstats
path: root/scripts/vfio-bind
blob: f87f9c2386cf974180e67d7ff94b4cc14e4c7738 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
#!/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