media: videobuf2-dma-contig: Invalidate vmap range before DMA range
Subsystems (2)
PATCH 1/1 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/[email protected]/
Signed-off-by Sergey Senozhatsky <[email protected]>
--- .../media/common/videobuf2/videobuf2-dma-contig.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/media/common/videobuf2/videobuf2-dma-contig.c +6 -6
@@ -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); }/*********************************************/
Signature · 1 line
2.34.1.703.g22d0c6ccf7-goog
Quoted 5 lines · Sergey Senozhatsky
Christoph suggests [1] that invalidating vmap range before direct mapping range makes more sense.
[1]: https://lore.kernel.org/all/[email protected]/
Signed-off-by Sergey Senozhatsky <[email protected]>
Right.
Acked-by Marek Szyprowski <[email protected]>
Quoted 30 lines
--- .../media/common/videobuf2/videobuf2-dma-contig.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)drivers/media/common/videobuf2/videobuf2-dma-contig.c +3
-5@@ -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);
drivers/media/common/videobuf2/videobuf2-dma-contig.c static void vb2_dc_finish(void *buf_priv) · line 163
Quoted 10 lines
drivers/media/common/videobuf2/videobuf2-dma-contig.c +3
-1-/* 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); }/*********************************************/
Best regards
Signature · 2 lines
Marek Szyprowski, PhD Samsung R&D Institute Poland
Looks good:
Reviewed-by Christoph Hellwig <[email protected]>