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

2021-01-27 Thread . Christoph Hellwig
On Wed, Jan 27, 2021 at 10:35:02PM +0100, Ricardo Ribalda wrote: > I have used the current API here: > > https://git.kernel.org/pub/scm/linux/kernel/git/ribalda/linux.git/log/?h=uvc-noncontiguous > > And I think the result is very clean. Great work! > > I have tested it in X86 and in arm64,

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

2021-01-27 Thread Ricardo Ribalda
Hi Christoph On Wed, Jan 27, 2021 at 4:56 PM . Christoph Hellwig wrote: > > On Wed, Jan 27, 2021 at 12:29:08AM +0100, Ricardo Ribalda wrote: > > - Is there any platform where dma_alloc_noncontiguos can fail? > > This is, !ops->alloc_noncontiguous and !dev->coherent_dma_mask > > If yes then we

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

2021-01-27 Thread . Christoph Hellwig
On Wed, Jan 27, 2021 at 12:29:08AM +0100, Ricardo Ribalda wrote: > - Is there any platform where dma_alloc_noncontiguos can fail? > This is, !ops->alloc_noncontiguous and !dev->coherent_dma_mask > If yes then we need to add a function to let the driver know in > advance that it has to use the

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

2021-01-26 Thread Ricardo Ribalda
Hi Christoph Thanks for the series! I have a couple of questions: - Is there any platform where dma_alloc_noncontiguos can fail? This is, !ops->alloc_noncontiguous and !dev->coherent_dma_mask If yes then we need to add a function to let the driver know in advance that it has to use the coherent

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

2021-01-26 Thread . Christoph Hellwig
Please take a quick look at this branch: http://git.infradead.org/users/hch/misc.git/shortlog/refs/heads/dma_alloc_noncontiguous Warning: hot off the press, and only with the v4l conversion as that seemed at little easier than uvcvideo. ___ iommu

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

2021-01-20 Thread . Christoph Hellwig
On Fri, Jan 15, 2021 at 02:08:14PM +0100, Ricardo Ribalda wrote: > > > Did you have time to look into this? > > > > > > No hurry, I just want to make sure that I didn't miss anything ;) > > > > Haven't managed to get to it, sorry. > > No worries!, is there something we can do to help you with

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

2021-01-15 Thread Ricardo Ribalda
On Mon, Jan 11, 2021 at 9:36 AM . Christoph Hellwig wrote: > > On Thu, Jan 07, 2021 at 03:14:08PM +0100, Ricardo Ribalda wrote: > > > So I think we do want these branches for coherent vs non-coherent as they > > > have very different semantics and I do not think that hiding them under > > > the

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

2021-01-11 Thread . Christoph Hellwig
On Thu, Jan 07, 2021 at 03:14:08PM +0100, Ricardo Ribalda wrote: > > So I think we do want these branches for coherent vs non-coherent as they > > have very different semantics and I do not think that hiding them under > > the same API helps people to understand those vastly different semantics. >

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

2021-01-07 Thread Ricardo Ribalda
Hi Christoph Happy new year! On Wed, Dec 9, 2020 at 12:16 PM . Christoph Hellwig wrote: > > On Tue, Dec 08, 2020 at 04:13:20PM +0900, Sergey Senozhatsky wrote: > > On (20/12/08 13:54), Tomasz Figa wrote: > > > > > > In any case, Sergey is going to share a preliminary patch on how the > > >

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

2020-12-09 Thread Sergey Senozhatsky via iommu
On Tue, Dec 8, 2020 at 1:54 PM Tomasz Figa wrote: > > In any case, Sergey is going to share a preliminary patch on how the > current API would be used in the V4L2 videobuf2 framework. That should > give us more input on how such a helper could look. > My current WIP (deep WIP) series can be

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

2020-12-09 Thread Robin Murphy
On 2020-12-09 11:12, Christoph Hellwig wrote: On Tue, Dec 08, 2020 at 01:54:00PM +0900, Tomasz Figa wrote: >From the media perspective, it would be good to have the vmap optional, similarly to the DMA_ATTR_NO_KERNEL_MAPPING attribute for coherent allocations. Actually, in the media drivers, the

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

2020-12-09 Thread Christoph Hellwig
On Tue, Dec 08, 2020 at 01:54:00PM +0900, Tomasz Figa wrote: > >From the media perspective, it would be good to have the vmap > optional, similarly to the DMA_ATTR_NO_KERNEL_MAPPING attribute for > coherent allocations. Actually, in the media drivers, the need to have > a kernel mapping of the DMA

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

2020-12-07 Thread Sergey Senozhatsky
On (20/12/08 13:54), Tomasz Figa wrote: > > In any case, Sergey is going to share a preliminary patch on how the > current API would be used in the V4L2 videobuf2 framework. That should > give us more input on how such a helper could look. HUGE apologies for the previous screw up! I replied in

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

2020-12-07 Thread Tomasz Figa
Hi Christoph, On Tue, Dec 1, 2020 at 11:49 PM Christoph Hellwig wrote: > > On Tue, Dec 01, 2020 at 12:36:58PM +0900, Sergey Senozhatsky wrote: > > Not that I have any sound experience in this area, but the helper > > probably won't hurt. Do you also plan to add vmap() to that helper > > or

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

2020-12-01 Thread Christoph Hellwig
On Tue, Dec 01, 2020 at 12:36:58PM +0900, Sergey Senozhatsky wrote: > Not that I have any sound experience in this area, but the helper > probably won't hurt. Do you also plan to add vmap() to that helper > or dma_alloc_noncontiguous()/sg_alloc_table_from_pages() only? Yes, I think adding the

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

2020-11-30 Thread Sergey Senozhatsky
On (20/11/30 09:34), Christoph Hellwig wrote: > > > + uvc_urb->pages = dma_alloc_noncontiguous(dma_dev, stream->urb_size, > > +_urb->dma, > > +gfp_flags | __GFP_NOWARN, 0); > > + if (!uvc_urb->pages) > > +

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

2020-11-30 Thread Ricardo Ribalda
Hi Christoph On Mon, Nov 30, 2020 at 9:34 AM Christoph Hellwig wrote: > > > +#ifndef CONFIG_DMA_NONCOHERENT > > I think you need to drop this ifdef. This code should work just fine > on noncoherent mips and sh platforms. > > > + uvc_urb->pages = dma_alloc_noncontiguous(dma_dev,

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

2020-11-30 Thread Christoph Hellwig
> +#ifndef CONFIG_DMA_NONCOHERENT I think you need to drop this ifdef. This code should work just fine on noncoherent mips and sh platforms. > + uvc_urb->pages = dma_alloc_noncontiguous(dma_dev, stream->urb_size, > + _urb->dma, > +

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

2020-11-30 Thread Christoph Hellwig
On Thu, Nov 26, 2020 at 08:44:50PM +0900, Sergey Senozhatsky wrote: > > + 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,

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

2020-11-26 Thread Sergey Senozhatsky
On (20/11/25 23:19), Ricardo Ribalda wrote: [..] > + if (uvc_urb->pages) > + dma_sync_sgtable_for_device(stream_to_dmadev(uvc_urb->stream), > + _urb->sgt, DMA_FROM_DEVICE); [..] > + if (uvc_urb->pages) > +