This is an automatic generated email to let you know that the following patch 
were queued:

Subject: media: videobuf2-dma-contig: Invalidate vmap range before DMA range
Author:  Sergey Senozhatsky <[email protected]>
Date:    Wed Jan 19 09:14:17 2022 +0100

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]>
Acked-by: Marek Szyprowski <[email protected]>
Reviewed-by: Christoph Hellwig <[email protected]>
Signed-off-by: Hans Verkuil <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>

 drivers/media/common/videobuf2/videobuf2-dma-contig.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

---

diff --git a/drivers/media/common/videobuf2/videobuf2-dma-contig.c 
b/drivers/media/common/videobuf2/videobuf2-dma-contig.c
index 7c4096e62173..0e3f264122af 100644
--- a/drivers/media/common/videobuf2/videobuf2-dma-contig.c
+++ b/drivers/media/common/videobuf2/videobuf2-dma-contig.c
@@ -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);
 }
 
 /*********************************************/

_______________________________________________
linuxtv-commits mailing list
[email protected]
https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

Reply via email to