iommu: Remove detach_dev callback

The detach_dev callback of domain ops is not called in the IOMMU core.
Remove this callback to avoid dead code. The trace event for detaching
domain from device is removed accordingly.

Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
Link: https://lore.kernel.org/r/20230110025408.667767-6-baolu.lu@linux.intel.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
This commit is contained in:
Lu Baolu 2023-01-10 10:54:08 +08:00 коммит произвёл Joerg Roedel
Родитель dd8a25c557
Коммит 8f9930fa01
4 изменённых файлов: 4 добавлений и 42 удалений

Просмотреть файл

@ -18,7 +18,6 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(remove_device_from_group);
/* iommu_device_event */ /* iommu_device_event */
EXPORT_TRACEPOINT_SYMBOL_GPL(attach_device_to_domain); EXPORT_TRACEPOINT_SYMBOL_GPL(attach_device_to_domain);
EXPORT_TRACEPOINT_SYMBOL_GPL(detach_device_from_domain);
/* iommu_map_unmap */ /* iommu_map_unmap */
EXPORT_TRACEPOINT_SYMBOL_GPL(map); EXPORT_TRACEPOINT_SYMBOL_GPL(map);

Просмотреть файл

@ -2045,13 +2045,6 @@ int iommu_deferred_attach(struct device *dev, struct iommu_domain *domain)
return 0; return 0;
} }
static void __iommu_detach_device(struct iommu_domain *domain,
struct device *dev)
{
domain->ops->detach_dev(domain, dev);
trace_detach_device_from_domain(dev);
}
void iommu_detach_device(struct iommu_domain *domain, struct device *dev) void iommu_detach_device(struct iommu_domain *domain, struct device *dev)
{ {
struct iommu_group *group; struct iommu_group *group;
@ -2156,15 +2149,6 @@ int iommu_attach_group(struct iommu_domain *domain, struct iommu_group *group)
} }
EXPORT_SYMBOL_GPL(iommu_attach_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_do_set_platform_dma(struct device *dev, void *data) static int iommu_group_do_set_platform_dma(struct device *dev, void *data)
{ {
const struct iommu_ops *ops = dev_iommu_ops(dev); const struct iommu_ops *ops = dev_iommu_ops(dev);
@ -2184,25 +2168,13 @@ static int __iommu_group_set_domain(struct iommu_group *group,
return 0; return 0;
/* /*
* New drivers should support default domains and so the detach_dev() op * New drivers should support default domains, so set_platform_dma()
* will never be called. Otherwise the NULL domain represents some * op will never be called. Otherwise the NULL domain represents some
* platform specific behavior. * platform specific behavior.
*/ */
if (!new_domain) { if (!new_domain) {
struct group_device *grp_dev; __iommu_group_for_each_dev(group, NULL,
iommu_group_do_set_platform_dma);
grp_dev = list_first_entry(&group->devices,
struct group_device, list);
if (dev_iommu_ops(grp_dev->dev)->set_platform_dma_ops)
__iommu_group_for_each_dev(group, NULL,
iommu_group_do_set_platform_dma);
else if (group->domain->ops->detach_dev)
__iommu_group_for_each_dev(group, group->domain,
iommu_group_do_detach_device);
else
WARN_ON_ONCE(1);
group->domain = NULL; group->domain = NULL;
return 0; return 0;
} }

Просмотреть файл

@ -299,7 +299,6 @@ struct iommu_ops {
* * EBUSY - device is attached to a domain and cannot be changed * * EBUSY - device is attached to a domain and cannot be changed
* * ENODEV - device specific errors, not able to be attached * * ENODEV - device specific errors, not able to be attached
* * <others> - treated as ENODEV by the caller. Use is discouraged * * <others> - 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 * @set_dev_pasid: set an iommu domain to a pasid of device
* @map: map a physically contiguous memory region to an iommu domain * @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 * @map_pages: map a physically contiguous set of pages of the same size to
@ -320,7 +319,6 @@ struct iommu_ops {
*/ */
struct iommu_domain_ops { struct iommu_domain_ops {
int (*attach_dev)(struct iommu_domain *domain, struct device *dev); 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, int (*set_dev_pasid)(struct iommu_domain *domain, struct device *dev,
ioasid_t pasid); ioasid_t pasid);

Просмотреть файл

@ -76,13 +76,6 @@ DEFINE_EVENT(iommu_device_event, attach_device_to_domain,
TP_ARGS(dev) TP_ARGS(dev)
); );
DEFINE_EVENT(iommu_device_event, detach_device_from_domain,
TP_PROTO(struct device *dev),
TP_ARGS(dev)
);
TRACE_EVENT(map, TRACE_EVENT(map,
TP_PROTO(unsigned long iova, phys_addr_t paddr, size_t size), TP_PROTO(unsigned long iova, phys_addr_t paddr, size_t size),