* [PATCH] media: videobuf2-dma-contig: Invalidate vmap range before DMA range
@ 2022-01-19 8:14 ` Sergey Senozhatsky
2022-01-19 8:32 ` Marek Szyprowski
2022-01-20 7:50 ` Christoph Hellwig
0 siblings, 2 replies; 3+ messages in thread
From: Sergey Senozhatsky @ 2022-01-19 8:14 UTC (permalink / raw)
To: Tomasz Figa, Marek Szyprowski, Hans Verkuil
Cc: Christoph Hellwig, Dafna Hirschfeld, Ricardo Ribalda, linux-media,
linux-kernel, Sergey Senozhatsky
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>
---
.../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);
}
/*********************************************/
--
2.34.1.703.g22d0c6ccf7-goog
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] media: videobuf2-dma-contig: Invalidate vmap range before DMA range
2022-01-19 8:14 ` [PATCH] media: videobuf2-dma-contig: Invalidate vmap range before DMA range Sergey Senozhatsky
@ 2022-01-19 8:32 ` Marek Szyprowski
2022-01-20 7:50 ` Christoph Hellwig
1 sibling, 0 replies; 3+ messages in thread
From: Marek Szyprowski @ 2022-01-19 8:32 UTC (permalink / raw)
To: Sergey Senozhatsky, Tomasz Figa, Hans Verkuil
Cc: Christoph Hellwig, Dafna Hirschfeld, Ricardo Ribalda, linux-media,
linux-kernel
On 19.01.2022 09:14, Sergey Senozhatsky wrote:
> 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>
Right.
Acked-by: Marek Szyprowski <m.szyprowski@samsung.com>
> ---
> .../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);
> }
>
> /*********************************************/
Best regards
--
Marek Szyprowski, PhD
Samsung R&D Institute Poland
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] media: videobuf2-dma-contig: Invalidate vmap range before DMA range
2022-01-19 8:14 ` [PATCH] media: videobuf2-dma-contig: Invalidate vmap range before DMA range Sergey Senozhatsky
2022-01-19 8:32 ` Marek Szyprowski
@ 2022-01-20 7:50 ` Christoph Hellwig
1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2022-01-20 7:50 UTC (permalink / raw)
To: Sergey Senozhatsky
Cc: Tomasz Figa, Marek Szyprowski, Hans Verkuil, Christoph Hellwig,
Dafna Hirschfeld, Ricardo Ribalda, linux-media, linux-kernel
Looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-01-20 7:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <CGME20220119081426eucas1p14b7ae75dfefd3a268fc7d5b4e5d84eb2@eucas1p1.samsung.com>
2022-01-19 8:14 ` [PATCH] media: videobuf2-dma-contig: Invalidate vmap range before DMA range Sergey Senozhatsky
2022-01-19 8:32 ` Marek Szyprowski
2022-01-20 7:50 ` Christoph Hellwig
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).