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: Heiko Stuebner <he...@sntech.de>
Tested-by: Niklas Schnelle <schne...@linux.ibm.com>
Signed-off-by: Jason Gunthorpe <j...@nvidia.com>
---
 drivers/iommu/iommu.c | 30 +++++-------------------------
 include/linux/iommu.h |  4 ----
 2 files changed, 5 insertions(+), 29 deletions(-)

diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index f9f11ad918f673..af8b91d15462f3 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -2259,21 +2259,8 @@ static int __iommu_group_set_domain_internal(struct 
iommu_group *group,
        if (group->domain == new_domain)
                return 0;
 
-       /*
-        * New drivers should support default domains, so set_platform_dma()
-        * 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;
-       }
+       if (WARN_ON(!new_domain))
+               return -EINVAL;
 
        /*
         * Changing the domain is done by calling attach_dev() on the new
@@ -2309,19 +2296,15 @@ static int __iommu_group_set_domain_internal(struct 
iommu_group *group,
         */
        last_gdev = 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
-                * happen only for first probe, in which case we leave
-                * group->domain as NULL and let release clean everything up.
+                * A NULL domain can happen only for first probe, in which case
+                * we leave group->domain as NULL and let release clean
+                * everything up.
                 */
                if (group->domain)
                        WARN_ON(__iommu_device_set_domain(
                                group, gdev->dev, group->domain,
                                IOMMU_SET_DOMAIN_MUST_SUCCEED));
-               else if (ops->set_platform_dma_ops)
-                       ops->set_platform_dma_ops(gdev->dev);
                if (gdev == last_gdev)
                        break;
        }
@@ -2935,9 +2918,6 @@ static int iommu_setup_default_domain(struct iommu_group 
*group,
        /*
         * There are still some drivers which don't support default domains, so
         * 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);
        if (!dom) {
diff --git a/include/linux/iommu.h b/include/linux/iommu.h
index ddd284f8e5b768..387746f8273c99 100644
--- a/include/linux/iommu.h
+++ b/include/linux/iommu.h
@@ -231,9 +231,6 @@ struct iommu_iotlb_gather {
  * @release_device: Remove device from iommu driver handling
  * @probe_finalize: Do final setup work after the device is added to an IOMMU
  *                  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
  * @get_resv_regions: Request list of reserved regions for a device
  * @of_xlate: add OF master IDs to iommu grouping
@@ -265,7 +262,6 @@ struct iommu_ops {
        struct iommu_device *(*probe_device)(struct device *dev);
        void (*release_device)(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);
 
        /* Request/Free a list of reserved regions for a device */
-- 
2.40.1

Reply via email to