lkml.org 
[lkml]   [2020]   [Nov]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3 5/6] media: uvcvideo: Use dma_alloc_noncontiguos API
On (20/11/25 23:19), Ricardo Ribalda wrote:
[..]
> + if (uvc_urb->pages)
> + dma_sync_sgtable_for_device(stream_to_dmadev(uvc_urb->stream),
> + &uvc_urb->sgt, DMA_FROM_DEVICE);

[..]

> + if (uvc_urb->pages)
> + dma_sync_sgtable_for_cpu(stream_to_dmadev(stream),
> + &uvc_urb->sgt, DMA_FROM_DEVICE);

[..]

> + uvc_urb->pages = dma_alloc_noncontiguous(dma_dev, stream->urb_size,
> + &uvc_urb->dma,
> + gfp_flags | __GFP_NOWARN, 0);

Do we need to pass __GFP_NOWARN? It seems that

dma_alloc_noncontiguous()
__iommu_dma_alloc_noncontiguous()
__iommu_dma_alloc_pages()

does this internally.

> + if (!uvc_urb->pages)
> + return false;
> +
> + uvc_urb->buffer = vmap(uvc_urb->pages,
> + PAGE_ALIGN(stream->urb_size) >> PAGE_SHIFT,
> + VM_DMA_COHERENT, PAGE_KERNEL);

This is not related to Ricardo's patch, just a side note:

I think VM_DMA_COHERENT needs to be renamed. I found it a bit confusing
to see DMA_COHERENT mapping being dma_sync-ed. It turned out that the
flag has different meaning.

-ss

\
 
 \ /
  Last update: 2020-11-26 12:47    [W:0.117 / U:0.428 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site