Loading arch/arm64/include/asm/dma-iommu.h +0 −34 Original line number Diff line number Diff line Loading @@ -28,42 +28,8 @@ struct dma_iommu_mapping { }; #ifdef CONFIG_ARM64_DMA_USE_IOMMU struct dma_iommu_mapping * __depr_arm_iommu_create_mapping(struct bus_type *bus, dma_addr_t base, size_t size); void __depr_arm_iommu_release_mapping(struct dma_iommu_mapping *mapping); int __depr_arm_iommu_attach_device(struct device *dev, struct dma_iommu_mapping *mapping); void __depr_arm_iommu_detach_device(struct device *dev); void arm_iommu_put_dma_cookie(struct iommu_domain *domain); #else /* !CONFIG_ARM64_DMA_USE_IOMMU */ static inline struct dma_iommu_mapping * __depr_arm_iommu_create_mapping(struct bus_type *bus, dma_addr_t base, size_t size) { return NULL; } static inline void __depr_arm_iommu_release_mapping(struct dma_iommu_mapping *mapping) { } static inline int __depr_arm_iommu_attach_device(struct device *dev, struct dma_iommu_mapping *mapping) { return -ENODEV; } static inline void __depr_arm_iommu_detach_device(struct device *dev) { } static inline void arm_iommu_put_dma_cookie(struct iommu_domain *domain) {} #endif /* CONFIG_ARM64_DMA_USE_IOMMU */ Loading arch/arm64/mm/dma-mapping.c +0 −173 Original line number Diff line number Diff line Loading @@ -1151,179 +1151,6 @@ static void arm_iommu_setup_dma_ops(struct device *dev, u64 dma_base, u64 size) set_dma_ops(dev, mapping.ops); } /** * DEPRECATED * arm_iommu_create_mapping * @bus: pointer to the bus holding the client device (for IOMMU calls) * @base: start address of the valid IO address space * @size: maximum size of the valid IO address space * * Creates a mapping structure which holds information about used/unused * IO address ranges, which is required to perform memory allocation and * mapping with IOMMU aware functions. * * Clients may use iommu_domain_set_attr() to set additional flags prior * to calling arm_iommu_attach_device() to complete initialization. */ struct dma_iommu_mapping * __depr_arm_iommu_create_mapping(struct bus_type *bus, dma_addr_t base, size_t size) { unsigned int bits = size >> PAGE_SHIFT; struct dma_iommu_mapping *mapping; if (!bits) return ERR_PTR(-EINVAL); mapping = kzalloc(sizeof(struct dma_iommu_mapping), GFP_KERNEL); if (!mapping) return ERR_PTR(-ENOMEM); mapping->base = base; mapping->bits = bits; mapping->domain = iommu_domain_alloc(bus); if (!mapping->domain) goto err_domain_alloc; mapping->init = false; return mapping; err_domain_alloc: kfree(mapping); return ERR_PTR(-ENOMEM); } EXPORT_SYMBOL(__depr_arm_iommu_create_mapping); /* * DEPRECATED * arm_iommu_release_mapping * @mapping: allocted via arm_iommu_create_mapping() * * Frees all resources associated with the iommu mapping. * The device associated with this mapping must be in the 'detached' state */ void __depr_arm_iommu_release_mapping(struct dma_iommu_mapping *mapping) { if (!mapping) return; if (mapping->domain) iommu_domain_free(mapping->domain); kfree(mapping); } EXPORT_SYMBOL(__depr_arm_iommu_release_mapping); /** * DEPRECATED * arm_iommu_attach_device * @dev: valid struct device pointer * @mapping: io address space mapping structure (returned from * arm_iommu_create_mapping) * * Attaches specified io address space mapping to the provided device, * this replaces the dma operations (dma_map_ops pointer) with the * IOMMU aware version. * * Only configures dma_ops for a single device in the iommu_group. */ int __depr_arm_iommu_attach_device(struct device *dev, struct dma_iommu_mapping *mapping) { int err; struct iommu_domain *domain; struct iommu_group *group; if (!dev || !mapping) { pr_err("%s: Error input is NULL\n", __func__); return -EINVAL; } group = dev->iommu_group; if (!group) { dev_err(dev, "No iommu associated with device\n"); return -EINVAL; } domain = iommu_get_domain_for_dev(dev); if (domain) { int dynamic = 0; iommu_domain_get_attr(domain, DOMAIN_ATTR_DYNAMIC, &dynamic); if ((domain->type == IOMMU_DOMAIN_DMA) && dynamic) { dev_warn(dev, "Deprecated API %s in use! Continuing anyway\n", __func__); } else { dev_err(dev, "Device already attached to other iommu_domain\n"); return -EINVAL; } } err = iommu_attach_group(mapping->domain, group); if (err) { dev_err(dev, "iommu_attach_group failed\n"); return err; } err = arm_iommu_get_dma_cookie(dev, mapping); if (err) { dev_err(dev, "arm_iommu_get_dma_cookie failed\n"); iommu_detach_group(domain, group); return err; } dev->archdata.mapping = mapping; set_dma_ops(dev, mapping->ops); pr_debug("Attached IOMMU controller to %s device.\n", dev_name(dev)); return 0; } EXPORT_SYMBOL(__depr_arm_iommu_attach_device); /** * DEPRECATED * arm_iommu_detach_device * @dev: valid struct device pointer * * Detaches the provided device from a previously attached map. * This voids the dma operations (dma_map_ops pointer) */ void __depr_arm_iommu_detach_device(struct device *dev) { struct iommu_domain *domain; int s1_bypass = 0; if (!dev->iommu_group) { dev_err(dev, "No iommu associated with device\n"); return; } domain = iommu_get_domain_for_dev(dev); if (!domain) { dev_warn(dev, "Not attached\n"); return; } iommu_domain_get_attr(domain, DOMAIN_ATTR_S1_BYPASS, &s1_bypass); /* * ION defers dma_unmap calls. Ensure they have all completed prior to * setting dma_ops to NULL. */ if (msm_dma_unmap_all_for_dev(dev)) dev_warn(dev, "IOMMU detach with outstanding mappings\n"); iommu_detach_group(domain, dev->iommu_group); dev->archdata.mapping = NULL; if (!s1_bypass) set_dma_ops(dev, NULL); pr_debug("Detached IOMMU controller from %s device.\n", dev_name(dev)); } EXPORT_SYMBOL(__depr_arm_iommu_detach_device); #else /*!CONFIG_ARM64_DMA_USE_IOMMU */ static void arm_iommu_setup_dma_ops(struct device *dev, u64 dma_base, u64 size) Loading drivers/slimbus/slim-msm-ngd.c +0 −4 Original line number Diff line number Diff line Loading @@ -2036,10 +2036,6 @@ static int ngd_slim_remove(struct platform_device *pdev) struct msm_slim_ctrl *dev = platform_get_drvdata(pdev); ngd_slim_enable(dev, false); if (!IS_ERR_OR_NULL(dev->iommu_desc.iommu_map)) { __depr_arm_iommu_detach_device(dev->iommu_desc.cb_dev); __depr_arm_iommu_release_mapping(dev->iommu_desc.iommu_map); } if (dev->sysfs_created) sysfs_remove_file(&dev->dev->kobj, &dev_attr_debug_mask.attr); Loading drivers/slimbus/slim-msm.h +0 −1 Original line number Diff line number Diff line Loading @@ -257,7 +257,6 @@ struct msm_slim_bulk_wr { struct msm_slim_iommu { struct device *cb_dev; struct dma_iommu_mapping *iommu_map; bool s1_bypass; }; Loading Loading
arch/arm64/include/asm/dma-iommu.h +0 −34 Original line number Diff line number Diff line Loading @@ -28,42 +28,8 @@ struct dma_iommu_mapping { }; #ifdef CONFIG_ARM64_DMA_USE_IOMMU struct dma_iommu_mapping * __depr_arm_iommu_create_mapping(struct bus_type *bus, dma_addr_t base, size_t size); void __depr_arm_iommu_release_mapping(struct dma_iommu_mapping *mapping); int __depr_arm_iommu_attach_device(struct device *dev, struct dma_iommu_mapping *mapping); void __depr_arm_iommu_detach_device(struct device *dev); void arm_iommu_put_dma_cookie(struct iommu_domain *domain); #else /* !CONFIG_ARM64_DMA_USE_IOMMU */ static inline struct dma_iommu_mapping * __depr_arm_iommu_create_mapping(struct bus_type *bus, dma_addr_t base, size_t size) { return NULL; } static inline void __depr_arm_iommu_release_mapping(struct dma_iommu_mapping *mapping) { } static inline int __depr_arm_iommu_attach_device(struct device *dev, struct dma_iommu_mapping *mapping) { return -ENODEV; } static inline void __depr_arm_iommu_detach_device(struct device *dev) { } static inline void arm_iommu_put_dma_cookie(struct iommu_domain *domain) {} #endif /* CONFIG_ARM64_DMA_USE_IOMMU */ Loading
arch/arm64/mm/dma-mapping.c +0 −173 Original line number Diff line number Diff line Loading @@ -1151,179 +1151,6 @@ static void arm_iommu_setup_dma_ops(struct device *dev, u64 dma_base, u64 size) set_dma_ops(dev, mapping.ops); } /** * DEPRECATED * arm_iommu_create_mapping * @bus: pointer to the bus holding the client device (for IOMMU calls) * @base: start address of the valid IO address space * @size: maximum size of the valid IO address space * * Creates a mapping structure which holds information about used/unused * IO address ranges, which is required to perform memory allocation and * mapping with IOMMU aware functions. * * Clients may use iommu_domain_set_attr() to set additional flags prior * to calling arm_iommu_attach_device() to complete initialization. */ struct dma_iommu_mapping * __depr_arm_iommu_create_mapping(struct bus_type *bus, dma_addr_t base, size_t size) { unsigned int bits = size >> PAGE_SHIFT; struct dma_iommu_mapping *mapping; if (!bits) return ERR_PTR(-EINVAL); mapping = kzalloc(sizeof(struct dma_iommu_mapping), GFP_KERNEL); if (!mapping) return ERR_PTR(-ENOMEM); mapping->base = base; mapping->bits = bits; mapping->domain = iommu_domain_alloc(bus); if (!mapping->domain) goto err_domain_alloc; mapping->init = false; return mapping; err_domain_alloc: kfree(mapping); return ERR_PTR(-ENOMEM); } EXPORT_SYMBOL(__depr_arm_iommu_create_mapping); /* * DEPRECATED * arm_iommu_release_mapping * @mapping: allocted via arm_iommu_create_mapping() * * Frees all resources associated with the iommu mapping. * The device associated with this mapping must be in the 'detached' state */ void __depr_arm_iommu_release_mapping(struct dma_iommu_mapping *mapping) { if (!mapping) return; if (mapping->domain) iommu_domain_free(mapping->domain); kfree(mapping); } EXPORT_SYMBOL(__depr_arm_iommu_release_mapping); /** * DEPRECATED * arm_iommu_attach_device * @dev: valid struct device pointer * @mapping: io address space mapping structure (returned from * arm_iommu_create_mapping) * * Attaches specified io address space mapping to the provided device, * this replaces the dma operations (dma_map_ops pointer) with the * IOMMU aware version. * * Only configures dma_ops for a single device in the iommu_group. */ int __depr_arm_iommu_attach_device(struct device *dev, struct dma_iommu_mapping *mapping) { int err; struct iommu_domain *domain; struct iommu_group *group; if (!dev || !mapping) { pr_err("%s: Error input is NULL\n", __func__); return -EINVAL; } group = dev->iommu_group; if (!group) { dev_err(dev, "No iommu associated with device\n"); return -EINVAL; } domain = iommu_get_domain_for_dev(dev); if (domain) { int dynamic = 0; iommu_domain_get_attr(domain, DOMAIN_ATTR_DYNAMIC, &dynamic); if ((domain->type == IOMMU_DOMAIN_DMA) && dynamic) { dev_warn(dev, "Deprecated API %s in use! Continuing anyway\n", __func__); } else { dev_err(dev, "Device already attached to other iommu_domain\n"); return -EINVAL; } } err = iommu_attach_group(mapping->domain, group); if (err) { dev_err(dev, "iommu_attach_group failed\n"); return err; } err = arm_iommu_get_dma_cookie(dev, mapping); if (err) { dev_err(dev, "arm_iommu_get_dma_cookie failed\n"); iommu_detach_group(domain, group); return err; } dev->archdata.mapping = mapping; set_dma_ops(dev, mapping->ops); pr_debug("Attached IOMMU controller to %s device.\n", dev_name(dev)); return 0; } EXPORT_SYMBOL(__depr_arm_iommu_attach_device); /** * DEPRECATED * arm_iommu_detach_device * @dev: valid struct device pointer * * Detaches the provided device from a previously attached map. * This voids the dma operations (dma_map_ops pointer) */ void __depr_arm_iommu_detach_device(struct device *dev) { struct iommu_domain *domain; int s1_bypass = 0; if (!dev->iommu_group) { dev_err(dev, "No iommu associated with device\n"); return; } domain = iommu_get_domain_for_dev(dev); if (!domain) { dev_warn(dev, "Not attached\n"); return; } iommu_domain_get_attr(domain, DOMAIN_ATTR_S1_BYPASS, &s1_bypass); /* * ION defers dma_unmap calls. Ensure they have all completed prior to * setting dma_ops to NULL. */ if (msm_dma_unmap_all_for_dev(dev)) dev_warn(dev, "IOMMU detach with outstanding mappings\n"); iommu_detach_group(domain, dev->iommu_group); dev->archdata.mapping = NULL; if (!s1_bypass) set_dma_ops(dev, NULL); pr_debug("Detached IOMMU controller from %s device.\n", dev_name(dev)); } EXPORT_SYMBOL(__depr_arm_iommu_detach_device); #else /*!CONFIG_ARM64_DMA_USE_IOMMU */ static void arm_iommu_setup_dma_ops(struct device *dev, u64 dma_base, u64 size) Loading
drivers/slimbus/slim-msm-ngd.c +0 −4 Original line number Diff line number Diff line Loading @@ -2036,10 +2036,6 @@ static int ngd_slim_remove(struct platform_device *pdev) struct msm_slim_ctrl *dev = platform_get_drvdata(pdev); ngd_slim_enable(dev, false); if (!IS_ERR_OR_NULL(dev->iommu_desc.iommu_map)) { __depr_arm_iommu_detach_device(dev->iommu_desc.cb_dev); __depr_arm_iommu_release_mapping(dev->iommu_desc.iommu_map); } if (dev->sysfs_created) sysfs_remove_file(&dev->dev->kobj, &dev_attr_debug_mask.attr); Loading
drivers/slimbus/slim-msm.h +0 −1 Original line number Diff line number Diff line Loading @@ -257,7 +257,6 @@ struct msm_slim_bulk_wr { struct msm_slim_iommu { struct device *cb_dev; struct dma_iommu_mapping *iommu_map; bool s1_bypass; }; Loading