setup.sh: use vfio kernel driver in case of vfio no-IOMMU mode

The current state for the setup script is that the vfio kernel driver
will be preferred against the uio_pci_generic driver only if an IOMMU is
present in the system. This is checked by looking for any IOMMU groups
in sysfs.

In case of vfio no-IOMMU driver, there are no IOMMU groups when loading
the vfio modules. The IOMMU groups are created when the PCI devices get
bound to the vfio-pci driver. Thus, even though the vfio driver is
loaded, the setup script will prefer to use the uio_pci_generic kernel
driver. This patch changes this behavior.

In order to support vfio no-IOMMU mode, the setup script will be
checking if the vfio module is loaded with parameter
"enable_unsafe_noiommu_mode". In other case, it will be falling back to
the uio_pci_generic driver.

Change-Id: I1e8317bc4e3d6af4ba8a9e0c51175c9f4190f47b
Signed-off-by: Nikos Dragazis <ndragazis@arrikto.com>
Reviewed-on: https://review.gerrithub.io/c/441062
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Nikos Dragazis 2019-02-06 03:25:15 +02:00 committed by Jim Harris
parent 70c703bb49
commit 5e5acd3dbf

View File

@ -170,8 +170,12 @@ function configure_linux_pci {
if [ -z "${DRIVER_OVERRIDE}" ]; then
driver_name=vfio-pci
if [ -z "$(ls /sys/kernel/iommu_groups)" ]; then
# No IOMMU. Use uio.
driver_name=uio_pci_generic
# No IOMMU. If no-IOMMU mode vfio is not present, then use uio.
if ! [ -e /sys/module/vfio/parameters/enable_unsafe_noiommu_mode ] ||
! [ "$(cat /sys/module/vfio/parameters/enable_unsafe_noiommu_mode)" == "Y" ]
then
driver_name=uio_pci_generic
fi
fi
else
driver_name="${DRIVER_OVERRIDE}"