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: Sergey Senozhatsky <senozhatsky@chromium.org> Acked-by: Marek Szyprowski <m.szyprowski@samsung.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
This commit is contained in:
parent
68d0c3311e
commit
553189144c
@ -132,12 +132,12 @@ static void vb2_dc_prepare(void *buf_priv)
|
||||
if (!buf->non_coherent_mem)
|
||||
return;
|
||||
|
||||
/* For both USERPTR and non-coherent MMAP */
|
||||
dma_sync_sgtable_for_device(buf->dev, sgt, buf->dma_dir);
|
||||
|
||||
/* Non-coherent MMAP only */
|
||||
if (buf->vaddr)
|
||||
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)
|
||||
@ -152,12 +152,12 @@ static void vb2_dc_finish(void *buf_priv)
|
||||
if (!buf->non_coherent_mem)
|
||||
return;
|
||||
|
||||
/* For both USERPTR and non-coherent MMAP */
|
||||
dma_sync_sgtable_for_cpu(buf->dev, sgt, buf->dma_dir);
|
||||
|
||||
/* Non-coherent MMAP only */
|
||||
if (buf->vaddr)
|
||||
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);
|
||||
}
|
||||
|
||||
/*********************************************/
|
||||
|
Loading…
Reference in New Issue
Block a user