From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 342972F49 for ; Wed, 4 Jan 2023 13:07:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1672837655; x=1704373655; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=AeIus9biOgp1nN+2vk2ulQschotD0WiAc9w42SrZDaQ=; b=i2+3ig9o2eim1CwxKuAYv7ERUHeawEg1SdD7af3mqRPLJ6Ndb6dUd7Iq f0RM9hsUGH45TdkWgB6jsgBjXz3vqDvwRQuQQKvNC9tx596xpKd1LIAyk XVuco2fUbjTL9mKC8E31/7QRjqpSeaB5xTlkc9C/UXgh+ASsQMzHA24fu lvmJg+3yMg1/sJ4eKuDvOl6tpoS+gXImA98Y56sjWvH6gaGf5mCIENAE2 XTeeeGP0piO89I4pro853RdIGKkNnAoYq5/xAlQgv/WMiCKoNqIDC943k ljGrz2tmTd+2IYkM74JhJ8WeXXmJt+ZQ7KR06VeHe3EIIQjQ1GYTmzetM g==; X-IronPort-AV: E=McAfee;i="6500,9779,10579"; a="320640286" X-IronPort-AV: E=Sophos;i="5.96,300,1665471600"; d="scan'208";a="320640286" 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> Precedence: bulk X-Mailing-List: iommu@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 --- 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 *domain, return err; } -static void tegra_smmu_detach_dev(struct iommu_domain *domain, struct device *dev) +static void tegra_smmu_set_platform_dma(struct device *dev) { + struct iommu_domain *domain = iommu_get_domain_for_dev(dev); struct iommu_fwspec *fwspec = dev_iommu_fwspec_get(dev); struct tegra_smmu_as *as = to_smmu_as(domain); struct tegra_smmu *smmu = as->smmu; @@ -965,11 +966,11 @@ static const struct iommu_ops tegra_smmu_ops = { .domain_alloc = tegra_smmu_domain_alloc, .probe_device = tegra_smmu_probe_device, .device_group = tegra_smmu_device_group, + .set_platform_dma_ops = tegra_smmu_set_platform_dma, .of_xlate = tegra_smmu_of_xlate, .pgsize_bitmap = SZ_4K, .default_domain_ops = &(const struct iommu_domain_ops) { .attach_dev = tegra_smmu_attach_dev, - .detach_dev = tegra_smmu_detach_dev, .map = tegra_smmu_map, .unmap = tegra_smmu_unmap, .iova_to_phys = tegra_smmu_iova_to_phys, -- 2.34.1