Commit 55318914 authored by Sergey Senozhatsky's avatar Sergey Senozhatsky Committed by Mauro Carvalho Chehab

media: videobuf2-dma-contig: Invalidate vmap range before DMA range

Christoph suggests [1] that invalidating vmap range before
direct mapping range makes more sense.

[1]: https://lore.kernel.org/all/20220111085958.GA22795@lst.de/Signed-off-by: default avatarSergey Senozhatsky <senozhatsky@chromium.org>
Acked-by: default avatarMarek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
parent 68d0c331
...@@ -132,12 +132,12 @@ static void vb2_dc_prepare(void *buf_priv) ...@@ -132,12 +132,12 @@ static void vb2_dc_prepare(void *buf_priv)
if (!buf->non_coherent_mem) if (!buf->non_coherent_mem)
return; return;
/* For both USERPTR and non-coherent MMAP */
dma_sync_sgtable_for_device(buf->dev, sgt, buf->dma_dir);
/* Non-coherent MMAP only */ /* Non-coherent MMAP only */
if (buf->vaddr) if (buf->vaddr)
flush_kernel_vmap_range(buf->vaddr, buf->size); flush_kernel_vmap_range(buf->vaddr, buf->size);
/* For both USERPTR and non-coherent MMAP */
dma_sync_sgtable_for_device(buf->dev, sgt, buf->dma_dir);
} }
static void vb2_dc_finish(void *buf_priv) static void vb2_dc_finish(void *buf_priv)
...@@ -152,12 +152,12 @@ static void vb2_dc_finish(void *buf_priv) ...@@ -152,12 +152,12 @@ static void vb2_dc_finish(void *buf_priv)
if (!buf->non_coherent_mem) if (!buf->non_coherent_mem)
return; return;
/* For both USERPTR and non-coherent MMAP */
dma_sync_sgtable_for_cpu(buf->dev, sgt, buf->dma_dir);
/* Non-coherent MMAP only */ /* Non-coherent MMAP only */
if (buf->vaddr) if (buf->vaddr)
invalidate_kernel_vmap_range(buf->vaddr, buf->size); invalidate_kernel_vmap_range(buf->vaddr, buf->size);
/* For both USERPTR and non-coherent MMAP */
dma_sync_sgtable_for_cpu(buf->dev, sgt, buf->dma_dir);
} }
/*********************************************/ /*********************************************/
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment