IOMMU groups have been mandatory for some time now, so a device without one is necessarily a device without any usable IOMMU, therefore the iommu_present() check is redundant (or at best unhelpful).
Unified · Split
| @@ -745,11 +745,11 @@ static struct vfio_group *vfio_group_find_or_alloc(struct device *dev) · 744 unmodified lines | |||
| 745 | 745 | ||
| 746 | iommu_group = iommu_group_get(dev); | 746 | iommu_group = iommu_group_get(dev); |
| 747 | #ifdef CONFIG_VFIO_NOIOMMU | 747 | #ifdef CONFIG_VFIO_NOIOMMU |
| 748 | if (!iommu_group && noiommu && !iommu_present(dev->bus)) { | 748 | if (!iommu_group && noiommu) { |
| 749 | /* | 749 | /* |
| 750 | * With noiommu enabled, create an IOMMU group for devices that | 750 | * With noiommu enabled, create an IOMMU group for devices that |
| 751 | * don't already have one and don't have an iommu_ops on their | 751 | * don't already have one, implying no IOMMU hardware/driver |
| 752 | * bus. Taint the kernel because we're about to give a DMA | 752 | * exists. Taint the kernel because we're about to give a DMA |
| 753 | * capable device to a user without IOMMU protection. | 753 | * capable device to a user without IOMMU protection. |
| 754 | */ | 754 | */ |
| 755 | group = vfio_noiommu_group_alloc(dev, VFIO_NO_IOMMU); | 755 | group = vfio_noiommu_group_alloc(dev, VFIO_NO_IOMMU); |