vfio: Ignore -ENODEV when getting MSI cookie
authorAndre Przywara <andre.przywara@arm.com>
Wed, 1 Apr 2020 10:27:24 +0000 (11:27 +0100)
committerAlex Williamson <alex.williamson@redhat.com>
Wed, 1 Apr 2020 19:51:51 +0000 (13:51 -0600)
When we try to get an MSI cookie for a VFIO device, that can fail if
CONFIG_IOMMU_DMA is not set. In this case iommu_get_msi_cookie() returns
-ENODEV, and that should not be fatal.

Ignore that case and proceed with the initialisation.

This fixes VFIO with a platform device on the Calxeda Midway (no MSIs).

Fixes: f6810c15cf973f ("iommu/arm-smmu: Clean up early-probing workarounds")
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Robin Murphy <robin.murphy@arm.com>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
drivers/vfio/vfio_iommu_type1.c

index 9fdfae1cb17aa5fccf39c10359447c639781c781..85b32c3252829de7fb42b5fcb3c6ebde6e989555 100644 (file)
@@ -1787,7 +1787,7 @@ static int vfio_iommu_type1_attach_group(void *iommu_data,
 
        if (resv_msi) {
                ret = iommu_get_msi_cookie(domain->domain, resv_msi_base);
-               if (ret)
+               if (ret && ret != -ENODEV)
                        goto out_detach;
        }