Message ID | 20221128064648.1934720-12-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 q4csp5476087wrr; Sun, 27 Nov 2022 22:59:40 -0800 (PST) X-Google-Smtp-Source: AA0mqf5Wbe7T8QWj3XxXNn8qrCIM2DAeu8jq2RqoJ5Tju0MZZo9U2igGYTC6gELK/ur5rGSqYc/0 X-Received: by 2002:a50:fe11:0:b0:46b:2327:7c5d with SMTP id f17-20020a50fe11000000b0046b23277c5dmr4005038edt.386.1669618779856; Sun, 27 Nov 2022 22:59:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669618779; cv=none; d=google.com; s=arc-20160816; b=C98S13uph6oHUQ5uG9ys6KHvLr3oXl42ZSqc1TlXVJOttX0TQvqjBXD0zQ0o0Pn8uC tZQUZk3fReTHCzKWHydBZQDwKmDaD5KeC86q6XroR9kbsj2Lcb7G3b77bkYvdnnO+rtY Yo3PzYGGeoCFeixPO+eZKJ0Vpfv3EENxzp9FeJMhM8lHEbdRZbWuiNDdLUv+GUOYlhvF 6Rx8eruSXi8sLHsbmrwutct9An+QD+10K+bHyOLe8iwyOfXorZ5gVc7LQcU+OtHqyeZ0 UJcjP1h7ueMHGNaI0F2J0Z2e5jRo7aAH+KKEBIXjdDu/Gs26edvoL7qEakaySdrOsLMv rarA== 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=Cu/5sd/eQNsGKIO02pTSxqN/2jjzeBBtSp+NyGqoC5k=; b=clCjyHukabYnZstmgtFfmv8qejt/X20ZvW9IRTuaC8iLXUoaS4NMBVoqRrSHLF8cnz hyXwOEFFxTiPibYnaya1ITNsfiw8sTAv453QLg4sQKNDbOMrz3GAwEFT6aL0xapXcFA3 u/xeQTM3QU0ZhxW3SjITzoxoLEhI0VT24wD6bDgGmOD1FUVS9TX8qxi+6zq9T3H4eT4Y hjasMhnPwVD99zGo5Xd2DLFCZlz7O2KM79L1IiIU7whQ5ZczcyEnrDXyx4OEueaeBkKr wF9DrBo9gPhWo0S0Lpht0Wk6AOLY/jGZ2OldlheRy4utKvYa66FkbDbrhXTWi+AXCYrL jTNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Mhk4Sauj; 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 gs34-20020a1709072d2200b0078df1c345dcsi10449874ejc.535.2022.11.27.22.59.17; Sun, 27 Nov 2022 22:59:39 -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=Mhk4Sauj; 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 S229986AbiK1G4E (ORCPT <rfc822;gah0developer@gmail.com> + 99 others); Mon, 28 Nov 2022 01:56:04 -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 <rfc822;linux-kernel@vger.kernel.org>); 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 <linux-kernel@vger.kernel.org>; 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 <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 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: 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, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,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?1750722181805150810?= X-GMAIL-MSGID: =?utf-8?q?1750722181805150810?= |
Series |
iommu: Retire detach_dev callback
|
|
Commit Message
Baolu Lu
Nov. 28, 2022, 6:46 a.m. UTC
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 <baolu.lu@linux.intel.com>
---
drivers/iommu/fsl_pamu_domain.c | 9 +++++++++
1 file changed, 9 insertions(+)
Comments
On Mon, Nov 28, 2022 at 02:46:39PM +0800, Lu Baolu wrote: > 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 <baolu.lu@linux.intel.com> > --- > 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_domain.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); > } > > +static void fsl_pamu_set_platform_dma(struct device *dev) > +{ > + struct iommu_domain *domain = iommu_get_domain_for_dev(dev); > + > + if (domain) > + fsl_pamu_detach_device(domain, dev); > +} This is a bit ugly, it would be better to make the previous patch call set_platform_dma if it is set instead of detach_dev and then these patches should just rename the driver's fsl_pamu_detach_device to fsl_pamu_set_platform_dma Then the last patch just deletes the op and the core code Jason
On 11/28/22 10:14 PM, Jason Gunthorpe wrote: > On Mon, Nov 28, 2022 at 02:46:39PM +0800, Lu Baolu wrote: >> 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<baolu.lu@linux.intel.com> >> --- >> 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_domain.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); >> } >> >> +static void fsl_pamu_set_platform_dma(struct device *dev) >> +{ >> + struct iommu_domain *domain = iommu_get_domain_for_dev(dev); >> + >> + if (domain) >> + fsl_pamu_detach_device(domain, dev); >> +} > This is a bit ugly, it would be better to make the previous patch call > set_platform_dma if it is set instead of detach_dev and then these > patches should just rename the driver's fsl_pamu_detach_device to > fsl_pamu_set_platform_dma > > Then the last patch just deletes the op and the core code Yes. That's better. I will update the series. Best regards, baolu
diff --git a/drivers/iommu/fsl_pamu_domain.c b/drivers/iommu/fsl_pamu_domain.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); } +static void fsl_pamu_set_platform_dma(struct device *dev) +{ + struct iommu_domain *domain = 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 = { .domain_alloc = fsl_pamu_domain_alloc, .probe_device = fsl_pamu_probe_device, .device_group = fsl_pamu_device_group, + .set_platform_dma = fsl_pamu_set_platform_dma; .default_domain_ops = &(const struct iommu_domain_ops) { .attach_dev = fsl_pamu_attach_device, .detach_dev = fsl_pamu_detach_device,