Loading arch/arm64/include/asm/dma-iommu.h +1 −3 Original line number Diff line number Diff line Loading @@ -15,7 +15,6 @@ struct dma_iommu_mapping { void *bitmap; size_t bits; unsigned int order; dma_addr_t base; spinlock_t lock; Loading @@ -25,8 +24,7 @@ struct dma_iommu_mapping { #ifdef CONFIG_ARM64_DMA_USE_IOMMU struct dma_iommu_mapping * arm_iommu_create_mapping(struct bus_type *bus, dma_addr_t base, size_t size, int order); arm_iommu_create_mapping(struct bus_type *bus, dma_addr_t base, size_t size); void arm_iommu_release_mapping(struct dma_iommu_mapping *mapping); Loading arch/arm64/mm/dma-mapping.c +10 −18 Original line number Diff line number Diff line Loading @@ -644,11 +644,8 @@ static inline dma_addr_t __alloc_iova(struct dma_iommu_mapping *mapping, if (order > CONFIG_ARM64_DMA_IOMMU_ALIGNMENT) order = CONFIG_ARM64_DMA_IOMMU_ALIGNMENT; count = ((PAGE_ALIGN(size) >> PAGE_SHIFT) + (1 << mapping->order) - 1) >> mapping->order; if (order > mapping->order) align = (1 << (order - mapping->order)) - 1; count = PAGE_ALIGN(size) >> PAGE_SHIFT; align = (1 << order) - 1; spin_lock_irqsave(&mapping->lock, flags); start = bitmap_find_next_zero_area(mapping->bitmap, mapping->bits, 0, Loading @@ -661,16 +658,14 @@ static inline dma_addr_t __alloc_iova(struct dma_iommu_mapping *mapping, bitmap_set(mapping->bitmap, start, count); spin_unlock_irqrestore(&mapping->lock, flags); return mapping->base + (start << (mapping->order + PAGE_SHIFT)); return mapping->base + (start << PAGE_SHIFT); } static inline void __free_iova(struct dma_iommu_mapping *mapping, dma_addr_t addr, size_t size) { unsigned int start = (addr - mapping->base) >> (mapping->order + PAGE_SHIFT); unsigned int count = ((size >> PAGE_SHIFT) + (1 << mapping->order) - 1) >> mapping->order; unsigned int start = (addr - mapping->base) >> PAGE_SHIFT; unsigned int count = size >> PAGE_SHIFT; unsigned long flags; spin_lock_irqsave(&mapping->lock, flags); Loading Loading @@ -1492,8 +1487,7 @@ const struct dma_map_ops iommu_coherent_ops = { * 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: size of the valid IO address space * @order: accuracy of the IO addresses allocations * @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 Loading @@ -1503,15 +1497,14 @@ const struct dma_map_ops iommu_coherent_ops = { * arm_iommu_attach_device function. */ struct dma_iommu_mapping * arm_iommu_create_mapping(struct bus_type *bus, dma_addr_t base, size_t size, int order) arm_iommu_create_mapping(struct bus_type *bus, dma_addr_t base, size_t size) { unsigned int count = size >> (PAGE_SHIFT + order); unsigned int bitmap_size = BITS_TO_LONGS(count) * sizeof(long); unsigned int bits = size >> PAGE_SHIFT; unsigned int bitmap_size = BITS_TO_LONGS(bits) * sizeof(long); struct dma_iommu_mapping *mapping; int err = -ENOMEM; if (!count) if (!bitmap_size) return ERR_PTR(-EINVAL); mapping = kzalloc(sizeof(struct dma_iommu_mapping), GFP_KERNEL); Loading @@ -1524,7 +1517,6 @@ arm_iommu_create_mapping(struct bus_type *bus, dma_addr_t base, size_t size, mapping->base = base; mapping->bits = BITS_PER_BYTE * bitmap_size; mapping->order = order; spin_lock_init(&mapping->lock); mapping->domain = iommu_domain_alloc(bus); Loading drivers/char/adsprpc.c +1 −1 Original line number Diff line number Diff line Loading @@ -1633,7 +1633,7 @@ static int fastrpc_cb_probe(struct device *dev) sess->smmu.cb = iommuspec.args[0]; VERIFY(err, !IS_ERR_OR_NULL(sess->smmu.mapping = arm_iommu_create_mapping(&platform_bus_type, 0x80000000, 0x7fffffff, 0))); 0x80000000, 0x7fffffff))); if (err) goto bail; iommu_domain_set_attr(sess->smmu.mapping->domain, Loading drivers/media/platform/msm/camera_v2/smmu/cam_smmu_api.c +1 −2 Original line number Diff line number Diff line Loading @@ -803,7 +803,6 @@ static int cam_smmu_setup_cb(struct cam_context_bank_info *cb, struct device *dev) { int rc = 0; int order = 0; int disable_htw = 1; if (!cb || !dev) { Loading @@ -817,7 +816,7 @@ static int cam_smmu_setup_cb(struct cam_context_bank_info *cb, /* create a virtual mapping */ cb->mapping = arm_iommu_create_mapping(&platform_bus_type, cb->va_start, cb->va_len, order); cb->va_start, cb->va_len); if (IS_ERR(cb->mapping)) { pr_err("Error: create mapping Failed\n"); rc = -ENODEV; Loading drivers/media/platform/msm/vidc/msm_vidc_res_parse.c +1 −2 Original line number Diff line number Diff line Loading @@ -722,7 +722,6 @@ static int msm_vidc_setup_context_bank(struct context_bank_info *cb, struct device *dev) { int rc = 0; int order = 0; bool disable_htw = true; int secure_vmid = VMID_INVAL; Loading @@ -734,7 +733,7 @@ static int msm_vidc_setup_context_bank(struct context_bank_info *cb, cb->dev = dev; cb->mapping = arm_iommu_create_mapping(&platform_bus_type, cb->addr_range.start, cb->addr_range.size, order); cb->addr_range.start, cb->addr_range.size); if (IS_ERR_OR_NULL(cb->mapping)) { dprintk(VIDC_ERR, "%s - failed to create mapping\n", __func__); Loading Loading
arch/arm64/include/asm/dma-iommu.h +1 −3 Original line number Diff line number Diff line Loading @@ -15,7 +15,6 @@ struct dma_iommu_mapping { void *bitmap; size_t bits; unsigned int order; dma_addr_t base; spinlock_t lock; Loading @@ -25,8 +24,7 @@ struct dma_iommu_mapping { #ifdef CONFIG_ARM64_DMA_USE_IOMMU struct dma_iommu_mapping * arm_iommu_create_mapping(struct bus_type *bus, dma_addr_t base, size_t size, int order); arm_iommu_create_mapping(struct bus_type *bus, dma_addr_t base, size_t size); void arm_iommu_release_mapping(struct dma_iommu_mapping *mapping); Loading
arch/arm64/mm/dma-mapping.c +10 −18 Original line number Diff line number Diff line Loading @@ -644,11 +644,8 @@ static inline dma_addr_t __alloc_iova(struct dma_iommu_mapping *mapping, if (order > CONFIG_ARM64_DMA_IOMMU_ALIGNMENT) order = CONFIG_ARM64_DMA_IOMMU_ALIGNMENT; count = ((PAGE_ALIGN(size) >> PAGE_SHIFT) + (1 << mapping->order) - 1) >> mapping->order; if (order > mapping->order) align = (1 << (order - mapping->order)) - 1; count = PAGE_ALIGN(size) >> PAGE_SHIFT; align = (1 << order) - 1; spin_lock_irqsave(&mapping->lock, flags); start = bitmap_find_next_zero_area(mapping->bitmap, mapping->bits, 0, Loading @@ -661,16 +658,14 @@ static inline dma_addr_t __alloc_iova(struct dma_iommu_mapping *mapping, bitmap_set(mapping->bitmap, start, count); spin_unlock_irqrestore(&mapping->lock, flags); return mapping->base + (start << (mapping->order + PAGE_SHIFT)); return mapping->base + (start << PAGE_SHIFT); } static inline void __free_iova(struct dma_iommu_mapping *mapping, dma_addr_t addr, size_t size) { unsigned int start = (addr - mapping->base) >> (mapping->order + PAGE_SHIFT); unsigned int count = ((size >> PAGE_SHIFT) + (1 << mapping->order) - 1) >> mapping->order; unsigned int start = (addr - mapping->base) >> PAGE_SHIFT; unsigned int count = size >> PAGE_SHIFT; unsigned long flags; spin_lock_irqsave(&mapping->lock, flags); Loading Loading @@ -1492,8 +1487,7 @@ const struct dma_map_ops iommu_coherent_ops = { * 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: size of the valid IO address space * @order: accuracy of the IO addresses allocations * @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 Loading @@ -1503,15 +1497,14 @@ const struct dma_map_ops iommu_coherent_ops = { * arm_iommu_attach_device function. */ struct dma_iommu_mapping * arm_iommu_create_mapping(struct bus_type *bus, dma_addr_t base, size_t size, int order) arm_iommu_create_mapping(struct bus_type *bus, dma_addr_t base, size_t size) { unsigned int count = size >> (PAGE_SHIFT + order); unsigned int bitmap_size = BITS_TO_LONGS(count) * sizeof(long); unsigned int bits = size >> PAGE_SHIFT; unsigned int bitmap_size = BITS_TO_LONGS(bits) * sizeof(long); struct dma_iommu_mapping *mapping; int err = -ENOMEM; if (!count) if (!bitmap_size) return ERR_PTR(-EINVAL); mapping = kzalloc(sizeof(struct dma_iommu_mapping), GFP_KERNEL); Loading @@ -1524,7 +1517,6 @@ arm_iommu_create_mapping(struct bus_type *bus, dma_addr_t base, size_t size, mapping->base = base; mapping->bits = BITS_PER_BYTE * bitmap_size; mapping->order = order; spin_lock_init(&mapping->lock); mapping->domain = iommu_domain_alloc(bus); Loading
drivers/char/adsprpc.c +1 −1 Original line number Diff line number Diff line Loading @@ -1633,7 +1633,7 @@ static int fastrpc_cb_probe(struct device *dev) sess->smmu.cb = iommuspec.args[0]; VERIFY(err, !IS_ERR_OR_NULL(sess->smmu.mapping = arm_iommu_create_mapping(&platform_bus_type, 0x80000000, 0x7fffffff, 0))); 0x80000000, 0x7fffffff))); if (err) goto bail; iommu_domain_set_attr(sess->smmu.mapping->domain, Loading
drivers/media/platform/msm/camera_v2/smmu/cam_smmu_api.c +1 −2 Original line number Diff line number Diff line Loading @@ -803,7 +803,6 @@ static int cam_smmu_setup_cb(struct cam_context_bank_info *cb, struct device *dev) { int rc = 0; int order = 0; int disable_htw = 1; if (!cb || !dev) { Loading @@ -817,7 +816,7 @@ static int cam_smmu_setup_cb(struct cam_context_bank_info *cb, /* create a virtual mapping */ cb->mapping = arm_iommu_create_mapping(&platform_bus_type, cb->va_start, cb->va_len, order); cb->va_start, cb->va_len); if (IS_ERR(cb->mapping)) { pr_err("Error: create mapping Failed\n"); rc = -ENODEV; Loading
drivers/media/platform/msm/vidc/msm_vidc_res_parse.c +1 −2 Original line number Diff line number Diff line Loading @@ -722,7 +722,6 @@ static int msm_vidc_setup_context_bank(struct context_bank_info *cb, struct device *dev) { int rc = 0; int order = 0; bool disable_htw = true; int secure_vmid = VMID_INVAL; Loading @@ -734,7 +733,7 @@ static int msm_vidc_setup_context_bank(struct context_bank_info *cb, cb->dev = dev; cb->mapping = arm_iommu_create_mapping(&platform_bus_type, cb->addr_range.start, cb->addr_range.size, order); cb->addr_range.start, cb->addr_range.size); if (IS_ERR_OR_NULL(cb->mapping)) { dprintk(VIDC_ERR, "%s - failed to create mapping\n", __func__); Loading