Thread (12 messages) 12 messages, 3 authors, 2021-02-01

Re: [PATCH 6/6] media: uvcvideo: Use dma_alloc_noncontiguos API

From: Ricardo Ribalda <hidden>
Date: 2021-01-28 17:03:59
Also in: linux-iommu, linux-media, lkml

HI Christoph

Thanks for your comments

On Thu, Jan 28, 2021 at 4:09 PM Christoph Hellwig [off-list ref] wrote:
I just included this patch as-is, but here are a few comments:

On Thu, Jan 28, 2021 at 03:58:37PM +0100, Christoph Hellwig wrote:
quoted
+static void uvc_urb_dma_sync(struct uvc_urb *uvc_urb, bool for_device)
+{
+     struct device *dma_dev = dma_dev = stream_to_dmadev(uvc_urb->stream);
+
+     if (for_device)
+             dma_sync_sgtable_for_device(dma_dev, uvc_urb->sgt,
+                                         DMA_FROM_DEVICE);
+     else
+             dma_sync_sgtable_for_cpu(dma_dev, uvc_urb->sgt,
+                                      DMA_FROM_DEVICE);
+}
Given that we vmap the addresses this also needs
flush_kernel_vmap_range / invalidate_kernel_vmap_range calls for
VIVT architectures.
We only read from the device to the cpu. Then can we run only
invalidate_kernel_vmap_range() ?

something like ?
else {
          dma_sync_sgtable_for_cpu(dma_dev, uvc_urb->sgt, DMA_FROM_DEVICE);
           invalidate_kernel_vmap_range(uvc_urb->buffer,
uvc_urb->stream->urb_size );
}

Thanks!






--
Ricardo Ribalda
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help