setup.sh: don't bind virtio-pci devices with active mountpoints
Change-Id: I92aeb8259383fa3e207e6ab3059109f8275bc549 Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com> Reviewed-on: https://review.gerrithub.io/393684 Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com> Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
380b3fc878
commit
f869082a91
@ -71,6 +71,18 @@ function get_nvme_name_from_bdf {
|
||||
done
|
||||
}
|
||||
|
||||
function get_virtio_name_from_bdf {
|
||||
set +e
|
||||
virtio_ctrlrs=`lsblk --nodeps --output "NAME,SUBSYSTEMS" | grep virtio | awk '{print $1}'`
|
||||
set -e
|
||||
for ctrlr in $virtio_ctrlrs; do
|
||||
if readlink "/sys/block/$ctrlr" | grep -q "$1"; then
|
||||
eval "$2=$ctrlr"
|
||||
return
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
function configure_linux_pci {
|
||||
driver_name=vfio-pci
|
||||
if [ -z "$(ls /sys/kernel/iommu_groups)" ]; then
|
||||
@ -116,7 +128,13 @@ function configure_linux_pci {
|
||||
|
||||
for dev_id in `cat $TMP`; do
|
||||
for bdf in $(iter_pci_dev_id 1af4 $dev_id); do
|
||||
linux_bind_driver "$bdf" "$driver_name"
|
||||
blkname=''
|
||||
get_virtio_name_from_bdf "$bdf" blkname
|
||||
if mount | grep -q "/dev/$blkname"; then
|
||||
echo Active mountpoints on /dev/$blkname, so not binding PCI dev $bdf
|
||||
else
|
||||
linux_bind_driver "$bdf" "$driver_name"
|
||||
fi
|
||||
done
|
||||
done
|
||||
rm $TMP
|
||||
|
Loading…
Reference in New Issue
Block a user