habanalabs: Stop using iommu_present()
authorRobin Murphy <robin.murphy@arm.com>
Mon, 11 Apr 2022 12:36:32 +0000 (13:36 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 22 May 2022 19:01:18 +0000 (21:01 +0200)
Even if an IOMMU might be present for some PCI segment in the system,
that doesn't necessarily mean it provides translation for the device
we care about. Replace iommu_present() with a more appropriate check.

Signed-off-by: Robin Murphy <robin.murphy@arm.com>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/misc/habanalabs/common/debugfs.c

index 7c4a4d5..a94f017 100644 (file)
@@ -722,7 +722,7 @@ static int hl_access_mem(struct hl_device *hdev, u64 addr, u64 *val,
        if (found)
                return 0;
 
-       if (!user_address || iommu_present(&pci_bus_type)) {
+       if (!user_address || device_iommu_mapped(&hdev->pdev->dev)) {
                rc = -EINVAL;
                goto err;
        }