blob: 3d8559e3e15c90d6bd6bb1896f220a1af9dbcb74 [file] [log] [blame]
Damjan Marionf0ccbb02016-10-06 16:53:32 +02001#!/bin/bash
2
3# Bind all unused PCI devices bound to uio drivers
4# back to default kernel driver
5
6if [ $USER != "root" ] ; then
7 echo "Restarting script with sudo..."
8 sudo $0 ${*}
9 exit
10fi
11
12for f in /sys/bus/pci/drivers/{igb_uio,uio_pci_generic,vfio-pci}/*; do
13 [ -e ${f}/config ] || continue
14 fuser -s ${f}/config && continue
15 echo 1 > ${f}/remove
16 removed=y
17done
18
19[ -n ${removed} ] && echo 1 > /sys/bus/pci/rescan