Commit 3ac0a6ed authored by Michal Berger's avatar Michal Berger Committed by Tomasz Zawadzki
Browse files

scripts/common: Wrap iommu check in is_iommu_enabled()



Change-Id: Id04820450aa3478621f01bbdbd18937da28d9bd8
Signed-off-by: default avatarMichal Berger <michal.berger@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/20956


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: default avatarJim Harris <jim.harris@samsung.com>
Community-CI: Mellanox Build Bot
parent c5c065e9
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -119,6 +119,12 @@ cache_pci_iommu_group() {
	cache_iommu_group "$iommu_group"
}

is_iommu_enabled() {
	[[ -e /sys/kernel/iommu_groups/0 ]] && return 0
	[[ -e /sys/module/vfio/parameters/enable_unsafe_noiommu_mode ]] || return 1
	[[ $(< /sys/module/vfio/parameters/enable_unsafe_noiommu_mode) == Y ]]
}

cache_pci_bus_sysfs() {
	[[ -e /sys/bus/pci/devices ]] || return 1

+1 −3
Original line number Diff line number Diff line
@@ -399,9 +399,7 @@ function configure_linux_pci() {
		if [[ "$driver_path" = "$driver_name" ]]; then
			driver_path=""
		fi
	elif [[ -n "$(ls /sys/kernel/iommu_groups)" || (-e \
	/sys/module/vfio/parameters/enable_unsafe_noiommu_mode && \
	"$(cat /sys/module/vfio/parameters/enable_unsafe_noiommu_mode)" == "Y") ]]; then
	elif is_iommu_enabled; then
		driver_name=vfio-pci
		# Just in case, attempt to load VFIO_IOMMU_TYPE1 module into the kernel - this
		# should be done automatically by modprobe since this particular module should