scripts/setup: Use uio_pci_generic if it's loaded/compiled in

Also, for consistency, use check_for_driver() while checking if
igb_uio is loaded too.

Change-Id: I00302b3cab169c77032fc0cef0ea384e9e5eb5be
Signed-off-by: Michal Berger <michalx.berger@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5303
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
This commit is contained in:
Michal Berger 2020-11-26 18:56:05 +01:00 committed by Tomasz Zawadzki
parent fcc35c86cd
commit 9801533f8a

View File

@ -139,7 +139,7 @@ function linux_bind_driver() {
echo "$ven_dev_id" > "/sys/bus/pci/drivers/$driver_name/new_id" 2> /dev/null || true echo "$ven_dev_id" > "/sys/bus/pci/drivers/$driver_name/new_id" 2> /dev/null || true
echo "$bdf" > "/sys/bus/pci/drivers/$driver_name/bind" 2> /dev/null || true echo "$bdf" > "/sys/bus/pci/drivers/$driver_name/bind" 2> /dev/null || true
if [[ $driver_name == uio_pci_generic && -e /sys/module/igb_uio ]]; then if [[ $driver_name == uio_pci_generic ]] && ! check_for_driver igb_uio; then
# Check if the uio_pci_generic driver is broken as it might be in # Check if the uio_pci_generic driver is broken as it might be in
# some 4.18.x kernels (see centos8 for instance) - if our device # some 4.18.x kernels (see centos8 for instance) - if our device
# didn't get a proper uio entry, fallback to igb_uio # didn't get a proper uio entry, fallback to igb_uio
@ -315,7 +315,7 @@ function configure_linux_pci() {
if modinfo vfio_iommu_type1 > /dev/null; then if modinfo vfio_iommu_type1 > /dev/null; then
modprobe vfio_iommu_type1 modprobe vfio_iommu_type1
fi fi
elif modinfo uio_pci_generic > /dev/null 2>&1; then elif ! check_for_driver uio_pci_generic || modinfo uio_pci_generic > /dev/null 2>&1; then
driver_name=uio_pci_generic driver_name=uio_pci_generic
elif [[ -e $igb_uio_fallback ]]; then elif [[ -e $igb_uio_fallback ]]; then
driver_path="$igb_uio_fallback" driver_path="$igb_uio_fallback"