Commit 5e5acd3d authored by Nikos Dragazis's avatar Nikos Dragazis Committed by Jim Harris
Browse files

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: default avatarNikos Dragazis <ndragazis@arrikto.com>
Reviewed-on: https://review.gerrithub.io/c/441062


Reviewed-by: default avatarDarek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
parent 70c703bb
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -170,9 +170,13 @@ 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.
			# 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}"
	fi