Commit 24b1d476 authored by Jason Gunthorpe's avatar Jason Gunthorpe Committed by Joerg Roedel

iommu: Remove ops->set_platform_dma_ops()

All drivers are now using IDENTITY or PLATFORM domains for what this did,
we can remove it now. It is no longer possible to attach to a NULL domain.
Tested-by: default avatarHeiko Stuebner <heiko@sntech.de>
Tested-by: default avatarNiklas Schnelle <schnelle@linux.ibm.com>
Tested-by: default avatarSteven Price <steven.price@arm.com>
Tested-by: default avatarMarek Szyprowski <m.szyprowski@samsung.com>
Tested-by: default avatarNicolin Chen <nicolinc@nvidia.com>
Reviewed-by: default avatarLu Baolu <baolu.lu@linux.intel.com>
Reviewed-by: default avatarJerry Snitselaar <jsnitsel@redhat.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
Link: https://lore.kernel.org/r/15-v8-81230027b2fa+9d-iommu_all_defdom_jgg@nvidia.comSigned-off-by: default avatarJoerg Roedel <jroedel@suse.de>
parent 78fc30b4
...@@ -2351,21 +2351,8 @@ static int __iommu_group_set_domain_internal(struct iommu_group *group, ...@@ -2351,21 +2351,8 @@ static int __iommu_group_set_domain_internal(struct iommu_group *group,
if (group->domain == new_domain) if (group->domain == new_domain)
return 0; return 0;
/* if (WARN_ON(!new_domain))
* New drivers should support default domains, so set_platform_dma() return -EINVAL;
* op will never be called. Otherwise the NULL domain represents some
* platform specific behavior.
*/
if (!new_domain) {
for_each_group_device(group, gdev) {
const struct iommu_ops *ops = dev_iommu_ops(gdev->dev);
if (!WARN_ON(!ops->set_platform_dma_ops))
ops->set_platform_dma_ops(gdev->dev);
}
group->domain = NULL;
return 0;
}
/* /*
* Changing the domain is done by calling attach_dev() on the new * Changing the domain is done by calling attach_dev() on the new
...@@ -2401,19 +2388,15 @@ static int __iommu_group_set_domain_internal(struct iommu_group *group, ...@@ -2401,19 +2388,15 @@ static int __iommu_group_set_domain_internal(struct iommu_group *group,
*/ */
last_gdev = gdev; last_gdev = gdev;
for_each_group_device(group, gdev) { for_each_group_device(group, gdev) {
const struct iommu_ops *ops = dev_iommu_ops(gdev->dev);
/* /*
* If set_platform_dma_ops is not present a NULL domain can * A NULL domain can happen only for first probe, in which case
* happen only for first probe, in which case we leave * we leave group->domain as NULL and let release clean
* group->domain as NULL and let release clean everything up. * everything up.
*/ */
if (group->domain) if (group->domain)
WARN_ON(__iommu_device_set_domain( WARN_ON(__iommu_device_set_domain(
group, gdev->dev, group->domain, group, gdev->dev, group->domain,
IOMMU_SET_DOMAIN_MUST_SUCCEED)); IOMMU_SET_DOMAIN_MUST_SUCCEED));
else if (ops->set_platform_dma_ops)
ops->set_platform_dma_ops(gdev->dev);
if (gdev == last_gdev) if (gdev == last_gdev)
break; break;
} }
...@@ -3036,9 +3019,6 @@ static int iommu_setup_default_domain(struct iommu_group *group, ...@@ -3036,9 +3019,6 @@ static int iommu_setup_default_domain(struct iommu_group *group,
/* /*
* There are still some drivers which don't support default domains, so * There are still some drivers which don't support default domains, so
* we ignore the failure and leave group->default_domain NULL. * we ignore the failure and leave group->default_domain NULL.
*
* We assume that the iommu driver starts up the device in
* 'set_platform_dma_ops' mode if it does not support default domains.
*/ */
dom = iommu_group_alloc_default_domain(group, req_type); dom = iommu_group_alloc_default_domain(group, req_type);
if (!dom) { if (!dom) {
......
...@@ -243,9 +243,6 @@ struct iommu_iotlb_gather { ...@@ -243,9 +243,6 @@ struct iommu_iotlb_gather {
* @release_device: Remove device from iommu driver handling * @release_device: Remove device from iommu driver handling
* @probe_finalize: Do final setup work after the device is added to an IOMMU * @probe_finalize: Do final setup work after the device is added to an IOMMU
* group and attached to the groups domain * group and attached to the groups domain
* @set_platform_dma_ops: Returning control back to the platform DMA ops. This op
* is to support old IOMMU drivers, new drivers should use
* default domains, and the common IOMMU DMA ops.
* @device_group: find iommu group for a particular device * @device_group: find iommu group for a particular device
* @get_resv_regions: Request list of reserved regions for a device * @get_resv_regions: Request list of reserved regions for a device
* @of_xlate: add OF master IDs to iommu grouping * @of_xlate: add OF master IDs to iommu grouping
...@@ -280,7 +277,6 @@ struct iommu_ops { ...@@ -280,7 +277,6 @@ struct iommu_ops {
struct iommu_device *(*probe_device)(struct device *dev); struct iommu_device *(*probe_device)(struct device *dev);
void (*release_device)(struct device *dev); void (*release_device)(struct device *dev);
void (*probe_finalize)(struct device *dev); void (*probe_finalize)(struct device *dev);
void (*set_platform_dma_ops)(struct device *dev);
struct iommu_group *(*device_group)(struct device *dev); struct iommu_group *(*device_group)(struct device *dev);
/* Request/Free a list of reserved regions for a device */ /* Request/Free a list of reserved regions for a device */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment