Message ID | 20221128064648.1934720-3-baolu.lu@linux.intel.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp5475976wrr; Sun, 27 Nov 2022 22:59:20 -0800 (PST) X-Google-Smtp-Source: AA0mqf7Mgy6iZ6EcXhl4ozJBC5CMtCkWCtDLGQDTPgwiPFaAc/0vB/PwH5cx0JejEw9lI3aJ2rS9 X-Received: by 2002:a05:6402:1caa:b0:467:78ce:5fe6 with SMTP id cz10-20020a0564021caa00b0046778ce5fe6mr29687050edb.325.1669618760240; Sun, 27 Nov 2022 22:59:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669618760; cv=none; d=google.com; s=arc-20160816; b=ZjHL9mQvf7Xj7EXc62Mdt40/SnxDlXW9U9cwpKsjzx8gSpnMgbYy7nNBofQKCYOiIM y3bXq9HEmGpBMYG5RGJ93LcGof8+vKSxgsIzlq01BWfpwwjTf2XGsZ25m98W13OuPUH5 6Hs0+m6s05FCqSxGxCJhMtafgo3SqcAf/4zjKmQDSJSx+o4PfNyu4+Rg3CG0UqgkZuLF 2bvJ0ekpAanoKnTRAm6YpLTS/1d2GaNuiZ6cUFJvmRCLel3ev+ILN876CpI+3OcdJv9s xg9DyLDnAFgOJlphucRlI/I5+DNjF6pffGFLlNOSuD+k6q2D4VNFMVWT/Xih+wMod8z/ pWRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=0ZEc+4WkaxZPef1cUL0OQgIQsRohw4kGNh8ENnPSAHs=; b=lu/j9V380xU1+BqJDbTLM5VIdTIsXf9gFi4nUE0055yNQjzsVdgZ8i8YjIpimgHQHY L6P1L61tTWKbKrcmSZ0qOMrs+i1lDR3iJ58/xEa/qcT6cjwLJ4PomSzOxUPpNqR8ESJs m2gzay76MXgQ2yE5HUgNmO+OnqOXlnIxw2rQ0CMSrU0KNsuK9AX6CGdrLvet4Z+rgzAT 3INxk7Y/lWGwy07a9NmTUlC91QTV0+VJ9JSavr1umUGKXjikIq/B29lFNTuJXHT7UUNy Jc4TYL09ogRIDf3+c9GJ0BSnSoT273aMVKr5qbE/AcFNuBxN/1cNRXWmIH8SXrbtxTRh LPAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=a8byyQAE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g41-20020a056402322900b0046b2327bf88si2133790eda.76.2022.11.27.22.58.56; Sun, 27 Nov 2022 22:59:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=a8byyQAE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229972AbiK1Gy6 (ORCPT <rfc822;gah0developer@gmail.com> + 99 others); Mon, 28 Nov 2022 01:54:58 -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 <rfc822;linux-kernel@vger.kernel.org>); 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 <linux-kernel@vger.kernel.org>; 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 <baolu.lu@linux.intel.com> To: Joerg Roedel <joro@8bytes.org>, Jason Gunthorpe <jgg@nvidia.com>, Christoph Hellwig <hch@infradead.org>, Kevin Tian <kevin.tian@intel.com>, Will Deacon <will@kernel.org>, Robin Murphy <robin.murphy@arm.com>, Jean-Philippe Brucker <jean-philippe@linaro.org> Cc: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>, Hector Martin <marcan@marcan.st>, Sven Peter <sven@svenpeter.dev>, Rob Clark <robdclark@gmail.com>, Marek Szyprowski <m.szyprowski@samsung.com>, Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>, Andy Gross <agross@kernel.org>, Bjorn Andersson <andersson@kernel.org>, Yong Wu <yong.wu@mediatek.com>, Matthias Brugger <matthias.bgg@gmail.com>, Heiko Stuebner <heiko@sntech.de>, Matthew Rosato <mjrosato@linux.ibm.com>, Orson Zhai <orsonzhai@gmail.com>, Baolin Wang <baolin.wang@linux.alibaba.com>, Chunyan Zhang <zhang.lyra@gmail.com>, Chen-Yu Tsai <wens@csie.org>, Thierry Reding <thierry.reding@gmail.com>, iommu@lists.linux.dev, linux-kernel@vger.kernel.org, Lu Baolu <baolu.lu@linux.intel.com> 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: 8bit X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750722161397691756?= X-GMAIL-MSGID: =?utf-8?q?1750722161397691756?= |
Series |
iommu: Retire detach_dev callback
|
|
Commit Message
Baolu Lu
Nov. 28, 2022, 6:46 a.m. UTC
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 <baolu.lu@linux.intel.com>
---
drivers/iommu/apple-dart.c | 17 -----------------
1 file changed, 17 deletions(-)
Comments
On Mon, Nov 28, 2022 at 02:46:30PM +0800, Lu Baolu wrote: > 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 <baolu.lu@linux.intel.com> > --- > drivers/iommu/apple-dart.c | 17 ----------------- > 1 file changed, 17 deletions(-) I suspect this is doing the blocking domain behavior.. Reviewed-by: Jason Gunthorpe <jgg@nvidia.com> Jason
Hi, On Mon, Nov 28, 2022, at 07:46, Lu Baolu wrote: > 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 <baolu.lu@linux.intel.com> > --- Reviewed-by: Sven Peter <sven@svenpeter.dev> > 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; > } > > -static void apple_dart_detach_dev(struct iommu_domain *domain, > - struct device *dev) > -{ Thanks for cleaning this entire API up! It actually turns out that this is slightly broken because I assumed that detach_dev would always be called for any attach_dev. I think the only consequence for a device that used to be assigned to domain A and is now moved to domain B is that any TLB flushes required for A will still flush the TLB for that device. That's not a big deal but I'll eventually send a fix. > - int i; > - struct apple_dart_stream_map *stream_map; > - struct apple_dart_master_cfg *cfg = dev_iommu_priv_get(dev); > - struct apple_dart_domain *dart_domain = to_dart_domain(domain); > - > - for_each_stream_map(i, cfg, stream_map) > - apple_dart_hw_disable_dma(stream_map); > - > - if (domain->type == IOMMU_DOMAIN_DMA || > - domain->type == IOMMU_DOMAIN_UNMANAGED) > - apple_dart_domain_remove_streams(dart_domain, cfg); Something might complain about unused apple_dart_domain_remove_streams now. Might make sense to drop that for now as well. Best, Sven
On 2022/12/1 1:00, Sven Peter wrote: > On Mon, Nov 28, 2022, at 07:46, Lu Baolu wrote: >> 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<baolu.lu@linux.intel.com> >> --- > Reviewed-by: Sven Peter<sven@svenpeter.dev> > >> 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; >> } >> >> -static void apple_dart_detach_dev(struct iommu_domain *domain, >> - struct device *dev) >> -{ > Thanks for cleaning this entire API up! > > It actually turns out that this is slightly broken because I assumed that > detach_dev would always be called for any attach_dev. I think the only > consequence for a device that used to be assigned to domain A and is now moved to > domain B is that any TLB flushes required for A will still flush the TLB for that > device. > > That's not a big deal but I'll eventually send a fix. > >> - int i; >> - struct apple_dart_stream_map *stream_map; >> - struct apple_dart_master_cfg *cfg = dev_iommu_priv_get(dev); >> - struct apple_dart_domain *dart_domain = to_dart_domain(domain); >> - >> - for_each_stream_map(i, cfg, stream_map) >> - apple_dart_hw_disable_dma(stream_map); >> - >> - if (domain->type == IOMMU_DOMAIN_DMA || >> - domain->type == IOMMU_DOMAIN_UNMANAGED) >> - apple_dart_domain_remove_streams(dart_domain, cfg); > Something might complain about unused apple_dart_domain_remove_streams now. > Might make sense to drop that for now as well. Done. Thanks! Best regards, baolu
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; } -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 = dev_iommu_priv_get(dev); - struct apple_dart_domain *dart_domain = to_dart_domain(domain); - - for_each_stream_map(i, cfg, stream_map) - apple_dart_hw_disable_dma(stream_map); - - if (domain->type == IOMMU_DOMAIN_DMA || - domain->type == 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 = dev_iommu_priv_get(dev); @@ -780,7 +764,6 @@ static const struct iommu_ops apple_dart_iommu_ops = { .owner = THIS_MODULE, .default_domain_ops = &(const struct iommu_domain_ops) { .attach_dev = apple_dart_attach_dev, - .detach_dev = apple_dart_detach_dev, .map_pages = apple_dart_map_pages, .unmap_pages = apple_dart_unmap_pages, .flush_iotlb_all = apple_dart_flush_iotlb_all,