From nobody Tue Sep 16 10:49:27 2025 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 48734C4332F for ; Wed, 4 Jan 2023 13:11:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239399AbjADNL3 (ORCPT ); Wed, 4 Jan 2023 08:11:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45482 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239405AbjADNLC (ORCPT ); Wed, 4 Jan 2023 08:11:02 -0500 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E4CD63FA06 for ; Wed, 4 Jan 2023 05:09:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1672837751; x=1704373751; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=AeIus9biOgp1nN+2vk2ulQschotD0WiAc9w42SrZDaQ=; b=BmCfGWe6roZ9VQjwfD2pWwk7z9xacGfjYtpWeJtch18XmEp0uDRP5EPa J9MF6XBLqoNAF4fjBQMhdVX1xo0+1m4SavlE+KzJYPtUfzJQV8TuXM4Dm 4ZxViWrDTp9a2ndPqDq2Q+qU9vKz+h3A8gw5dRBp+tfjsSQt5YeJWoRLQ JPkCR5YXRuu15i8rw156EtdWm5p/Anepu/NFx5UZ0Lne+gXKrkrmt9Syz xgQ8kG+Z15EivIpv7d5Fd/1J5GW6q1KmjYtVswZJSYKaYWCtm3j2PJphG /r5miP8h3rxsKlI+p21LatD+wrY/kD/tYMuw058HYQwBXZTU1RD/zIbtf w==; X-IronPort-AV: E=McAfee;i="6500,9779,10579"; a="320640291" X-IronPort-AV: E=Sophos;i="5.96,300,1665471600"; d="scan'208";a="320640291" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Jan 2023 05:07:14 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10579"; a="797529267" X-IronPort-AV: E=Sophos;i="5.96,299,1665471600"; d="scan'208";a="797529267" Received: from allen-box.sh.intel.com ([10.239.159.48]) by fmsmga001.fm.intel.com with ESMTP; 04 Jan 2023 05:07:07 -0800 From: Lu Baolu To: Joerg Roedel , Jason Gunthorpe , Christoph Hellwig , Kevin Tian , Will Deacon , Robin Murphy , Jean-Philippe Brucker Cc: Suravee Suthikulpanit , Hector Martin , Sven Peter , Rob Clark , Marek Szyprowski , Krzysztof Kozlowski , Andy Gross , Bjorn Andersson , Yong Wu , Matthias Brugger , Heiko Stuebner , Matthew Rosato , Orson Zhai , Baolin Wang , Chunyan Zhang , Chen-Yu Tsai , Thierry Reding , iommu@lists.linux.dev, linux-kernel@vger.kernel.org, Lu Baolu Subject: [PATCH v4 17/19] iommu/tegra: Add set_platform_dma_ops callback Date: Wed, 4 Jan 2023 20:57:23 +0800 Message-Id: <20230104125725.271850-18-baolu.lu@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230104125725.271850-1-baolu.lu@linux.intel.com> References: <20230104125725.271850-1-baolu.lu@linux.intel.com> 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" This IOMMU driver doesn't support default domain. Add the implementation of set_platform_dma_ops callback so that the IOMMU core could return the DMA control. With the set_platform_dma_ops implemented, there's no need for detach_dev. Remove it to avoid dead code. Signed-off-by: Lu Baolu Reviewed-by: Jason Gunthorpe --- drivers/iommu/tegra-smmu.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/iommu/tegra-smmu.c b/drivers/iommu/tegra-smmu.c index 5b1af40221ec..4c4ac22d5fb1 100644 --- a/drivers/iommu/tegra-smmu.c +++ b/drivers/iommu/tegra-smmu.c @@ -511,8 +511,9 @@ static int tegra_smmu_attach_dev(struct iommu_domain *d= omain, return err; } =20 -static void tegra_smmu_detach_dev(struct iommu_domain *domain, struct devi= ce *dev) +static void tegra_smmu_set_platform_dma(struct device *dev) { + struct iommu_domain *domain =3D iommu_get_domain_for_dev(dev); struct iommu_fwspec *fwspec =3D dev_iommu_fwspec_get(dev); struct tegra_smmu_as *as =3D to_smmu_as(domain); struct tegra_smmu *smmu =3D as->smmu; @@ -965,11 +966,11 @@ static const struct iommu_ops tegra_smmu_ops =3D { .domain_alloc =3D tegra_smmu_domain_alloc, .probe_device =3D tegra_smmu_probe_device, .device_group =3D tegra_smmu_device_group, + .set_platform_dma_ops =3D tegra_smmu_set_platform_dma, .of_xlate =3D tegra_smmu_of_xlate, .pgsize_bitmap =3D SZ_4K, .default_domain_ops =3D &(const struct iommu_domain_ops) { .attach_dev =3D tegra_smmu_attach_dev, - .detach_dev =3D tegra_smmu_detach_dev, .map =3D tegra_smmu_map, .unmap =3D tegra_smmu_unmap, .iova_to_phys =3D tegra_smmu_iova_to_phys, --=20 2.34.1