From nobody Thu Jun 18 23:48:54 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6F88BC433EF for ; Mon, 11 Apr 2022 12:36:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346164AbiDKMi7 (ORCPT ); Mon, 11 Apr 2022 08:38:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49516 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232573AbiDKMiz (ORCPT ); Mon, 11 Apr 2022 08:38:55 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 5DF2121825 for ; Mon, 11 Apr 2022 05:36:37 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id CCF63D6E; Mon, 11 Apr 2022 05:36:36 -0700 (PDT) Received: from e121345-lin.cambridge.arm.com (e121345-lin.cambridge.arm.com [10.1.196.40]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 0669F3F5A1; Mon, 11 Apr 2022 05:36:35 -0700 (PDT) From: Robin Murphy To: ogabbay@kernel.org, arnd@arndb.de, gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org Subject: [PATCH v2] habanalabs: Stop using iommu_present() Date: Mon, 11 Apr 2022 13:36:32 +0100 Message-Id: X-Mailer: git-send-email 2.28.0.dirty MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 --- v2: Rebase on habanalabs-next 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/habana= labs/common/debugfs.c index 7c4a4d504e4c..a94f01713efd 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 ad= dr, u64 *val, if (found) return 0; =20 - if (!user_address || iommu_present(&pci_bus_type)) { + if (!user_address || device_iommu_mapped(&hdev->pdev->dev)) { rc =3D -EINVAL; goto err; } --=20 2.28.0.dirty