list_del(&mapping->obj_node);
}
- mapping->context = etnaviv_iommu_context_get(mmu_context);
mapping->use = 1;
ret = etnaviv_iommu_map_gem(mmu_context, etnaviv_obj,
mmu_context->global->memory_base,
mapping, va);
- if (ret < 0) {
- etnaviv_iommu_context_put(mmu_context);
+ if (ret < 0)
kfree(mapping);
- } else {
+ else
list_add_tail(&mapping->obj_node, &etnaviv_obj->vram_list);
- }
out:
mutex_unlock(&etnaviv_obj->lock);
WARN_ON(mapping->use);
- if (context) {
+ if (context)
etnaviv_iommu_unmap_gem(context, mapping);
- etnaviv_iommu_context_put(context);
- }
list_del(&mapping->obj_node);
kfree(mapping);
iova = sg_dma_address(sgt->sgl) - memory_base;
if (iova < 0x80000000 - sg_dma_len(sgt->sgl)) {
mapping->iova = iova;
+ mapping->context = etnaviv_iommu_context_get(context);
list_add_tail(&mapping->mmu_node, &context->mappings);
ret = 0;
goto unlock;
goto unlock;
}
+ mapping->context = etnaviv_iommu_context_get(context);
list_add_tail(&mapping->mmu_node, &context->mappings);
context->flush_seq++;
unlock:
list_del(&mapping->mmu_node);
context->flush_seq++;
mutex_unlock(&context->lock);
+ etnaviv_iommu_context_put(context);
}
static void etnaviv_iommu_context_free(struct kref *kref)