#!/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 vfio-pci > /sys/bus/pci/devices/$dev/driver_override
                echo $dev > /sys/bus/pci/devices/$dev/driver/unbind
        fi

        echo $vendor $device > /sys/bus/pci/drivers/vfio-pci/new_id
done

