[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220826123014.52709-3-baolu.lu@linux.intel.com>
Date: Fri, 26 Aug 2022 20:30:13 +0800
From: Lu Baolu <baolu.lu@...ux.intel.com>
To: Joerg Roedel <joro@...tes.org>, Jason Gunthorpe <jgg@...dia.com>,
Christoph Hellwig <hch@...radead.org>,
Kevin Tian <kevin.tian@...el.com>,
Ashok Raj <ashok.raj@...el.com>, Will Deacon <will@...nel.org>,
Robin Murphy <robin.murphy@....com>,
Jean-Philippe Brucker <jean-philippe@...aro.com>
Cc: Eric Auger <eric.auger@...hat.com>, Liu Yi L <yi.l.liu@...el.com>,
Jacob jun Pan <jacob.jun.pan@...el.com>,
iommu@...ts.linux.dev, linux-kernel@...r.kernel.org,
Lu Baolu <baolu.lu@...ux.intel.com>
Subject: [PATCH v2 2/3] iommu: Retire detach_dev domain ops
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@...ux.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
Powered by blists - more mailing lists