From nobody Fri Sep 19 05:39:42 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 5416EC433FE for ; Mon, 28 Nov 2022 06:54:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229870AbiK1GyS (ORCPT ); Mon, 28 Nov 2022 01:54:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229873AbiK1GyQ (ORCPT ); Mon, 28 Nov 2022 01:54:16 -0500 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 97024140F2 for ; Sun, 27 Nov 2022 22:54:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1669618454; x=1701154454; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=z+afdRodACErnoYidPGbh7hMpmtegQAHzVqp7Lq5B/A=; b=PEVxGswz8WYVMfM1oFkC6rOxs1Mml/s7QXR9/d6Ai0KvG0Lw8NcKVX4p T9YObTNeWFmAHRa9nVZMzbk1GPH5Vgs9urtufb5Mp441YhyEzcA0t6Lq8 JwJoUNBCkEHooiz3HSFIe4JwQOcy3NH/+GLBW0G1yX64qQ5/AAkeod/p9 /WELCPcaZaFXgZGcSYE0pqViBPvgKl+oExFuyWdgT3irTY+P062s0qjEC 3AF9zEIfgfxblb+cnqHNkf+gUwWFrOprOkJn5UGnKeLTR39k/xzRYKHSL ZLfRCTWw/NTgcBdTtDbxn5UijTQccEf/DmDguWcX/FdXKKcjnhN3rH5zp w==; X-IronPort-AV: E=McAfee;i="6500,9779,10544"; a="341672029" X-IronPort-AV: E=Sophos;i="5.96,199,1665471600"; d="scan'208";a="341672029" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Nov 2022 22:54:14 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10544"; a="674120646" X-IronPort-AV: E=Sophos;i="5.96,199,1665471600"; d="scan'208";a="674120646" Received: from allen-box.sh.intel.com ([10.239.159.48]) by orsmga008.jf.intel.com with ESMTP; 27 Nov 2022 22:54: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 v3 01/20] iommu/amd: Remove detach_dev callback Date: Mon, 28 Nov 2022 14:46:29 +0800 Message-Id: <20221128064648.1934720-2-baolu.lu@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221128064648.1934720-1-baolu.lu@linux.intel.com> References: <20221128064648.1934720-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" The AMD IOMMU supports default domain, so the detach_dev op will never be called. Remove it to avoid dead code. Signed-off-by: Lu Baolu Reviewed-by: Jason Gunthorpe --- drivers/iommu/amd/iommu.c | 26 -------------------------- 1 file changed, 26 deletions(-) diff --git a/drivers/iommu/amd/iommu.c b/drivers/iommu/amd/iommu.c index 5c381cc3658e..bd1970b4f48b 100644 --- a/drivers/iommu/amd/iommu.c +++ b/drivers/iommu/amd/iommu.c @@ -2126,31 +2126,6 @@ static void amd_iommu_domain_free(struct iommu_domai= n *dom) protection_domain_free(domain); } =20 -static void amd_iommu_detach_device(struct iommu_domain *dom, - struct device *dev) -{ - struct iommu_dev_data *dev_data =3D dev_iommu_priv_get(dev); - struct amd_iommu *iommu; - - if (!check_device(dev)) - return; - - if (dev_data->domain !=3D NULL) - detach_device(dev); - - iommu =3D rlookup_amd_iommu(dev); - if (!iommu) - return; - -#ifdef CONFIG_IRQ_REMAP - if (AMD_IOMMU_GUEST_IR_VAPIC(amd_iommu_guest_ir) && - (dom->type =3D=3D IOMMU_DOMAIN_UNMANAGED)) - dev_data->use_vapic =3D 0; -#endif - - iommu_completion_wait(iommu); -} - static int amd_iommu_attach_device(struct iommu_domain *dom, struct device *dev) { @@ -2414,7 +2389,6 @@ const struct iommu_ops amd_iommu_ops =3D { .def_domain_type =3D amd_iommu_def_domain_type, .default_domain_ops =3D &(const struct iommu_domain_ops) { .attach_dev =3D amd_iommu_attach_device, - .detach_dev =3D amd_iommu_detach_device, .map_pages =3D amd_iommu_map_pages, .unmap_pages =3D amd_iommu_unmap_pages, .iotlb_sync_map =3D amd_iommu_iotlb_sync_map, --=20 2.34.1 From nobody Fri Sep 19 05:39:42 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 A75E6C4321E for ; Mon, 28 Nov 2022 06:55:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229801AbiK1Gy7 (ORCPT ); Mon, 28 Nov 2022 01:54:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49982 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229912AbiK1Gyj (ORCPT ); Mon, 28 Nov 2022 01:54:39 -0500 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5DC8B15719 for ; Sun, 27 Nov 2022 22:54:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1669618472; x=1701154472; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=8akeC95ae32s8n7uxnpCOPX3I9yHcltUgN/OgADfsrI=; b=a8byyQAEmXHjJ9tgVskw9KY+Ykw90CHgaVOZyWrtQPo1apF4qhqGfdaF 6lxvTzrBdZ1NDqUqavPOGLBpVvpiYOSAVGbQMZedYNx0epIDWNKHKHvJG LRKGYfZ8oESizSDZTedCXNCBEiWMF92kWxqkdx2XKQjGQpjZTTKp/gIWb iI3mLL6D63AmRupflVGmG5RhyQ2WuFup6ewjVyqxjrDeC0HDDggkKDF0T Oi1zhYCgOl2hgwpjId7wLfzypDRx2NBIHYHfHLBZ2u5KGKXK90zOcIefE SQB46r5M1XTgPdzXRvC3lKGMm09ZRYU/0yXSMoKrEZbhoFiQTu1r15Fx/ w==; X-IronPort-AV: E=McAfee;i="6500,9779,10544"; a="379016058" X-IronPort-AV: E=Sophos;i="5.96,199,1665471600"; d="scan'208";a="379016058" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Nov 2022 22:54:20 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10544"; a="674120721" X-IronPort-AV: E=Sophos;i="5.96,199,1665471600"; d="scan'208";a="674120721" Received: from allen-box.sh.intel.com ([10.239.159.48]) by orsmga008.jf.intel.com with ESMTP; 27 Nov 2022 22:54:13 -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 v3 02/20] iommu/apple-dart: Remove detach_dev callback Date: Mon, 28 Nov 2022 14:46:30 +0800 Message-Id: <20221128064648.1934720-3-baolu.lu@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221128064648.1934720-1-baolu.lu@linux.intel.com> References: <20221128064648.1934720-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" The IOMMU driver supports default domain, so the detach_dev op will never be called. Remove it to avoid dead code. Signed-off-by: Lu Baolu Reviewed-by: Jason Gunthorpe Reviewed-by: Sven Peter --- drivers/iommu/apple-dart.c | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/drivers/iommu/apple-dart.c b/drivers/iommu/apple-dart.c index 4f4a323be0d0..6fbe6b275c79 100644 --- a/drivers/iommu/apple-dart.c +++ b/drivers/iommu/apple-dart.c @@ -535,22 +535,6 @@ static int apple_dart_attach_dev(struct iommu_domain *= domain, return ret; } =20 -static void apple_dart_detach_dev(struct iommu_domain *domain, - struct device *dev) -{ - int i; - struct apple_dart_stream_map *stream_map; - struct apple_dart_master_cfg *cfg =3D dev_iommu_priv_get(dev); - struct apple_dart_domain *dart_domain =3D to_dart_domain(domain); - - for_each_stream_map(i, cfg, stream_map) - apple_dart_hw_disable_dma(stream_map); - - if (domain->type =3D=3D IOMMU_DOMAIN_DMA || - domain->type =3D=3D IOMMU_DOMAIN_UNMANAGED) - apple_dart_domain_remove_streams(dart_domain, cfg); -} - static struct iommu_device *apple_dart_probe_device(struct device *dev) { struct apple_dart_master_cfg *cfg =3D dev_iommu_priv_get(dev); @@ -780,7 +764,6 @@ static const struct iommu_ops apple_dart_iommu_ops =3D { .owner =3D THIS_MODULE, .default_domain_ops =3D &(const struct iommu_domain_ops) { .attach_dev =3D apple_dart_attach_dev, - .detach_dev =3D apple_dart_detach_dev, .map_pages =3D apple_dart_map_pages, .unmap_pages =3D apple_dart_unmap_pages, .flush_iotlb_all =3D apple_dart_flush_iotlb_all, --=20 2.34.1 From nobody Fri Sep 19 05:39:42 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 A695EC433FE for ; Mon, 28 Nov 2022 06:54:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229922AbiK1Gym (ORCPT ); Mon, 28 Nov 2022 01:54:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49662 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229937AbiK1Gyd (ORCPT ); Mon, 28 Nov 2022 01:54:33 -0500 Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9AF9F140F2 for ; Sun, 27 Nov 2022 22:54:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1669618468; x=1701154468; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=vVcsLAcU1x+PF9hn6JDVgVNAyf43Jf3te2XqSzSydEI=; b=akk2e6Cn8+BmPi5qcvivMy9PpVVTSuEo0yg/MzMD+4rCao4yCPopkAEK TQyxnkx+l7IU8rdPDe8rt3ihYkm0Z/5RsJB5ESC0fWT9az4W9mFuHtuP6 kPxa/evAYhGxlHWhOUgLh/m2Ffo7QT/9/jOpqxuQ+nHQmV2rUGtQARW/N lMYrmpHhgQmoPhVkEHnHQFiKH+pT5WKnJCHeTKxp+3WnZjJiFGm78inQu 3VGC9MW9swFiINN8R0/KdXGxAjEa+zPtBHvlViGUa2rzSO/3csHFctF+v dC3m9KGDCDJTzvVHOyApdfrb6KlAFcrv0PrBGRuJgso0fs9DILaOMGtpK A==; X-IronPort-AV: E=McAfee;i="6500,9779,10544"; a="376901409" X-IronPort-AV: E=Sophos;i="5.96,199,1665471600"; d="scan'208";a="376901409" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Nov 2022 22:54:27 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10544"; a="674120767" X-IronPort-AV: E=Sophos;i="5.96,199,1665471600"; d="scan'208";a="674120767" Received: from allen-box.sh.intel.com ([10.239.159.48]) by orsmga008.jf.intel.com with ESMTP; 27 Nov 2022 22:54:21 -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 v3 03/20] iommu/qcom: Remove detach_dev callback Date: Mon, 28 Nov 2022 14:46:31 +0800 Message-Id: <20221128064648.1934720-4-baolu.lu@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221128064648.1934720-1-baolu.lu@linux.intel.com> References: <20221128064648.1934720-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" The IOMMU driver supports default domain, so the detach_dev op will never be called. Remove it to avoid dead code. Signed-off-by: Lu Baolu Reviewed-by: Jason Gunthorpe --- drivers/iommu/arm/arm-smmu/qcom_iommu.c | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/drivers/iommu/arm/arm-smmu/qcom_iommu.c b/drivers/iommu/arm/ar= m-smmu/qcom_iommu.c index 270c3d9128ba..d7be3adee426 100644 --- a/drivers/iommu/arm/arm-smmu/qcom_iommu.c +++ b/drivers/iommu/arm/arm-smmu/qcom_iommu.c @@ -387,28 +387,6 @@ static int qcom_iommu_attach_dev(struct iommu_domain *= domain, struct device *dev return 0; } =20 -static void qcom_iommu_detach_dev(struct iommu_domain *domain, struct devi= ce *dev) -{ - struct qcom_iommu_domain *qcom_domain =3D to_qcom_iommu_domain(domain); - struct iommu_fwspec *fwspec =3D dev_iommu_fwspec_get(dev); - struct qcom_iommu_dev *qcom_iommu =3D to_iommu(dev); - unsigned i; - - if (WARN_ON(!qcom_domain->iommu)) - return; - - pm_runtime_get_sync(qcom_iommu->dev); - for (i =3D 0; i < fwspec->num_ids; i++) { - struct qcom_iommu_ctx *ctx =3D to_ctx(qcom_domain, fwspec->ids[i]); - - /* Disable the context bank: */ - iommu_writel(ctx, ARM_SMMU_CB_SCTLR, 0); - - ctx->domain =3D NULL; - } - pm_runtime_put_sync(qcom_iommu->dev); -} - static int qcom_iommu_map(struct iommu_domain *domain, unsigned long iova, phys_addr_t paddr, size_t pgsize, size_t pgcount, int prot, gfp_t gfp, size_t *mapped) @@ -583,7 +561,6 @@ static const struct iommu_ops qcom_iommu_ops =3D { .pgsize_bitmap =3D SZ_4K | SZ_64K | SZ_1M | SZ_16M, .default_domain_ops =3D &(const struct iommu_domain_ops) { .attach_dev =3D qcom_iommu_attach_dev, - .detach_dev =3D qcom_iommu_detach_dev, .map_pages =3D qcom_iommu_map, .unmap_pages =3D qcom_iommu_unmap, .flush_iotlb_all =3D qcom_iommu_flush_iotlb_all, --=20 2.34.1 From nobody Fri Sep 19 05:39:42 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 AB4C3C433FE for ; Mon, 28 Nov 2022 06:55:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229901AbiK1GzD (ORCPT ); Mon, 28 Nov 2022 01:55:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50034 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229921AbiK1Gym (ORCPT ); Mon, 28 Nov 2022 01:54:42 -0500 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 075141570D for ; Sun, 27 Nov 2022 22:54:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1669618475; x=1701154475; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=+lnyWGzP426cIHCkMlfBmYCgDIrk0H3K0Lf9o9XVkwk=; b=kPyy88A47wH5jjIh9Fvodkq4vpADhq4qwlpRi/+XF2CrrIARj1ZRRcoc BCUGDfUVf79ZcD6TbHmAEJdH5Zgfruuvh0DsFemMAwD+Q3SQ08/xmcx6a gowL6tzmryDGp70slU2AJnCGc7KT7qcadNufUAl49xVkfRQcZLq0cUJsK mL0FWRHTIEx3gWQhUHksbk7lDJxgYvwrvnRRXqlJkSakOex+KcVO1ciwj FLQiJ8gT7n5DS32lq4g+qYgmN/5IVuztPhf3IDnZCF+96poVUcqi22dfq C+Nvs8YZ6Y/Z/0VQMfRijzLQkAmNxY/CfOoUcwMda/bifiDUiE5cMbvEn Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10544"; a="295145602" X-IronPort-AV: E=Sophos;i="5.96,199,1665471600"; d="scan'208";a="295145602" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Nov 2022 22:54:34 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10544"; a="674120774" X-IronPort-AV: E=Sophos;i="5.96,199,1665471600"; d="scan'208";a="674120774" Received: from allen-box.sh.intel.com ([10.239.159.48]) by orsmga008.jf.intel.com with ESMTP; 27 Nov 2022 22:54:27 -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 v3 04/20] iommu/exynos: Remove detach_dev callback Date: Mon, 28 Nov 2022 14:46:32 +0800 Message-Id: <20221128064648.1934720-5-baolu.lu@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221128064648.1934720-1-baolu.lu@linux.intel.com> References: <20221128064648.1934720-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" The IOMMU driver supports default domain, so the detach_dev op will never be called. Remove it to avoid dead code. Signed-off-by: Lu Baolu Reviewed-by: Jason Gunthorpe --- drivers/iommu/exynos-iommu.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c index b0cde2211987..29ec713e8a21 100644 --- a/drivers/iommu/exynos-iommu.c +++ b/drivers/iommu/exynos-iommu.c @@ -1404,7 +1404,6 @@ static const struct iommu_ops exynos_iommu_ops =3D { .of_xlate =3D exynos_iommu_of_xlate, .default_domain_ops =3D &(const struct iommu_domain_ops) { .attach_dev =3D exynos_iommu_attach_device, - .detach_dev =3D exynos_iommu_detach_device, .map =3D exynos_iommu_map, .unmap =3D exynos_iommu_unmap, .iova_to_phys =3D exynos_iommu_iova_to_phys, --=20 2.34.1 From nobody Fri Sep 19 05:39:42 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 AF767C433FE for ; Mon, 28 Nov 2022 06:55:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229990AbiK1GzH (ORCPT ); Mon, 28 Nov 2022 01:55:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229601AbiK1Gys (ORCPT ); Mon, 28 Nov 2022 01:54:48 -0500 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E40F715738 for ; Sun, 27 Nov 2022 22:54:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1669618481; x=1701154481; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=eIhdB1b3IGDflIBfoIAJvdUglY1B9SKoTD7H5eODBXw=; b=mk4KMxTcGK37OlF9PXvjpWKaUHGQjEzfW+r9hgEeRMoIuMLFSrlRK5sC ZT4isFG14W1DisGUao9G4pqfXjLBxOeXNjH66cHESuX27ukx0uzIF1hwC 0/4dDgAWN6U7bZwY5Qtlr//5A0gugBoVRph7RfOJOpkMap1y0F3Sd5aEQ V5kK+9F9P3RZ8StcUXnNPGjvyx/7Y8LpiHxhPuYfCawTO9F9BECDqcT0e Wka7D035urO2hZ1TtG+5cTbXwRy5Hj/2B88ijconA9IcMpDENDiN0GgPG /D5piwhIGovxWcgZoQTsDoe/1oluyiY42ZMkI5HRBUhAN4uYDLSqrWg1v Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10544"; a="316586787" X-IronPort-AV: E=Sophos;i="5.96,199,1665471600"; d="scan'208";a="316586787" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Nov 2022 22:54:41 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10544"; a="674120787" X-IronPort-AV: E=Sophos;i="5.96,199,1665471600"; d="scan'208";a="674120787" Received: from allen-box.sh.intel.com ([10.239.159.48]) by orsmga008.jf.intel.com with ESMTP; 27 Nov 2022 22:54:34 -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 v3 05/20] iommu/ipmmu: Remove detach_dev callback Date: Mon, 28 Nov 2022 14:46:33 +0800 Message-Id: <20221128064648.1934720-6-baolu.lu@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221128064648.1934720-1-baolu.lu@linux.intel.com> References: <20221128064648.1934720-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" The IOMMU driver supports default domain, so the detach_dev op will never be called. Remove it to avoid dead code. Signed-off-by: Lu Baolu Reviewed-by: Jason Gunthorpe --- drivers/iommu/ipmmu-vmsa.c | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/drivers/iommu/ipmmu-vmsa.c b/drivers/iommu/ipmmu-vmsa.c index a003bd5fc65c..3112822ac7be 100644 --- a/drivers/iommu/ipmmu-vmsa.c +++ b/drivers/iommu/ipmmu-vmsa.c @@ -643,21 +643,6 @@ static int ipmmu_attach_device(struct iommu_domain *io= _domain, return 0; } =20 -static void ipmmu_detach_device(struct iommu_domain *io_domain, - struct device *dev) -{ - struct iommu_fwspec *fwspec =3D dev_iommu_fwspec_get(dev); - struct ipmmu_vmsa_domain *domain =3D to_vmsa_domain(io_domain); - unsigned int i; - - for (i =3D 0; i < fwspec->num_ids; ++i) - ipmmu_utlb_disable(domain, fwspec->ids[i]); - - /* - * TODO: Optimize by disabling the context when no device is attached. - */ -} - static int ipmmu_map(struct iommu_domain *io_domain, unsigned long iova, phys_addr_t paddr, size_t pgsize, size_t pgcount, int prot, gfp_t gfp, size_t *mapped) @@ -876,7 +861,6 @@ static const struct iommu_ops ipmmu_ops =3D { .of_xlate =3D ipmmu_of_xlate, .default_domain_ops =3D &(const struct iommu_domain_ops) { .attach_dev =3D ipmmu_attach_device, - .detach_dev =3D ipmmu_detach_device, .map_pages =3D ipmmu_map, .unmap_pages =3D ipmmu_unmap, .flush_iotlb_all =3D ipmmu_flush_iotlb_all, --=20 2.34.1 From nobody Fri Sep 19 05:39:42 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 B2E51C4321E for ; Mon, 28 Nov 2022 06:55:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229919AbiK1GzR (ORCPT ); Mon, 28 Nov 2022 01:55:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229956AbiK1Gy5 (ORCPT ); Mon, 28 Nov 2022 01:54:57 -0500 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BD3F615812 for ; Sun, 27 Nov 2022 22:54:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1669618488; x=1701154488; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=foe9CYLv4t/yayK/wv2PdURR8PHQrrf3ntMgKPrhGNg=; b=gLeFmrBeTkpXk8YOmIFZC9MJxb8vI7zaZI48wUBR8C0OXgvXALY0ImoI R9zSM7XPMjfld+AVYEuvHCI6z+kHlVvXa2+mRjlOTjUXa/7c7wiXskqhd M6OzRYzL9WDZGr77PvfMWSb0oOez0lse8a7Q1gOHFgpx+LFPCotrKkWPu +lHxwmvxvpA1zjjT4QMvYYmb46xYThuZxfMfXV5ESOKf0JV85a4Ex4fhv fqrFezyGCBDs7ZLzG9qYQwEqMB5YhX/xmt2AZqWtfmVZNyzP/rb8cs/qV 7QBLbdBZZG+f4NlzKc92GFv1lclZGGP3Lrs+Bz4m/i/kDgWWM6VGKhyUc w==; X-IronPort-AV: E=McAfee;i="6500,9779,10544"; a="312395009" X-IronPort-AV: E=Sophos;i="5.96,199,1665471600"; d="scan'208";a="312395009" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Nov 2022 22:54:48 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10544"; a="674120803" X-IronPort-AV: E=Sophos;i="5.96,199,1665471600"; d="scan'208";a="674120803" Received: from allen-box.sh.intel.com ([10.239.159.48]) by orsmga008.jf.intel.com with ESMTP; 27 Nov 2022 22:54:41 -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 v3 06/20] iommu/mtk: Remove detach_dev callback Date: Mon, 28 Nov 2022 14:46:34 +0800 Message-Id: <20221128064648.1934720-7-baolu.lu@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221128064648.1934720-1-baolu.lu@linux.intel.com> References: <20221128064648.1934720-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" The IOMMU driver supports default domain, so the detach_dev op will never be called. Remove it to avoid dead code. Signed-off-by: Lu Baolu --- drivers/iommu/mtk_iommu.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c index 5dc1009a19ed..2022f47529c1 100644 --- a/drivers/iommu/mtk_iommu.c +++ b/drivers/iommu/mtk_iommu.c @@ -713,14 +713,6 @@ static int mtk_iommu_attach_device(struct iommu_domain= *domain, return ret; } =20 -static void mtk_iommu_detach_device(struct iommu_domain *domain, - struct device *dev) -{ - struct mtk_iommu_data *data =3D dev_iommu_priv_get(dev); - - mtk_iommu_config(data, dev, false, 0); -} - static int mtk_iommu_map(struct iommu_domain *domain, unsigned long iova, phys_addr_t paddr, size_t pgsize, size_t pgcount, int prot, gfp_t gfp, size_t *mapped) @@ -949,7 +941,6 @@ static const struct iommu_ops mtk_iommu_ops =3D { .owner =3D THIS_MODULE, .default_domain_ops =3D &(const struct iommu_domain_ops) { .attach_dev =3D mtk_iommu_attach_device, - .detach_dev =3D mtk_iommu_detach_device, .map_pages =3D mtk_iommu_map, .unmap_pages =3D mtk_iommu_unmap, .flush_iotlb_all =3D mtk_iommu_flush_iotlb_all, --=20 2.34.1 From nobody Fri Sep 19 05:39:42 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 4159BC433FE for ; Mon, 28 Nov 2022 06:55:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229731AbiK1GzU (ORCPT ); Mon, 28 Nov 2022 01:55:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50320 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229968AbiK1Gy6 (ORCPT ); Mon, 28 Nov 2022 01:54:58 -0500 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5CD7F15834 for ; Sun, 27 Nov 2022 22:54:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1669618495; x=1701154495; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=uC3pF7hOoVLbt48rw9NtRx8qdAPfr8OWtZGji1zKp8s=; b=AoeB/m0r+ZVUyRfIhIOyfPqfBZtwLfnwLXUp25Y2Yk0Ge/Rc0D0BM9i4 oC4TPwtAzgdgRQtztaBQzcqcaoZtH4zdi9x29/HKmkkqRfR74lu9cKywv U1++ahsRmKZ05I8SD4XqsqCWVK8Pz07R8w0aQ5C84ZGy9de50x2o506k1 QJnvGxu5T5roH6gE/26ms9aMBmwJmyETtMRsR7gTRXZiHhxo2SRR+ufJY cCnsp25lc82E3YhABU7CEiCQjLlCshFKkXqMUYDxkqTikFWIsE2/f+/t4 9daOSWuG3cTS5NQ3mPOhA362E1Y6ZfBwTmUEdG6/2Hyf4Wz4oGUa2EpS5 w==; X-IronPort-AV: E=McAfee;i="6500,9779,10544"; a="312395023" X-IronPort-AV: E=Sophos;i="5.96,199,1665471600"; d="scan'208";a="312395023" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Nov 2022 22:54:55 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10544"; a="674120824" X-IronPort-AV: E=Sophos;i="5.96,199,1665471600"; d="scan'208";a="674120824" Received: from allen-box.sh.intel.com ([10.239.159.48]) by orsmga008.jf.intel.com with ESMTP; 27 Nov 2022 22:54:48 -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 v3 07/20] iommu/rockchip: Remove detach_dev callback Date: Mon, 28 Nov 2022 14:46:35 +0800 Message-Id: <20221128064648.1934720-8-baolu.lu@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221128064648.1934720-1-baolu.lu@linux.intel.com> References: <20221128064648.1934720-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" The IOMMU driver supports default domain, so the detach_dev op will never be called. Remove it to avoid dead code. Signed-off-by: Lu Baolu Reviewed-by: Jason Gunthorpe --- drivers/iommu/rockchip-iommu.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/iommu/rockchip-iommu.c b/drivers/iommu/rockchip-iommu.c index a68eadd64f38..f30db22ea5d7 100644 --- a/drivers/iommu/rockchip-iommu.c +++ b/drivers/iommu/rockchip-iommu.c @@ -1192,7 +1192,6 @@ static const struct iommu_ops rk_iommu_ops =3D { .of_xlate =3D rk_iommu_of_xlate, .default_domain_ops =3D &(const struct iommu_domain_ops) { .attach_dev =3D rk_iommu_attach_device, - .detach_dev =3D rk_iommu_detach_device, .map =3D rk_iommu_map, .unmap =3D rk_iommu_unmap, .iova_to_phys =3D rk_iommu_iova_to_phys, --=20 2.34.1 From nobody Fri Sep 19 05:39:42 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 A232BC4321E for ; Mon, 28 Nov 2022 06:55:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229764AbiK1Gzb (ORCPT ); Mon, 28 Nov 2022 01:55:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49862 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229891AbiK1GzC (ORCPT ); Mon, 28 Nov 2022 01:55:02 -0500 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 789FC14D3A for ; Sun, 27 Nov 2022 22:55:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1669618502; x=1701154502; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=m//sYgF0rdstnqtGp6Wm1Z2gWE/E1AcAWpWObxb6y14=; b=JkAvuSbrURZd+lm2Jo/aWR0HUZQ4Gu+EsKVoEqXHMSsP2ElGXIZ+QV+z qZbHA4y7v1j0WJzpW2cUyRBIgdOOvIunwMA1oLZW+2YDUZO/aNqDW9TXS TqVIDIRKNm5PaqpTtBfuQQH6DcoGRf62W7EE6PYLMr5sZrqhOmVDqTY1p OyV4Yo6QMB32LbVPgH498TlJp3nCwS4bbkRW26oDZqTztZLIkbl/19ztu 2ZFs+wRsSvh9FzghABvEFXzmHa83yKp/2BhsEzE3rs+p02/AXuXBcv887 hDD5LeA8jeiPFl5oHh687M1Q1u+eP5CCOy/z6XrpOynD0gCj1dhxfxpIS Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10544"; a="294462491" X-IronPort-AV: E=Sophos;i="5.96,199,1665471600"; d="scan'208";a="294462491" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Nov 2022 22:55:02 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10544"; a="674120857" X-IronPort-AV: E=Sophos;i="5.96,199,1665471600"; d="scan'208";a="674120857" Received: from allen-box.sh.intel.com ([10.239.159.48]) by orsmga008.jf.intel.com with ESMTP; 27 Nov 2022 22:54:55 -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 v3 08/20] iommu/sprd: Remove detach_dev callback Date: Mon, 28 Nov 2022 14:46:36 +0800 Message-Id: <20221128064648.1934720-9-baolu.lu@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221128064648.1934720-1-baolu.lu@linux.intel.com> References: <20221128064648.1934720-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" The IOMMU driver supports default domain, so the detach_dev op will never be called. Remove it to avoid dead code. Signed-off-by: Lu Baolu Acked-by: Chunyan Zhang Reviewed-by: Jason Gunthorpe --- drivers/iommu/sprd-iommu.c | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/drivers/iommu/sprd-iommu.c b/drivers/iommu/sprd-iommu.c index 219bfa11f7f4..ae94d74b73f4 100644 --- a/drivers/iommu/sprd-iommu.c +++ b/drivers/iommu/sprd-iommu.c @@ -255,21 +255,6 @@ static int sprd_iommu_attach_device(struct iommu_domai= n *domain, return 0; } =20 -static void sprd_iommu_detach_device(struct iommu_domain *domain, - struct device *dev) -{ - struct sprd_iommu_domain *dom =3D to_sprd_domain(domain); - struct sprd_iommu_device *sdev =3D dom->sdev; - size_t pgt_size =3D sprd_iommu_pgt_size(domain); - - if (!sdev) - return; - - dma_free_coherent(sdev->dev, pgt_size, dom->pgt_va, dom->pgt_pa); - sprd_iommu_hw_en(sdev, false); - dom->sdev =3D NULL; -} - static int sprd_iommu_map(struct iommu_domain *domain, unsigned long iova, phys_addr_t paddr, size_t pgsize, size_t pgcount, int prot, gfp_t gfp, size_t *mapped) @@ -414,7 +399,6 @@ static const struct iommu_ops sprd_iommu_ops =3D { .owner =3D THIS_MODULE, .default_domain_ops =3D &(const struct iommu_domain_ops) { .attach_dev =3D sprd_iommu_attach_device, - .detach_dev =3D sprd_iommu_detach_device, .map_pages =3D sprd_iommu_map, .unmap_pages =3D sprd_iommu_unmap, .iotlb_sync_map =3D sprd_iommu_sync_map, --=20 2.34.1 From nobody Fri Sep 19 05:39:42 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 1747CC4321E for ; Mon, 28 Nov 2022 06:55:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229920AbiK1Gzq (ORCPT ); Mon, 28 Nov 2022 01:55:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229961AbiK1GzP (ORCPT ); Mon, 28 Nov 2022 01:55:15 -0500 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2258815A36 for ; Sun, 27 Nov 2022 22:55:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1669618509; x=1701154509; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=zq7NjJNxRgriS5ThoBBkHtRQsns0/Mg1Qwl0eHqflWY=; b=SkHE25DzDpTKBuf7BOCURMmoTYtWzQubSNUSu1shmIuxYSu5i0YVoy0E vE7ovTkxo3Y3UmywfMLXKwDx8IgMlrMr9/G0GA7qZncTF6k9COsiOUqq7 NMMx8rk4nr5hcq11HDJVLv3U7YVbZG7ywwFgpjBwNWYiM9DbU9wNFTiDw Guu3gbxiRCvHptajss4V/PoMQGPB+EYYMth1kXhKov/FbGjIUnv2guhEd r+7fHN49FDsQ9Xoig8qlxwy5w/Mpu/M98QXHjOWe/8knwyyhHOm4/8Smx wurJe0qbOMmwTyv+65Z/ppDduA1B8gtZBQVa9sr0N6a5jAYeXlweJJdN2 w==; X-IronPort-AV: E=McAfee;i="6500,9779,10544"; a="314796476" X-IronPort-AV: E=Sophos;i="5.96,199,1665471600"; d="scan'208";a="314796476" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Nov 2022 22:55:08 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10544"; a="674120912" X-IronPort-AV: E=Sophos;i="5.96,199,1665471600"; d="scan'208";a="674120912" Received: from allen-box.sh.intel.com ([10.239.159.48]) by orsmga008.jf.intel.com with ESMTP; 27 Nov 2022 22:55:01 -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 v3 09/20] iommu/sun50i: Remove detach_dev callback Date: Mon, 28 Nov 2022 14:46:37 +0800 Message-Id: <20221128064648.1934720-10-baolu.lu@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221128064648.1934720-1-baolu.lu@linux.intel.com> References: <20221128064648.1934720-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" The IOMMU driver supports default domain, so the detach_dev op will never be called. Remove it to avoid dead code. Signed-off-by: Lu Baolu Reviewed-by: Jason Gunthorpe --- drivers/iommu/sun50i-iommu.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/iommu/sun50i-iommu.c b/drivers/iommu/sun50i-iommu.c index 5cb2d44dfb92..37b074be87a5 100644 --- a/drivers/iommu/sun50i-iommu.c +++ b/drivers/iommu/sun50i-iommu.c @@ -835,7 +835,6 @@ static const struct iommu_ops sun50i_iommu_ops =3D { .probe_device =3D sun50i_iommu_probe_device, .default_domain_ops =3D &(const struct iommu_domain_ops) { .attach_dev =3D sun50i_iommu_attach_device, - .detach_dev =3D sun50i_iommu_detach_device, .flush_iotlb_all =3D sun50i_iommu_flush_iotlb_all, .iotlb_sync_map =3D sun50i_iommu_iotlb_sync_map, .iotlb_sync =3D sun50i_iommu_iotlb_sync, --=20 2.34.1 From nobody Fri Sep 19 05:39:42 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 A503AC433FE for ; Mon, 28 Nov 2022 06:56:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229818AbiK1G4J (ORCPT ); Mon, 28 Nov 2022 01:56:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50034 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229999AbiK1Gzo (ORCPT ); Mon, 28 Nov 2022 01:55:44 -0500 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F8471572B for ; Sun, 27 Nov 2022 22:55:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1669618525; x=1701154525; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=PhxHKh8gGEUFxS7QMyT5AZD9ZvqhOGgKls6j0D/stek=; b=eacNunm3Z60WklM5QOyJxZMrGGv24pVRHC9hKgRCR7xWp0Q5M/Xv8oXK 4mI7bpuZm5n0UYd9GbT9Adl2r5XLOA17g2fSc4GMzstx+tAleElhcwEVQ 5bngJM5ueh5AEREQf1yBxlCUfT4fzk7QpYqeS+yezbIU0tUWVXdv1LXjW EcTy+K1pWMnhagekeQpkf0FTNJXsgbrQrhpm5CbKy1SDwvXvS3Bz17Mu6 TGknE/HQdq4HhrVLpMJXaTHE2MswZ67euljt4MzwhgGM5i6JbqOW0UyON XrjuGy2ZgdhuE+SjBAwsAT4cWK7KmjBmKLfCuwbswUmZKKpZR/RcH5Atv g==; X-IronPort-AV: E=McAfee;i="6500,9779,10544"; a="312395062" X-IronPort-AV: E=Sophos;i="5.96,199,1665471600"; d="scan'208";a="312395062" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Nov 2022 22:55:15 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10544"; a="674120967" X-IronPort-AV: E=Sophos;i="5.96,199,1665471600"; d="scan'208";a="674120967" Received: from allen-box.sh.intel.com ([10.239.159.48]) by orsmga008.jf.intel.com with ESMTP; 27 Nov 2022 22:55:08 -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 v3 10/20] iommu: Add set_platform_dma iommu ops Date: Mon, 28 Nov 2022 14:46:38 +0800 Message-Id: <20221128064648.1934720-11-baolu.lu@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221128064648.1934720-1-baolu.lu@linux.intel.com> References: <20221128064648.1934720-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" When VFIO finishes assigning a device to user space and calls iommu_group_release_dma_owner() to return the device to kernel, the IOMMU core will attach the default domain to the device. Unfortunately, some IOMMU drivers don't support default domain, hence in the end, the core calls .detach_dev instead. This adds set_platform_dma iommu ops to make it clear that what it does is returning control back to the platform DMA ops. Suggested-by: Jason Gunthorpe Signed-off-by: Lu Baolu Reviewed-by: Jason Gunthorpe --- include/linux/iommu.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/linux/iommu.h b/include/linux/iommu.h index 68d7d304cdb7..3542461558fa 100644 --- a/include/linux/iommu.h +++ b/include/linux/iommu.h @@ -223,6 +223,9 @@ struct iommu_iotlb_gather { * @release_device: Remove device from iommu driver handling * @probe_finalize: Do final setup work after the device is added to an IO= MMU * group and attached to the groups domain + * @set_platform_dma: Returning control back to the platform DMA ops. Only + * valid for IOMMU drivers which don't support default + * domain. * @device_group: find iommu group for a particular device * @get_resv_regions: Request list of reserved regions for a device * @of_xlate: add OF master IDs to iommu grouping @@ -251,6 +254,7 @@ struct iommu_ops { struct iommu_device *(*probe_device)(struct device *dev); void (*release_device)(struct device *dev); void (*probe_finalize)(struct device *dev); + void (*set_platform_dma)(struct device *dev); struct iommu_group *(*device_group)(struct device *dev); =20 /* Request/Free a list of reserved regions for a device */ --=20 2.34.1 From nobody Fri Sep 19 05:39:42 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 86793C433FE for ; Mon, 28 Nov 2022 06:56:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229959AbiK1G4F (ORCPT ); Mon, 28 Nov 2022 01:56:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50020 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229993AbiK1Gzl (ORCPT ); Mon, 28 Nov 2022 01:55:41 -0500 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0535115FEC for ; Sun, 27 Nov 2022 22:55:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1669618523; x=1701154523; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=AAYy0JUpin+OfoNJn9WkR2B9kCOfW+EhBpCdyTnxdnM=; b=Mhk4SaujCMUmPIM1UELGtIb3lLKqrZIAhUKqQh9DtEOQ1ZcI9uecdJGu u3o/v2bM0AuqLIEDCE1ppVfkmq8hCL2ak0q7B41D3x4nFNSz2RO2HEWb5 S0nQupneAth2FewKABEBr9rqF4+VIlmr+h9Jft/z8mt4dAh41zgnBjMd+ cGwJW0lvl+vCEQGNTDvmYfK7l/OD38rXVpVJi/80NGHfEEpbBos16uW3h o3PpegW/aSr1KJWshmxkNdEHzg32fsJDMllUk36lcQAloSwipfxeX934/ 9pZd+5vl9zo+3nyyXDQrymFugDV0innJIKaFxTvRQc29HAaGEyc+pbrr5 w==; X-IronPort-AV: E=McAfee;i="6500,9779,10544"; a="315916165" X-IronPort-AV: E=Sophos;i="5.96,199,1665471600"; d="scan'208";a="315916165" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Nov 2022 22:55:22 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10544"; a="674121024" X-IronPort-AV: E=Sophos;i="5.96,199,1665471600"; d="scan'208";a="674121024" Received: from allen-box.sh.intel.com ([10.239.159.48]) by orsmga008.jf.intel.com with ESMTP; 27 Nov 2022 22:55:15 -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 v3 11/20] iommu/fsl_pamu: Add set_platform_dma callback Date: Mon, 28 Nov 2022 14:46:39 +0800 Message-Id: <20221128064648.1934720-12-baolu.lu@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221128064648.1934720-1-baolu.lu@linux.intel.com> References: <20221128064648.1934720-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 callback so that the IOMMU core could return the DMA control. Signed-off-by: Lu Baolu --- drivers/iommu/fsl_pamu_domain.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/iommu/fsl_pamu_domain.c b/drivers/iommu/fsl_pamu_domai= n.c index 4408ac3c49b6..b8c716e7c424 100644 --- a/drivers/iommu/fsl_pamu_domain.c +++ b/drivers/iommu/fsl_pamu_domain.c @@ -314,6 +314,14 @@ static void fsl_pamu_detach_device(struct iommu_domain= *domain, pr_debug("missing fsl,liodn property at %pOF\n", dev->of_node); } =20 +static void fsl_pamu_set_platform_dma(struct device *dev) +{ + struct iommu_domain *domain =3D iommu_get_domain_for_dev(dev); + + if (domain) + fsl_pamu_detach_device(domain, dev); +} + /* Set the domain stash attribute */ int fsl_pamu_configure_l1_stash(struct iommu_domain *domain, u32 cpu) { @@ -452,6 +460,7 @@ static const struct iommu_ops fsl_pamu_ops =3D { .domain_alloc =3D fsl_pamu_domain_alloc, .probe_device =3D fsl_pamu_probe_device, .device_group =3D fsl_pamu_device_group, + .set_platform_dma =3D fsl_pamu_set_platform_dma; .default_domain_ops =3D &(const struct iommu_domain_ops) { .attach_dev =3D fsl_pamu_attach_device, .detach_dev =3D fsl_pamu_detach_device, --=20 2.34.1 From nobody Fri Sep 19 05:39:42 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 0615AC4321E for ; Mon, 28 Nov 2022 06:56:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229677AbiK1G4X (ORCPT ); Mon, 28 Nov 2022 01:56:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50656 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229936AbiK1Gzz (ORCPT ); Mon, 28 Nov 2022 01:55:55 -0500 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B59371582A for ; Sun, 27 Nov 2022 22:55:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1669618530; x=1701154530; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=9D0XyFvFSOhAEwulu1xI29MelRcePwGMxUZNH4H/TSo=; b=Oz8jptwmIbbvJV2LEPfVub3KC6DSc9pRXanF7etE2MzGOsrZXhhIvzvM d2D1xxFforpFLbzY6z7RH7i2k2TA1ivaCFmpsQXMQgJMNNL357ZFSUSaM /Dy+oWHILmSk3xTYWX2JvgKxblsO+9/k39OGTlXJ5ashlIiAcBrEn8nw2 Nt9Iy++DZPtef+u1N4mxwioijmvwpdSXeAcJXX321PvZjyKGc+co11XD1 ZBC+vD10VKCkxzJAdcE1xePd/SDFXc99VCu/ReLUymbTF8IEvGgGqrQav 7c11GdRroLgGF3zFwmXYBcy5iEw46WbTv0nEtkPkaWtuqrgWw0be6vL2O A==; X-IronPort-AV: E=McAfee;i="6500,9779,10544"; a="379016263" X-IronPort-AV: E=Sophos;i="5.96,199,1665471600"; d="scan'208";a="379016263" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Nov 2022 22:55:30 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10544"; a="674121106" X-IronPort-AV: E=Sophos;i="5.96,199,1665471600"; d="scan'208";a="674121106" Received: from allen-box.sh.intel.com ([10.239.159.48]) by orsmga008.jf.intel.com with ESMTP; 27 Nov 2022 22:55:22 -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 v3 12/20] iommu/msm: Add set_platform_dma callback Date: Mon, 28 Nov 2022 14:46:40 +0800 Message-Id: <20221128064648.1934720-13-baolu.lu@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221128064648.1934720-1-baolu.lu@linux.intel.com> References: <20221128064648.1934720-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 callback so that the IOMMU core could return the DMA control. Signed-off-by: Lu Baolu --- drivers/iommu/msm_iommu.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/iommu/msm_iommu.c b/drivers/iommu/msm_iommu.c index c60624910872..3eb1bc668cad 100644 --- a/drivers/iommu/msm_iommu.c +++ b/drivers/iommu/msm_iommu.c @@ -470,6 +470,14 @@ static void msm_iommu_detach_dev(struct iommu_domain *= domain, spin_unlock_irqrestore(&msm_iommu_lock, flags); } =20 +static void msm_iommu_set_platform_dma(struct device *dev) +{ + struct iommu_domain *domain =3D iommu_get_domain_for_dev(dev); + + if (domain) + msm_iommu_detach_dev(domain, dev); +} + static int msm_iommu_map(struct iommu_domain *domain, unsigned long iova, phys_addr_t pa, size_t pgsize, size_t pgcount, int prot, gfp_t gfp, size_t *mapped) @@ -678,6 +686,7 @@ static struct iommu_ops msm_iommu_ops =3D { .domain_alloc =3D msm_iommu_domain_alloc, .probe_device =3D msm_iommu_probe_device, .device_group =3D generic_device_group, + .set_platform_dma =3D msm_iommu_set_platform_dma, .pgsize_bitmap =3D MSM_IOMMU_PGSIZES, .of_xlate =3D qcom_iommu_of_xlate, .default_domain_ops =3D &(const struct iommu_domain_ops) { --=20 2.34.1 From nobody Fri Sep 19 05:39:42 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 7490EC4321E for ; Mon, 28 Nov 2022 06:56:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229947AbiK1G40 (ORCPT ); Mon, 28 Nov 2022 01:56:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229949AbiK1G4B (ORCPT ); Mon, 28 Nov 2022 01:56:01 -0500 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E49951659C for ; Sun, 27 Nov 2022 22:55:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1669618537; x=1701154537; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=XGpxXhNOa/KRt7xgRHD7urYBt16kQhELiSo10tcOAJE=; b=oGPJ4l8IJ0VY4ixwR5hWtThlX8pxw8l6wxx8ZtyObSKYzS5AnAaelTeM y0h70yguPwqdF7YUNUQ4tZRqm27duFD3UZQB0UmoWO5gaDIisyIEMRwCy vZ5pU7zwLa9X596GviyG9UMG+2QuMEnlaOiREvvRhy7+LgFyPotT+CR3H 30mBWeUcO9dJ64Er9vsRQK9qeRXCdP2QeE3vGtdMb1P8y3KaDcdIy/ABw 5k1FmWwGtO70iTElvFw8bmuMHTXoYI+Tw8zX/NF/d+6ko7YufyXkeSuNj 1nHXVrICxoZqWtxrHRxsokk1xWAjZr7HAmeH1F5wFqN6h2tWde7vpWM56 w==; X-IronPort-AV: E=McAfee;i="6500,9779,10544"; a="315916234" X-IronPort-AV: E=Sophos;i="5.96,199,1665471600"; d="scan'208";a="315916234" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Nov 2022 22:55:37 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10544"; a="674121167" X-IronPort-AV: E=Sophos;i="5.96,199,1665471600"; d="scan'208";a="674121167" Received: from allen-box.sh.intel.com ([10.239.159.48]) by orsmga008.jf.intel.com with ESMTP; 27 Nov 2022 22:55:30 -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 v3 13/20] iommu/mtk_v1: Add set_platform_dma callback Date: Mon, 28 Nov 2022 14:46:41 +0800 Message-Id: <20221128064648.1934720-14-baolu.lu@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221128064648.1934720-1-baolu.lu@linux.intel.com> References: <20221128064648.1934720-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 callback so that the IOMMU core could return the DMA control. Signed-off-by: Lu Baolu --- drivers/iommu/mtk_iommu_v1.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/iommu/mtk_iommu_v1.c b/drivers/iommu/mtk_iommu_v1.c index 69682ee068d2..6a815da8a020 100644 --- a/drivers/iommu/mtk_iommu_v1.c +++ b/drivers/iommu/mtk_iommu_v1.c @@ -326,6 +326,14 @@ static void mtk_iommu_v1_detach_device(struct iommu_do= main *domain, struct devic mtk_iommu_v1_config(data, dev, false); } =20 +static void mtk_iommu_v1_set_platform_dma(struct device *dev) +{ + struct iommu_domain *domain =3D iommu_get_domain_for_dev(dev); + + if (domain) + mtk_iommu_v1_detach_device(domain, dev); +} + static int mtk_iommu_v1_map(struct iommu_domain *domain, unsigned long iov= a, phys_addr_t paddr, size_t pgsize, size_t pgcount, int prot, gfp_t gfp, size_t *mapped) @@ -585,6 +593,7 @@ static const struct iommu_ops mtk_iommu_v1_ops =3D { .def_domain_type =3D mtk_iommu_v1_def_domain_type, .device_group =3D generic_device_group, .pgsize_bitmap =3D MT2701_IOMMU_PAGE_SIZE, + .set_platform_dma =3D mtk_iommu_v1_set_platform_dma, .owner =3D THIS_MODULE, .default_domain_ops =3D &(const struct iommu_domain_ops) { .attach_dev =3D mtk_iommu_v1_attach_device, --=20 2.34.1 From nobody Fri Sep 19 05:39:42 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 42B05C4321E for ; Mon, 28 Nov 2022 06:56:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230021AbiK1G4k (ORCPT ); Mon, 28 Nov 2022 01:56:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230022AbiK1G4G (ORCPT ); Mon, 28 Nov 2022 01:56:06 -0500 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED01A15A19 for ; Sun, 27 Nov 2022 22:55:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1669618544; x=1701154544; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Ff31laKxSfpGr9mFdQQubwFooU0bdzqdYVYXB0kO0dk=; b=nO6mryGu2cs6NBNmObkLlUl31LjuaLmQEESaAsMBsdXyDKmPtwuqnnjA 48FeEiOYnCam1awlxa/Nc3mtSBlNVZY3O5Ju1suiVz7kI//Z7vBh/dkUj LAE2PrRJaEq2rxHBkKuGLCj8dzVQzbGEufi6qnCRMQAc2GYlPO9Xr8aaX nivJ0Iwuvfoq/pZaoT3D7j4AjAejJFaKOOivkdWdH4mMx5HCu5yLzfFha 7Y3QjBm9MZYqXxqV9nCkCXoCu+5upBfnPwLRSrZOTwH6ISbLOnKqArhi9 wUu8VDO+5ZSIeAVwqtMlhCFnyrqDorZy+aNe8VdmLAprSiR14vK17kYgm w==; X-IronPort-AV: E=McAfee;i="6500,9779,10544"; a="294462601" X-IronPort-AV: E=Sophos;i="5.96,199,1665471600"; d="scan'208";a="294462601" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Nov 2022 22:55:44 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10544"; a="674121224" X-IronPort-AV: E=Sophos;i="5.96,199,1665471600"; d="scan'208";a="674121224" Received: from allen-box.sh.intel.com ([10.239.159.48]) by orsmga008.jf.intel.com with ESMTP; 27 Nov 2022 22:55:37 -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 v3 14/20] iommu/omap: Add set_platform_dma callback Date: Mon, 28 Nov 2022 14:46:42 +0800 Message-Id: <20221128064648.1934720-15-baolu.lu@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221128064648.1934720-1-baolu.lu@linux.intel.com> References: <20221128064648.1934720-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 callback so that the IOMMU core could return the DMA control. Signed-off-by: Lu Baolu --- drivers/iommu/omap-iommu.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/iommu/omap-iommu.c b/drivers/iommu/omap-iommu.c index 2fd7702c6709..aa3858a48bbf 100644 --- a/drivers/iommu/omap-iommu.c +++ b/drivers/iommu/omap-iommu.c @@ -1566,6 +1566,14 @@ static void omap_iommu_detach_dev(struct iommu_domai= n *domain, spin_unlock(&omap_domain->lock); } =20 +static void omap_iommu_set_platform_dma(struct device *dev) +{ + struct iommu_domain *domain =3D iommu_get_domain_for_dev(dev); + + if (domain) + omap_iommu_detach_dev(domain, dev); +} + static struct iommu_domain *omap_iommu_domain_alloc(unsigned type) { struct omap_iommu_domain *omap_domain; @@ -1737,6 +1745,7 @@ static const struct iommu_ops omap_iommu_ops =3D { .probe_device =3D omap_iommu_probe_device, .release_device =3D omap_iommu_release_device, .device_group =3D omap_iommu_device_group, + .set_platform_dma =3D omap_iommu_set_platform_dma, .pgsize_bitmap =3D OMAP_IOMMU_PGSIZES, .default_domain_ops =3D &(const struct iommu_domain_ops) { .attach_dev =3D omap_iommu_attach_dev, --=20 2.34.1 From nobody Fri Sep 19 05:39:42 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 CD155C4321E for ; Mon, 28 Nov 2022 06:56:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229969AbiK1G4r (ORCPT ); Mon, 28 Nov 2022 01:56:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229965AbiK1G4G (ORCPT ); Mon, 28 Nov 2022 01:56:06 -0500 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C213815A24 for ; Sun, 27 Nov 2022 22:55:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1669618551; x=1701154551; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Ol98imkt/vwMTgfO5T+HiqA4V5Kbbou7eJPlJ+Hm468=; b=Dhy1gCw8prjGRJ01TcrFi5Hf0en3tS6ITPzY2SfsBU0n187tozSwNOqv DdPkdmbcMBkPr2XbJBkBgv0L7Ruv5VeCMgk+gSlEeKgdIygm2GtNWoGc4 iItu0Uf9iAUUCNN+Vqfc12mTl3H9+c8Uu4QoRzAJDE/2mldcEp1uLa5ci HrzhrcjGqXwu1nteMdb4+HMkjq2rL59j6WGDjCEiHKOtqnt90hKOmVC03 QnUAaYlvaZO9jsu7K/33zRZvUmxOVNvk3Xjv8EW1E8gTwf7PKt/X1Hmt+ wge0QnX/6vBSRKF4sfGFm4O0ZFN/eoouB3xM1F86khYFgLkpeomuJq7k5 Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10544"; a="401050448" X-IronPort-AV: E=Sophos;i="5.96,199,1665471600"; d="scan'208";a="401050448" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Nov 2022 22:55:51 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10544"; a="674121238" X-IronPort-AV: E=Sophos;i="5.96,199,1665471600"; d="scan'208";a="674121238" Received: from allen-box.sh.intel.com ([10.239.159.48]) by orsmga008.jf.intel.com with ESMTP; 27 Nov 2022 22:55:44 -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 v3 15/20] iommu/s390: Add set_platform_dma callback Date: Mon, 28 Nov 2022 14:46:43 +0800 Message-Id: <20221128064648.1934720-16-baolu.lu@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221128064648.1934720-1-baolu.lu@linux.intel.com> References: <20221128064648.1934720-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 callback so that the IOMMU core could return the DMA control. Signed-off-by: Lu Baolu --- drivers/iommu/s390-iommu.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/iommu/s390-iommu.c b/drivers/iommu/s390-iommu.c index ed33c6cce083..507bbc2c9b58 100644 --- a/drivers/iommu/s390-iommu.c +++ b/drivers/iommu/s390-iommu.c @@ -179,6 +179,14 @@ static void s390_iommu_get_resv_regions(struct device = *dev, } } =20 +static void s390_iommu_set_platform_dma(struct device *dev) +{ + struct iommu_domain *domain =3D iommu_get_domain_for_dev(dev); + + if (domain) + s390_iommu_detach_device(domain, dev); +} + static struct iommu_device *s390_iommu_probe_device(struct device *dev) { struct zpci_dev *zdev; @@ -435,6 +443,7 @@ static const struct iommu_ops s390_iommu_ops =3D { .probe_device =3D s390_iommu_probe_device, .release_device =3D s390_iommu_release_device, .device_group =3D generic_device_group, + .set_platform_dma =3D s390_iommu_set_platform_dma, .pgsize_bitmap =3D SZ_4K, .get_resv_regions =3D s390_iommu_get_resv_regions, .default_domain_ops =3D &(const struct iommu_domain_ops) { --=20 2.34.1 From nobody Fri Sep 19 05:39:42 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 9BD41C4321E for ; Mon, 28 Nov 2022 06:56:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230040AbiK1G4x (ORCPT ); Mon, 28 Nov 2022 01:56:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50420 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229966AbiK1G4L (ORCPT ); Mon, 28 Nov 2022 01:56:11 -0500 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 687F114D0E for ; Sun, 27 Nov 2022 22:55:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1669618558; x=1701154558; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=r5xbh896pHOm4nF0J2WHqkUdwYnD0sIQJbuduyaVUB4=; b=MQvKTmw4fi1bVD4F0Llp7FCeAuuyMKDHlH6zbPIssTfPjNgCvsbiHb5q +468s1Wly9RIstmGULcNN0Ta9XFsdD8S9ZVUTQPu0eisJRYrHFhUK2MgR wSDOqwT7XqzF/K9C970FyEzveGoH67Wsch9ayqF3tu+RwOoRcIWWcuHUt MAMoVWeFMYskCv8ueJSddEx8cd0HvvEmT95x4/tjFSHl8t3TZcCd+7KT2 3NfckKSb5pseNQsLeHw4P5QPQWDyMXIQf2M7Jwak9EKKedFt5ZOYkIq8E wG039RIf4JZNvA4+Uk3OhlJmxHeYrb645BofIb4deYNwxII1pOzAokTH6 A==; X-IronPort-AV: E=McAfee;i="6500,9779,10544"; a="294462659" X-IronPort-AV: E=Sophos;i="5.96,199,1665471600"; d="scan'208";a="294462659" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Nov 2022 22:55:58 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10544"; a="674121259" X-IronPort-AV: E=Sophos;i="5.96,199,1665471600"; d="scan'208";a="674121259" Received: from allen-box.sh.intel.com ([10.239.159.48]) by orsmga008.jf.intel.com with ESMTP; 27 Nov 2022 22:55:51 -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 v3 16/20] iommu/gart: Add set_platform_dma callback Date: Mon, 28 Nov 2022 14:46:44 +0800 Message-Id: <20221128064648.1934720-17-baolu.lu@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221128064648.1934720-1-baolu.lu@linux.intel.com> References: <20221128064648.1934720-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 callback so that the IOMMU core could return the DMA control. Signed-off-by: Lu Baolu --- drivers/iommu/tegra-gart.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/iommu/tegra-gart.c b/drivers/iommu/tegra-gart.c index ed53279d1106..f56e40b5c47a 100644 --- a/drivers/iommu/tegra-gart.c +++ b/drivers/iommu/tegra-gart.c @@ -141,6 +141,14 @@ static void gart_iommu_detach_dev(struct iommu_domain = *domain, spin_unlock(&gart->dom_lock); } =20 +static void gart_iommu_set_platform_dma(struct device *dev) +{ + struct iommu_domain *domain =3D iommu_get_domain_for_dev(dev); + + if (domain) + gart_iommu_detach_dev(domain, dev); +} + static struct iommu_domain *gart_iommu_domain_alloc(unsigned type) { struct iommu_domain *domain; @@ -270,6 +278,7 @@ static const struct iommu_ops gart_iommu_ops =3D { .domain_alloc =3D gart_iommu_domain_alloc, .probe_device =3D gart_iommu_probe_device, .device_group =3D generic_device_group, + .set_platform_dma =3D gart_iommu_set_platform_dma, .pgsize_bitmap =3D GART_IOMMU_PGSIZES, .of_xlate =3D gart_iommu_of_xlate, .default_domain_ops =3D &(const struct iommu_domain_ops) { --=20 2.34.1 From nobody Fri Sep 19 05:39:42 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 CA5EEC433FE for ; Mon, 28 Nov 2022 06:56:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229631AbiK1G45 (ORCPT ); Mon, 28 Nov 2022 01:56:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50580 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229902AbiK1G4Q (ORCPT ); Mon, 28 Nov 2022 01:56:16 -0500 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EAECE1572B for ; Sun, 27 Nov 2022 22:56:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1669618565; x=1701154565; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=2uZWB31+7BHbXDhpDwxdAHkoChULgPE00ii//Ntnb2A=; b=FWuIz94duB0Lv0Hi9yCaWVq/VwoJQxjJ7YSUzk7x48eLgTAMkKANyaGu ApCKC9kdHbMyJ3SyS95qnxlijeIQN02CziESzPggKtOFlsCmkC4Ej2XLX KpXRBo3jLae5nKzYhci7PDB3elz0T4ikbq3oiAtu4nAiWHHfO476Ck1QP MD9Fc8hyLl/5jfvESixVVJHlv2an/SO7NT+9NjZe/nQz/TJNoWJGRsDYd +fFKIzzTtzBWnGkW5pNAnek86Rn9iVGsCSXPvfli/e5tDAgELlHgcIJ5b 1/9bVwc/CnCVODDL7f4qoD0L5h1q+8vReZpvhGsI/9c7cvMlOJL8+AX2Z A==; X-IronPort-AV: E=McAfee;i="6500,9779,10544"; a="312395267" X-IronPort-AV: E=Sophos;i="5.96,199,1665471600"; d="scan'208";a="312395267" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Nov 2022 22:56:05 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10544"; a="674121278" X-IronPort-AV: E=Sophos;i="5.96,199,1665471600"; d="scan'208";a="674121278" Received: from allen-box.sh.intel.com ([10.239.159.48]) by orsmga008.jf.intel.com with ESMTP; 27 Nov 2022 22:55:58 -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 v3 17/20] iommu/tegra: Add set_platform_dma callback Date: Mon, 28 Nov 2022 14:46:45 +0800 Message-Id: <20221128064648.1934720-18-baolu.lu@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221128064648.1934720-1-baolu.lu@linux.intel.com> References: <20221128064648.1934720-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 callback so that the IOMMU core could return the DMA control. Signed-off-by: Lu Baolu --- drivers/iommu/tegra-smmu.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/iommu/tegra-smmu.c b/drivers/iommu/tegra-smmu.c index 5b1af40221ec..a36e163e5cc1 100644 --- a/drivers/iommu/tegra-smmu.c +++ b/drivers/iommu/tegra-smmu.c @@ -527,6 +527,14 @@ static void tegra_smmu_detach_dev(struct iommu_domain = *domain, struct device *de } } =20 +static void tegra_smmu_set_platform_dma(struct device *dev) +{ + struct iommu_domain *domain =3D iommu_get_domain_for_dev(dev); + + if (domain) + tegra_smmu_detach_dev(domain, dev); +} + static void tegra_smmu_set_pde(struct tegra_smmu_as *as, unsigned long iov= a, u32 value) { @@ -965,6 +973,7 @@ 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 =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) { --=20 2.34.1 From nobody Fri Sep 19 05:39:42 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 6B2F0C4321E for ; Mon, 28 Nov 2022 06:57:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229895AbiK1G5E (ORCPT ); Mon, 28 Nov 2022 01:57:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50714 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229934AbiK1G4U (ORCPT ); Mon, 28 Nov 2022 01:56:20 -0500 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C202B15826 for ; Sun, 27 Nov 2022 22:56:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1669618577; x=1701154577; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=2u7/GIfAe0DIonm/0hJIJlmbZhf+CBwAyKoVx4wlxOs=; b=bZDvXmg33vtWikJdBBjf8FS/AKg5ydS+avyP9b74slaqHwNHfGqyLSjA 0ZAN5mtyoGWT/T868EM1b26pgRDIA4+x+hX8T5eyhae53gVsW/J4Kmh6L 21p6y+eRxiPnMtyFlF2op1VCh8vtuJb8w6aHkYJWmdoIiDmcu0WeR9aw2 nZbzFaPULH8MMjoOhNuCXdsKRMFmnRAY4z0RIlBaWFxvOtLNfn6+3rdQL 8i26w0GHpaIKyGe7Knr92WnGjRtV5ZCwAGe1649NCGcaXc4Uo7yI+iokX RQACHuwiJN3+kAMrvysnqay0hOC+FtrSynvXs/7Sf9ziV+a/kSCL5qQWy Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10544"; a="379016449" X-IronPort-AV: E=Sophos;i="5.96,199,1665471600"; d="scan'208";a="379016449" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Nov 2022 22:56:12 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10544"; a="674121303" X-IronPort-AV: E=Sophos;i="5.96,199,1665471600"; d="scan'208";a="674121303" Received: from allen-box.sh.intel.com ([10.239.159.48]) by orsmga008.jf.intel.com with ESMTP; 27 Nov 2022 22:56:05 -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 v3 18/20] iommu: Call set_platform_dma if default domain is unavailable Date: Mon, 28 Nov 2022 14:46:46 +0800 Message-Id: <20221128064648.1934720-19-baolu.lu@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221128064648.1934720-1-baolu.lu@linux.intel.com> References: <20221128064648.1934720-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" If the IOMMU driver has no default domain support, call set_platform_dma explicitly to return the kernel DMA control back to the platform DMA ops. Signed-off-by: Lu Baolu --- drivers/iommu/iommu.c | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-) diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index 7c99d8eb3182..e4966f088184 100644 --- a/drivers/iommu/iommu.c +++ b/drivers/iommu/iommu.c @@ -2040,16 +2040,6 @@ int iommu_deferred_attach(struct device *dev, struct= iommu_domain *domain) return 0; } =20 -static void __iommu_detach_device(struct iommu_domain *domain, - struct device *dev) -{ - if (iommu_is_attach_deferred(dev)) - return; - - domain->ops->detach_dev(domain, dev); - trace_detach_device_from_domain(dev); -} - void iommu_detach_device(struct iommu_domain *domain, struct device *dev) { struct iommu_group *group; @@ -2154,11 +2144,12 @@ int iommu_attach_group(struct iommu_domain *domain,= struct iommu_group *group) } EXPORT_SYMBOL_GPL(iommu_attach_group); =20 -static int iommu_group_do_detach_device(struct device *dev, void *data) +static int iommu_group_do_set_platform_dma(struct device *dev, void *data) { - struct iommu_domain *domain =3D data; + const struct iommu_ops *ops =3D dev_iommu_ops(dev); =20 - __iommu_detach_device(domain, dev); + if (!WARN_ON(!ops->set_platform_dma)) + ops->set_platform_dma(dev); =20 return 0; } @@ -2172,15 +2163,12 @@ static int __iommu_group_set_domain(struct iommu_gr= oup *group, return 0; =20 /* - * New drivers should support default domains and so the detach_dev() op - * will never be called. Otherwise the NULL domain represents some - * platform specific behavior. + * New drivers should support default domains. Otherwise the NULL + * domain represents returning control back to the platform DMA. */ if (!new_domain) { - if (WARN_ON(!group->domain->ops->detach_dev)) - return -EINVAL; - __iommu_group_for_each_dev(group, group->domain, - iommu_group_do_detach_device); + __iommu_group_for_each_dev(group, NULL, + iommu_group_do_set_platform_dma); group->domain =3D NULL; return 0; } --=20 2.34.1 From nobody Fri Sep 19 05:39:42 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 F2D0AC433FE for ; Mon, 28 Nov 2022 06:57:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229775AbiK1G5A (ORCPT ); Mon, 28 Nov 2022 01:57:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229791AbiK1G4W (ORCPT ); Mon, 28 Nov 2022 01:56:22 -0500 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B9AC214D3F for ; Sun, 27 Nov 2022 22:56:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1669618580; x=1701154580; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=gUstT2MwrHgpmVm8ozwibpzvZnHb5hlxoDudunwPD3E=; b=HTpz60m8rlzWUVmqlblS+YZM5Owt4SyRuQGZpUU0wgHUb/EcQa0zx04A 6k4neojNOq1mezpmhiv4Q+OQWmjR/BoBovEBIFzERiwUT64Ljw5RlUe31 wfmUDyWv5A8YEfN0h/xxgETazv7/VdPyJVYBp3rMgVARuC3A6nX3ijxYj +Pt+iO2gAY4FHi9SePvX7YFRPlMeyyowaWbJHFtFgr7KhoHXvEtgHHmVn p2Y8DPmaKBU1jgc8/T1pR5sB6g96NWxk9TJUYtkul9PFOKc30Ur26jaRA DPMiRQkXmnC1arNHrzJbuN5jPh9FgF/uPolK39UQKr7vtrrLqOxFUodMn g==; X-IronPort-AV: E=McAfee;i="6500,9779,10544"; a="313459237" X-IronPort-AV: E=Sophos;i="5.96,199,1665471600"; d="scan'208";a="313459237" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Nov 2022 22:56:20 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10544"; a="674121339" X-IronPort-AV: E=Sophos;i="5.96,199,1665471600"; d="scan'208";a="674121339" Received: from allen-box.sh.intel.com ([10.239.159.48]) by orsmga008.jf.intel.com with ESMTP; 27 Nov 2022 22:56:12 -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 v3 19/20] iommu: Retire detach_dev callback Date: Mon, 28 Nov 2022 14:46:47 +0800 Message-Id: <20221128064648.1934720-20-baolu.lu@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221128064648.1934720-1-baolu.lu@linux.intel.com> References: <20221128064648.1934720-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" The detach_dev callback of domain ops is not used in the IOMMU core. Remove this callback to avoid dead code. Signed-off-by: Lu Baolu --- include/linux/iommu.h | 2 -- drivers/iommu/fsl_pamu_domain.c | 1 - drivers/iommu/msm_iommu.c | 1 - drivers/iommu/mtk_iommu_v1.c | 1 - drivers/iommu/omap-iommu.c | 1 - drivers/iommu/s390-iommu.c | 1 - drivers/iommu/tegra-gart.c | 1 - drivers/iommu/tegra-smmu.c | 1 - 8 files changed, 9 deletions(-) diff --git a/include/linux/iommu.h b/include/linux/iommu.h index 3542461558fa..4c0491e5708c 100644 --- a/include/linux/iommu.h +++ b/include/linux/iommu.h @@ -294,7 +294,6 @@ struct iommu_ops { * * EBUSY - device is attached to a domain and cannot be changed * * ENODEV - device specific errors, not able to be attached * * - treated as ENODEV by the caller. Use is discouraged - * @detach_dev: detach an iommu domain from a device * @set_dev_pasid: set an iommu domain to a pasid of device * @map: map a physically contiguous memory region to an iommu domain * @map_pages: map a physically contiguous set of pages of the same size to @@ -315,7 +314,6 @@ struct iommu_ops { */ struct iommu_domain_ops { int (*attach_dev)(struct iommu_domain *domain, struct device *dev); - void (*detach_dev)(struct iommu_domain *domain, struct device *dev); int (*set_dev_pasid)(struct iommu_domain *domain, struct device *dev, ioasid_t pasid); =20 diff --git a/drivers/iommu/fsl_pamu_domain.c b/drivers/iommu/fsl_pamu_domai= n.c index b8c716e7c424..272d88e415c6 100644 --- a/drivers/iommu/fsl_pamu_domain.c +++ b/drivers/iommu/fsl_pamu_domain.c @@ -463,7 +463,6 @@ static const struct iommu_ops fsl_pamu_ops =3D { .set_platform_dma =3D fsl_pamu_set_platform_dma; .default_domain_ops =3D &(const struct iommu_domain_ops) { .attach_dev =3D fsl_pamu_attach_device, - .detach_dev =3D fsl_pamu_detach_device, .iova_to_phys =3D fsl_pamu_iova_to_phys, .free =3D fsl_pamu_domain_free, } diff --git a/drivers/iommu/msm_iommu.c b/drivers/iommu/msm_iommu.c index 3eb1bc668cad..564f9dc0140d 100644 --- a/drivers/iommu/msm_iommu.c +++ b/drivers/iommu/msm_iommu.c @@ -691,7 +691,6 @@ static struct iommu_ops msm_iommu_ops =3D { .of_xlate =3D qcom_iommu_of_xlate, .default_domain_ops =3D &(const struct iommu_domain_ops) { .attach_dev =3D msm_iommu_attach_dev, - .detach_dev =3D msm_iommu_detach_dev, .map_pages =3D msm_iommu_map, .unmap_pages =3D msm_iommu_unmap, /* diff --git a/drivers/iommu/mtk_iommu_v1.c b/drivers/iommu/mtk_iommu_v1.c index 6a815da8a020..c2d80b7a377f 100644 --- a/drivers/iommu/mtk_iommu_v1.c +++ b/drivers/iommu/mtk_iommu_v1.c @@ -597,7 +597,6 @@ static const struct iommu_ops mtk_iommu_v1_ops =3D { .owner =3D THIS_MODULE, .default_domain_ops =3D &(const struct iommu_domain_ops) { .attach_dev =3D mtk_iommu_v1_attach_device, - .detach_dev =3D mtk_iommu_v1_detach_device, .map_pages =3D mtk_iommu_v1_map, .unmap_pages =3D mtk_iommu_v1_unmap, .iova_to_phys =3D mtk_iommu_v1_iova_to_phys, diff --git a/drivers/iommu/omap-iommu.c b/drivers/iommu/omap-iommu.c index aa3858a48bbf..c3eedab00038 100644 --- a/drivers/iommu/omap-iommu.c +++ b/drivers/iommu/omap-iommu.c @@ -1749,7 +1749,6 @@ static const struct iommu_ops omap_iommu_ops =3D { .pgsize_bitmap =3D OMAP_IOMMU_PGSIZES, .default_domain_ops =3D &(const struct iommu_domain_ops) { .attach_dev =3D omap_iommu_attach_dev, - .detach_dev =3D omap_iommu_detach_dev, .map =3D omap_iommu_map, .unmap =3D omap_iommu_unmap, .iova_to_phys =3D omap_iommu_iova_to_phys, diff --git a/drivers/iommu/s390-iommu.c b/drivers/iommu/s390-iommu.c index 507bbc2c9b58..33dba5ee5e20 100644 --- a/drivers/iommu/s390-iommu.c +++ b/drivers/iommu/s390-iommu.c @@ -448,7 +448,6 @@ static const struct iommu_ops s390_iommu_ops =3D { .get_resv_regions =3D s390_iommu_get_resv_regions, .default_domain_ops =3D &(const struct iommu_domain_ops) { .attach_dev =3D s390_iommu_attach_device, - .detach_dev =3D s390_iommu_detach_device, .map_pages =3D s390_iommu_map_pages, .unmap_pages =3D s390_iommu_unmap_pages, .flush_iotlb_all =3D s390_iommu_flush_iotlb_all, diff --git a/drivers/iommu/tegra-gart.c b/drivers/iommu/tegra-gart.c index f56e40b5c47a..a532b333233f 100644 --- a/drivers/iommu/tegra-gart.c +++ b/drivers/iommu/tegra-gart.c @@ -283,7 +283,6 @@ static const struct iommu_ops gart_iommu_ops =3D { .of_xlate =3D gart_iommu_of_xlate, .default_domain_ops =3D &(const struct iommu_domain_ops) { .attach_dev =3D gart_iommu_attach_dev, - .detach_dev =3D gart_iommu_detach_dev, .map =3D gart_iommu_map, .unmap =3D gart_iommu_unmap, .iova_to_phys =3D gart_iommu_iova_to_phys, diff --git a/drivers/iommu/tegra-smmu.c b/drivers/iommu/tegra-smmu.c index a36e163e5cc1..247d485904c1 100644 --- a/drivers/iommu/tegra-smmu.c +++ b/drivers/iommu/tegra-smmu.c @@ -978,7 +978,6 @@ static const struct iommu_ops tegra_smmu_ops =3D { .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 From nobody Fri Sep 19 05:39:42 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 028E1C433FE for ; Mon, 28 Nov 2022 06:57:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229907AbiK1G5I (ORCPT ); Mon, 28 Nov 2022 01:57:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50306 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229529AbiK1G41 (ORCPT ); Mon, 28 Nov 2022 01:56:27 -0500 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C0DF15A3F for ; Sun, 27 Nov 2022 22:56:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1669618586; x=1701154586; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=nLuhPxobe8kTeSr/8uapIkQWPmWiW5lqkROueW3ss2c=; b=gCbYUGaTLvOVEdjRfB1CZtHfIF+Ba76Ot04FN3GdSw0yRkyStReMqZAE uOhmMFj+NfQM20lBIQ/ZYWdFRptGVmd1olDZAMlAsaMZ2l7YPv6SctWtW zE0hTROyQ548v0kLfP5PD1I4Ywipi3hf5Cz0CS7dHMjeSXWfGSgFH4rrX KCqcsBhDf2TiYKg6VchErv22NsZfV7XLoXmHPQzdvsGL9ajG2E0Osi4pH u0HRfJLTQQi3eKqt6kEHMdKLGbqszvWcClkEjr3aG7ykA7fHv8Ht5Lt9s xq5a5oYfaVid3LKFnawGk63fTSrEpbqDz3JOX7OdLuVgNum5kZAmhMquz Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10544"; a="313459258" X-IronPort-AV: E=Sophos;i="5.96,199,1665471600"; d="scan'208";a="313459258" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Nov 2022 22:56:26 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10544"; a="674121355" X-IronPort-AV: E=Sophos;i="5.96,199,1665471600"; d="scan'208";a="674121355" Received: from allen-box.sh.intel.com ([10.239.159.48]) by orsmga008.jf.intel.com with ESMTP; 27 Nov 2022 22:56:19 -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 v3 20/20] iommu: Rename attach_dev to set_dev Date: Mon, 28 Nov 2022 14:46:48 +0800 Message-Id: <20221128064648.1934720-21-baolu.lu@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221128064648.1934720-1-baolu.lu@linux.intel.com> References: <20221128064648.1934720-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" With the retirement of the detach_dev callback, the naming of attach_dev isn't meaningful anymore. Rename it to set_dev to restore its real meaning, that is, setting an iommu domain to a device. Signed-off-by: Lu Baolu --- include/linux/iommu.h | 4 ++-- drivers/iommu/amd/iommu.c | 2 +- drivers/iommu/apple-dart.c | 2 +- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 2 +- drivers/iommu/arm/arm-smmu/arm-smmu.c | 2 +- drivers/iommu/arm/arm-smmu/qcom_iommu.c | 2 +- drivers/iommu/exynos-iommu.c | 2 +- drivers/iommu/fsl_pamu_domain.c | 2 +- drivers/iommu/intel/iommu.c | 4 ++-- drivers/iommu/iommu.c | 4 ++-- drivers/iommu/ipmmu-vmsa.c | 2 +- drivers/iommu/msm_iommu.c | 2 +- drivers/iommu/mtk_iommu.c | 2 +- drivers/iommu/mtk_iommu_v1.c | 2 +- drivers/iommu/omap-iommu.c | 2 +- drivers/iommu/rockchip-iommu.c | 2 +- drivers/iommu/s390-iommu.c | 2 +- drivers/iommu/sprd-iommu.c | 2 +- drivers/iommu/sun50i-iommu.c | 2 +- drivers/iommu/tegra-gart.c | 2 +- drivers/iommu/tegra-smmu.c | 2 +- drivers/iommu/virtio-iommu.c | 2 +- 22 files changed, 25 insertions(+), 25 deletions(-) diff --git a/include/linux/iommu.h b/include/linux/iommu.h index 4c0491e5708c..1def4b4bb2b9 100644 --- a/include/linux/iommu.h +++ b/include/linux/iommu.h @@ -281,7 +281,7 @@ struct iommu_ops { =20 /** * struct iommu_domain_ops - domain specific operations - * @attach_dev: attach an iommu domain to a device + * @set_dev: set an iommu domain to a device * Return: * * 0 - success * * EINVAL - can indicate that device and domain are incompatible due to @@ -313,7 +313,7 @@ struct iommu_ops { * @free: Release the domain after use. */ struct iommu_domain_ops { - int (*attach_dev)(struct iommu_domain *domain, struct device *dev); + int (*set_dev)(struct iommu_domain *domain, struct device *dev); int (*set_dev_pasid)(struct iommu_domain *domain, struct device *dev, ioasid_t pasid); =20 diff --git a/drivers/iommu/amd/iommu.c b/drivers/iommu/amd/iommu.c index bd1970b4f48b..f628bd0f9632 100644 --- a/drivers/iommu/amd/iommu.c +++ b/drivers/iommu/amd/iommu.c @@ -2388,7 +2388,7 @@ const struct iommu_ops amd_iommu_ops =3D { .pgsize_bitmap =3D AMD_IOMMU_PGSIZES, .def_domain_type =3D amd_iommu_def_domain_type, .default_domain_ops =3D &(const struct iommu_domain_ops) { - .attach_dev =3D amd_iommu_attach_device, + .set_dev =3D amd_iommu_attach_device, .map_pages =3D amd_iommu_map_pages, .unmap_pages =3D amd_iommu_unmap_pages, .iotlb_sync_map =3D amd_iommu_iotlb_sync_map, diff --git a/drivers/iommu/apple-dart.c b/drivers/iommu/apple-dart.c index 6fbe6b275c79..77c9e7d3e1a2 100644 --- a/drivers/iommu/apple-dart.c +++ b/drivers/iommu/apple-dart.c @@ -763,7 +763,7 @@ static const struct iommu_ops apple_dart_iommu_ops =3D { .pgsize_bitmap =3D -1UL, /* Restricted during dart probe */ .owner =3D THIS_MODULE, .default_domain_ops =3D &(const struct iommu_domain_ops) { - .attach_dev =3D apple_dart_attach_dev, + .set_dev =3D apple_dart_attach_dev, .map_pages =3D apple_dart_map_pages, .unmap_pages =3D apple_dart_unmap_pages, .flush_iotlb_all =3D apple_dart_flush_iotlb_all, diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/ar= m/arm-smmu-v3/arm-smmu-v3.c index ab160198edd6..194c304c5ee8 100644 --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c @@ -2859,7 +2859,7 @@ static struct iommu_ops arm_smmu_ops =3D { .pgsize_bitmap =3D -1UL, /* Restricted during device attach */ .owner =3D THIS_MODULE, .default_domain_ops =3D &(const struct iommu_domain_ops) { - .attach_dev =3D arm_smmu_attach_dev, + .set_dev =3D arm_smmu_attach_dev, .map_pages =3D arm_smmu_map_pages, .unmap_pages =3D arm_smmu_unmap_pages, .flush_iotlb_all =3D arm_smmu_flush_iotlb_all, diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu.c b/drivers/iommu/arm/arm-= smmu/arm-smmu.c index 719fbca1fe52..e31002d84b4a 100644 --- a/drivers/iommu/arm/arm-smmu/arm-smmu.c +++ b/drivers/iommu/arm/arm-smmu/arm-smmu.c @@ -1567,7 +1567,7 @@ static struct iommu_ops arm_smmu_ops =3D { .pgsize_bitmap =3D -1UL, /* Restricted during device attach */ .owner =3D THIS_MODULE, .default_domain_ops =3D &(const struct iommu_domain_ops) { - .attach_dev =3D arm_smmu_attach_dev, + .set_dev =3D arm_smmu_attach_dev, .map_pages =3D arm_smmu_map_pages, .unmap_pages =3D arm_smmu_unmap_pages, .flush_iotlb_all =3D arm_smmu_flush_iotlb_all, diff --git a/drivers/iommu/arm/arm-smmu/qcom_iommu.c b/drivers/iommu/arm/ar= m-smmu/qcom_iommu.c index d7be3adee426..195add905364 100644 --- a/drivers/iommu/arm/arm-smmu/qcom_iommu.c +++ b/drivers/iommu/arm/arm-smmu/qcom_iommu.c @@ -560,7 +560,7 @@ static const struct iommu_ops qcom_iommu_ops =3D { .of_xlate =3D qcom_iommu_of_xlate, .pgsize_bitmap =3D SZ_4K | SZ_64K | SZ_1M | SZ_16M, .default_domain_ops =3D &(const struct iommu_domain_ops) { - .attach_dev =3D qcom_iommu_attach_dev, + .set_dev =3D qcom_iommu_attach_dev, .map_pages =3D qcom_iommu_map, .unmap_pages =3D qcom_iommu_unmap, .flush_iotlb_all =3D qcom_iommu_flush_iotlb_all, diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c index 29ec713e8a21..7e735929e395 100644 --- a/drivers/iommu/exynos-iommu.c +++ b/drivers/iommu/exynos-iommu.c @@ -1403,7 +1403,7 @@ static const struct iommu_ops exynos_iommu_ops =3D { .pgsize_bitmap =3D SECT_SIZE | LPAGE_SIZE | SPAGE_SIZE, .of_xlate =3D exynos_iommu_of_xlate, .default_domain_ops =3D &(const struct iommu_domain_ops) { - .attach_dev =3D exynos_iommu_attach_device, + .set_dev =3D exynos_iommu_attach_device, .map =3D exynos_iommu_map, .unmap =3D exynos_iommu_unmap, .iova_to_phys =3D exynos_iommu_iova_to_phys, diff --git a/drivers/iommu/fsl_pamu_domain.c b/drivers/iommu/fsl_pamu_domai= n.c index 272d88e415c6..c66e48b0ed6f 100644 --- a/drivers/iommu/fsl_pamu_domain.c +++ b/drivers/iommu/fsl_pamu_domain.c @@ -462,7 +462,7 @@ static const struct iommu_ops fsl_pamu_ops =3D { .device_group =3D fsl_pamu_device_group, .set_platform_dma =3D fsl_pamu_set_platform_dma; .default_domain_ops =3D &(const struct iommu_domain_ops) { - .attach_dev =3D fsl_pamu_attach_device, + .set_dev =3D fsl_pamu_attach_device, .iova_to_phys =3D fsl_pamu_iova_to_phys, .free =3D fsl_pamu_domain_free, } diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c index cd71194fe7a6..7bcadb702e00 100644 --- a/drivers/iommu/intel/iommu.c +++ b/drivers/iommu/intel/iommu.c @@ -4131,7 +4131,7 @@ static int blocking_domain_attach_dev(struct iommu_do= main *domain, =20 static struct iommu_domain blocking_domain =3D { .ops =3D &(const struct iommu_domain_ops) { - .attach_dev =3D blocking_domain_attach_dev, + .set_dev =3D blocking_domain_attach_dev, .free =3D intel_iommu_domain_free } }; @@ -4750,7 +4750,7 @@ const struct iommu_ops intel_iommu_ops =3D { .page_response =3D intel_svm_page_response, #endif .default_domain_ops =3D &(const struct iommu_domain_ops) { - .attach_dev =3D intel_iommu_attach_device, + .set_dev =3D intel_iommu_attach_device, .map_pages =3D intel_iommu_map_pages, .unmap_pages =3D intel_iommu_unmap_pages, .iotlb_sync_map =3D intel_iommu_iotlb_sync_map, diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index e4966f088184..dca31065cdb5 100644 --- a/drivers/iommu/iommu.c +++ b/drivers/iommu/iommu.c @@ -1983,10 +1983,10 @@ static int __iommu_attach_device(struct iommu_domai= n *domain, { int ret; =20 - if (unlikely(domain->ops->attach_dev =3D=3D NULL)) + if (unlikely(!domain->ops->set_dev)) return -ENODEV; =20 - ret =3D domain->ops->attach_dev(domain, dev); + ret =3D domain->ops->set_dev(domain, dev); if (!ret) trace_attach_device_to_domain(dev); return ret; diff --git a/drivers/iommu/ipmmu-vmsa.c b/drivers/iommu/ipmmu-vmsa.c index 3112822ac7be..8d40a2c150d4 100644 --- a/drivers/iommu/ipmmu-vmsa.c +++ b/drivers/iommu/ipmmu-vmsa.c @@ -860,7 +860,7 @@ static const struct iommu_ops ipmmu_ops =3D { .pgsize_bitmap =3D SZ_1G | SZ_2M | SZ_4K, .of_xlate =3D ipmmu_of_xlate, .default_domain_ops =3D &(const struct iommu_domain_ops) { - .attach_dev =3D ipmmu_attach_device, + .set_dev =3D ipmmu_attach_device, .map_pages =3D ipmmu_map, .unmap_pages =3D ipmmu_unmap, .flush_iotlb_all =3D ipmmu_flush_iotlb_all, diff --git a/drivers/iommu/msm_iommu.c b/drivers/iommu/msm_iommu.c index 564f9dc0140d..9f7432443726 100644 --- a/drivers/iommu/msm_iommu.c +++ b/drivers/iommu/msm_iommu.c @@ -690,7 +690,7 @@ static struct iommu_ops msm_iommu_ops =3D { .pgsize_bitmap =3D MSM_IOMMU_PGSIZES, .of_xlate =3D qcom_iommu_of_xlate, .default_domain_ops =3D &(const struct iommu_domain_ops) { - .attach_dev =3D msm_iommu_attach_dev, + .set_dev =3D msm_iommu_attach_dev, .map_pages =3D msm_iommu_map, .unmap_pages =3D msm_iommu_unmap, /* diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c index 2022f47529c1..6bd4eb39c08f 100644 --- a/drivers/iommu/mtk_iommu.c +++ b/drivers/iommu/mtk_iommu.c @@ -940,7 +940,7 @@ static const struct iommu_ops mtk_iommu_ops =3D { .pgsize_bitmap =3D SZ_4K | SZ_64K | SZ_1M | SZ_16M, .owner =3D THIS_MODULE, .default_domain_ops =3D &(const struct iommu_domain_ops) { - .attach_dev =3D mtk_iommu_attach_device, + .set_dev =3D mtk_iommu_attach_device, .map_pages =3D mtk_iommu_map, .unmap_pages =3D mtk_iommu_unmap, .flush_iotlb_all =3D mtk_iommu_flush_iotlb_all, diff --git a/drivers/iommu/mtk_iommu_v1.c b/drivers/iommu/mtk_iommu_v1.c index c2d80b7a377f..785fc1569bc7 100644 --- a/drivers/iommu/mtk_iommu_v1.c +++ b/drivers/iommu/mtk_iommu_v1.c @@ -596,7 +596,7 @@ static const struct iommu_ops mtk_iommu_v1_ops =3D { .set_platform_dma =3D mtk_iommu_v1_set_platform_dma, .owner =3D THIS_MODULE, .default_domain_ops =3D &(const struct iommu_domain_ops) { - .attach_dev =3D mtk_iommu_v1_attach_device, + .set_dev =3D mtk_iommu_v1_attach_device, .map_pages =3D mtk_iommu_v1_map, .unmap_pages =3D mtk_iommu_v1_unmap, .iova_to_phys =3D mtk_iommu_v1_iova_to_phys, diff --git a/drivers/iommu/omap-iommu.c b/drivers/iommu/omap-iommu.c index c3eedab00038..6f1031336611 100644 --- a/drivers/iommu/omap-iommu.c +++ b/drivers/iommu/omap-iommu.c @@ -1748,7 +1748,7 @@ static const struct iommu_ops omap_iommu_ops =3D { .set_platform_dma =3D omap_iommu_set_platform_dma, .pgsize_bitmap =3D OMAP_IOMMU_PGSIZES, .default_domain_ops =3D &(const struct iommu_domain_ops) { - .attach_dev =3D omap_iommu_attach_dev, + .set_dev =3D omap_iommu_attach_dev, .map =3D omap_iommu_map, .unmap =3D omap_iommu_unmap, .iova_to_phys =3D omap_iommu_iova_to_phys, diff --git a/drivers/iommu/rockchip-iommu.c b/drivers/iommu/rockchip-iommu.c index f30db22ea5d7..5381dbf624ad 100644 --- a/drivers/iommu/rockchip-iommu.c +++ b/drivers/iommu/rockchip-iommu.c @@ -1191,7 +1191,7 @@ static const struct iommu_ops rk_iommu_ops =3D { .pgsize_bitmap =3D RK_IOMMU_PGSIZE_BITMAP, .of_xlate =3D rk_iommu_of_xlate, .default_domain_ops =3D &(const struct iommu_domain_ops) { - .attach_dev =3D rk_iommu_attach_device, + .set_dev =3D rk_iommu_attach_device, .map =3D rk_iommu_map, .unmap =3D rk_iommu_unmap, .iova_to_phys =3D rk_iommu_iova_to_phys, diff --git a/drivers/iommu/s390-iommu.c b/drivers/iommu/s390-iommu.c index 33dba5ee5e20..5fa8ea6687e7 100644 --- a/drivers/iommu/s390-iommu.c +++ b/drivers/iommu/s390-iommu.c @@ -447,7 +447,7 @@ static const struct iommu_ops s390_iommu_ops =3D { .pgsize_bitmap =3D SZ_4K, .get_resv_regions =3D s390_iommu_get_resv_regions, .default_domain_ops =3D &(const struct iommu_domain_ops) { - .attach_dev =3D s390_iommu_attach_device, + .set_dev =3D s390_iommu_attach_device, .map_pages =3D s390_iommu_map_pages, .unmap_pages =3D s390_iommu_unmap_pages, .flush_iotlb_all =3D s390_iommu_flush_iotlb_all, diff --git a/drivers/iommu/sprd-iommu.c b/drivers/iommu/sprd-iommu.c index ae94d74b73f4..e105fa476e94 100644 --- a/drivers/iommu/sprd-iommu.c +++ b/drivers/iommu/sprd-iommu.c @@ -398,7 +398,7 @@ static const struct iommu_ops sprd_iommu_ops =3D { .pgsize_bitmap =3D SPRD_IOMMU_PAGE_SIZE, .owner =3D THIS_MODULE, .default_domain_ops =3D &(const struct iommu_domain_ops) { - .attach_dev =3D sprd_iommu_attach_device, + .set_dev =3D sprd_iommu_attach_device, .map_pages =3D sprd_iommu_map, .unmap_pages =3D sprd_iommu_unmap, .iotlb_sync_map =3D sprd_iommu_sync_map, diff --git a/drivers/iommu/sun50i-iommu.c b/drivers/iommu/sun50i-iommu.c index 37b074be87a5..2a35148c2b65 100644 --- a/drivers/iommu/sun50i-iommu.c +++ b/drivers/iommu/sun50i-iommu.c @@ -834,7 +834,7 @@ static const struct iommu_ops sun50i_iommu_ops =3D { .of_xlate =3D sun50i_iommu_of_xlate, .probe_device =3D sun50i_iommu_probe_device, .default_domain_ops =3D &(const struct iommu_domain_ops) { - .attach_dev =3D sun50i_iommu_attach_device, + .set_dev =3D sun50i_iommu_attach_device, .flush_iotlb_all =3D sun50i_iommu_flush_iotlb_all, .iotlb_sync_map =3D sun50i_iommu_iotlb_sync_map, .iotlb_sync =3D sun50i_iommu_iotlb_sync, diff --git a/drivers/iommu/tegra-gart.c b/drivers/iommu/tegra-gart.c index a532b333233f..2b3944d10735 100644 --- a/drivers/iommu/tegra-gart.c +++ b/drivers/iommu/tegra-gart.c @@ -282,7 +282,7 @@ static const struct iommu_ops gart_iommu_ops =3D { .pgsize_bitmap =3D GART_IOMMU_PGSIZES, .of_xlate =3D gart_iommu_of_xlate, .default_domain_ops =3D &(const struct iommu_domain_ops) { - .attach_dev =3D gart_iommu_attach_dev, + .set_dev =3D gart_iommu_attach_dev, .map =3D gart_iommu_map, .unmap =3D gart_iommu_unmap, .iova_to_phys =3D gart_iommu_iova_to_phys, diff --git a/drivers/iommu/tegra-smmu.c b/drivers/iommu/tegra-smmu.c index 247d485904c1..b9f035069794 100644 --- a/drivers/iommu/tegra-smmu.c +++ b/drivers/iommu/tegra-smmu.c @@ -977,7 +977,7 @@ static const struct iommu_ops tegra_smmu_ops =3D { .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, + .set_dev =3D tegra_smmu_attach_dev, .map =3D tegra_smmu_map, .unmap =3D tegra_smmu_unmap, .iova_to_phys =3D tegra_smmu_iova_to_phys, diff --git a/drivers/iommu/virtio-iommu.c b/drivers/iommu/virtio-iommu.c index 5b8fe9bfa9a5..c407c4b213db 100644 --- a/drivers/iommu/virtio-iommu.c +++ b/drivers/iommu/virtio-iommu.c @@ -1028,7 +1028,7 @@ static struct iommu_ops viommu_ops =3D { .of_xlate =3D viommu_of_xlate, .owner =3D THIS_MODULE, .default_domain_ops =3D &(const struct iommu_domain_ops) { - .attach_dev =3D viommu_attach_dev, + .set_dev =3D viommu_attach_dev, .map_pages =3D viommu_map_pages, .unmap_pages =3D viommu_unmap_pages, .iova_to_phys =3D viommu_iova_to_phys, --=20 2.34.1