From: Janghyuck Kim Date: Tue, 27 Feb 2018 09:24:10 +0000 (+0900) Subject: android: ion: free iova at buffer destruction time X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=f55d679d328c4ea4960d20f6d7648299fad0bba2;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git android: ion: free iova at buffer destruction time In order to optimize the performance of ion_iovmm_unmap(), the actual unmapping of the device virtual address is deferred. It is expected to work at buffer destruction time, but this is missing. So unmapping code is added to work properly. Change-Id: Ie2dffa58df5125baf4a4e9723db241846e860443 Signed-off-by: Janghyuck Kim --- diff --git a/drivers/staging/android/ion/ion_exynos.c b/drivers/staging/android/ion/ion_exynos.c index fafb9dae1500..efdbe3e9b4be 100644 --- a/drivers/staging/android/ion/ion_exynos.c +++ b/drivers/staging/android/ion/ion_exynos.c @@ -202,10 +202,18 @@ int exynos_ion_alloc_fixup(struct ion_device *idev, struct ion_buffer *buffer) void exynos_ion_free_fixup(struct ion_buffer *buffer) { struct sg_table *table = buffer->sg_table; + struct ion_iovm_map *iovm_map, *tmp; dma_unmap_sg_attrs(buffer->dev->dev.this_device, table->sgl, table->orig_nents, DMA_TO_DEVICE, DMA_ATTR_SKIP_CPU_SYNC); + + list_for_each_entry_safe(iovm_map, tmp, &buffer->iovas, list) { + iovmm_unmap(iovm_map->dev, iovm_map->iova); + list_del(&iovm_map->list); + kfree(iovm_map); + } + } struct sg_table *ion_exynos_map_dma_buf(struct dma_buf_attachment *attachment,