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>,
Ashok Raj <ashok.raj@intel.com>, Will Deacon <will@kernel.org>,
Robin Murphy <robin.murphy@arm.com>,
Jean-Philippe Brucker <jean-philippe@linaro.com>
Cc: Eric Auger <eric.auger@redhat.com>, Liu Yi L <yi.l.liu@intel.com>,
Jacob jun Pan <jacob.jun.pan@intel.com>,
iommu@lists.linux.dev, linux-kernel@vger.kernel.org,
Lu Baolu <baolu.lu@linux.intel.com>
Subject: [PATCH v2 2/3] iommu: Retire detach_dev domain ops
Date: Fri, 26 Aug 2022 20:30:13 +0800 [thread overview]
Message-ID: <20220826123014.52709-3-baolu.lu@linux.intel.com> (raw)
In-Reply-To: <20220826123014.52709-1-baolu.lu@linux.intel.com>
As no IOMMU driver provides detach_dev domain ops callback now, retire
this callback and make the detach_dev calls in iommu core through the
blocking domain.
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
---
include/linux/iommu.h | 2 --
drivers/iommu/iommu.c | 31 ++++---------------------------
2 files changed, 4 insertions(+), 29 deletions(-)
diff --git a/include/linux/iommu.h b/include/linux/iommu.h
index 266ef281cbd5..1e9fecfb23a7 100644
--- a/include/linux/iommu.h
+++ b/include/linux/iommu.h
@@ -274,7 +274,6 @@ struct iommu_ops {
/**
* struct iommu_domain_ops - domain specific operations
* @attach_dev: attach an iommu domain to a device
- * @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
@@ -295,7 +294,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);
diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index 9e84f58440dd..ad34e4df1aad 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -2047,16 +2047,6 @@ int iommu_deferred_attach(struct device *dev, struct iommu_domain *domain)
return 0;
}
-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;
@@ -2149,15 +2139,6 @@ int iommu_attach_group(struct iommu_domain *domain, struct iommu_group *group)
}
EXPORT_SYMBOL_GPL(iommu_attach_group);
-static int iommu_group_do_detach_device(struct device *dev, void *data)
-{
- struct iommu_domain *domain = data;
-
- __iommu_detach_device(domain, dev);
-
- return 0;
-}
-
static int __iommu_group_set_domain(struct iommu_group *group,
struct iommu_domain *new_domain)
{
@@ -2167,17 +2148,13 @@ static int __iommu_group_set_domain(struct iommu_group *group,
return 0;
/*
- * 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.
+ * The NULL domain represents some platform specific behavior.
+ * Attaching the blocking domain instead.
*/
if (!new_domain) {
- if (WARN_ON(!group->domain->ops->detach_dev))
+ if (WARN_ON(!group->blocking_domain))
return -EINVAL;
- __iommu_group_for_each_dev(group, group->domain,
- iommu_group_do_detach_device);
- group->domain = NULL;
- return 0;
+ new_domain = group->blocking_domain;
}
/*
--
2.25.1
next prev parent reply other threads:[~2022-08-26 12:36 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-26 12:30 [PATCH v2 0/3] iommu: Retire detach_dev callback Lu Baolu
2022-08-26 12:30 ` [PATCH v2 1/3] iommu: Replace detach_dev with real blocking domains Lu Baolu
2022-08-26 15:34 ` Jason Gunthorpe
2022-08-29 3:49 ` Baolu Lu
2022-08-26 12:30 ` Lu Baolu [this message]
2022-08-26 12:30 ` [PATCH v2 3/3] iommu: Rename attach_dev to set_dev Lu Baolu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220826123014.52709-3-baolu.lu@linux.intel.com \
--to=baolu.lu@linux.intel.com \
--cc=ashok.raj@intel.com \
--cc=eric.auger@redhat.com \
--cc=hch@infradead.org \
--cc=iommu@lists.linux.dev \
--cc=jacob.jun.pan@intel.com \
--cc=jean-philippe@linaro.com \
--cc=jgg@nvidia.com \
--cc=joro@8bytes.org \
--cc=kevin.tian@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=robin.murphy@arm.com \
--cc=will@kernel.org \
--cc=yi.l.liu@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox