From patchwork Wed Jan 4 12:57:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baolu Lu X-Patchwork-Id: 38916 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp5139021wrt; Wed, 4 Jan 2023 05:19:27 -0800 (PST) X-Google-Smtp-Source: AMrXdXuxbVVgabqBZC2vW7LTQpgOa9y/O1n8VUhbU+/4DZpH481QHOdWT7j9pFPJfoCZKsxPT3jA X-Received: by 2002:a05:6402:220b:b0:475:32d2:74a5 with SMTP id cq11-20020a056402220b00b0047532d274a5mr37154831edb.42.1672838367459; Wed, 04 Jan 2023 05:19:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672838367; cv=none; d=google.com; s=arc-20160816; b=CqPFhZ/OnBIwzdDVFvKV+wHulTUQ1KujZsOZ1e1JeP248KaZCBD1bvo7RBDc3pORaf tFSSaDdl4aANLiV28/tIvLT4Reqe/sgO66Pp3ddBOcr5zQlFdXo7fN5vA42L4UC0oZbL rICpqYmHO5LFdry2FzYdtTfxJ3y/QsrrxMjjfJD5YMrwUpPkwxOstFzY2qnD+OTEET7H Fh2Kvo6XChq41Jd2SO3WroKqYjPURYHIzPvgxI2iSKqSEUMBADBztr3OG4PNPqxqTSsf 4oyRzhzM+7uzJxoaGZhUctYQvdTnLG6nEzhccOQDwVpGiaA17fnfzHPiq0dreXr0ZOgO CcwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=jIv3fDEp3/nHBigape/rWZXFN7Epv/N1p9MNMbfuj+U=; b=AaXxVzAVRB1rge/tZfx2Rt7SmN6zFH49efcuJlCHAOQTFDrXsQ2yAFfCDZc7dVdZDY Z/U6O229nBSJ149UTQBw9jBDMOgJMrnApWNSIS1dKdw1v5gWeIhmae/qPLTe9SQVSRdU YL2xokIg2pdknaCnOZ3iCRJjdCVE5ccwEq7cqMd8DgWgFGpP4L+zLZ27ayOb0yH1QVf7 9bVwkhwQuofOCFADCc4gzABnucM7LrvMJSszsvReJ+L9Vs8RucvzehiHwbCaGQPgWjw7 F0Gag4yn8cMjIZgKt5lySuNe7qiCrp2+gyhPzM0Fa/2vK3FKON23x59FkS5JSUCCOnjO RXqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=BmCfGWe6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i20-20020a0564020f1400b00482457d1e83si27005322eda.589.2023.01.04.05.19.03; Wed, 04 Jan 2023 05:19:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=BmCfGWe6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230087AbjADNL0 (ORCPT + 99 others); Wed, 4 Jan 2023 08:11:26 -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 X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754098163781143799?= X-GMAIL-MSGID: =?utf-8?q?1754098163781143799?= 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 *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,