From 77c97a7ea85f3a1f8d2c3bf54869c0b6638519c7 Mon Sep 17 00:00:00 2001 From: Robin Murphy Date: Mon, 11 Apr 2022 13:36:32 +0100 Subject: [PATCH] habanalabs: Stop using iommu_present() 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 Reviewed-by: Oded Gabbay Signed-off-by: Oded Gabbay Signed-off-by: Greg Kroah-Hartman --- drivers/misc/habanalabs/common/debugfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/misc/habanalabs/common/debugfs.c b/drivers/misc/habanalabs/common/debugfs.c index 7c4a4d5..a94f017 100644 --- a/drivers/misc/habanalabs/common/debugfs.c +++ b/drivers/misc/habanalabs/common/debugfs.c @@ -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; } -- 2.7.4