Re: [PATCH] staging: comedi: use dma_mmap_coherent for DMA-able buffer mmap

2019-06-25 Thread Ian Abbott
On 25/06/2019 13:06, Christoph Hellwig wrote: From the DMA point of view this looks good: Reviewed-by: Christoph Hellwig Thanks! I still think that doing that SetPageReserved + remap_pfn_range dance for the normal memory allocations is a bad idea. Just use vm_insert_page on the page, in

Re: [PATCH] staging: comedi: use dma_mmap_coherent for DMA-able buffer mmap

2019-06-25 Thread Ian Abbott
On 25/06/2019 12:47, Dan Carpenter wrote: On Tue, Jun 25, 2019 at 12:26:59PM +0100, Ian Abbott wrote: drivers/staging/comedi/comedi_buf.c | 150 ++- drivers/staging/comedi/comedi_fops.c | 39 --- 2 files changed, 125 insertions(+), 64 deletions(-) diff --git

Re: [PATCH] staging: comedi: use dma_mmap_coherent for DMA-able buffer mmap

2019-06-25 Thread Dan Carpenter
On Tue, Jun 25, 2019 at 02:21:41PM +0100, Ian Abbott wrote: > On 25/06/2019 12:47, Dan Carpenter wrote: > > On Tue, Jun 25, 2019 at 12:26:59PM +0100, Ian Abbott wrote: > > > + } else { > > > + for (i = 0; i < bm->n_pages; i++) { > > > + buf =

Re: [PATCH] staging: comedi: use dma_mmap_coherent for DMA-able buffer mmap

2019-06-25 Thread Christoph Hellwig
>From the DMA point of view this looks good: Reviewed-by: Christoph Hellwig I still think that doing that SetPageReserved + remap_pfn_range dance for the normal memory allocations is a bad idea. Just use vm_insert_page on the page, in which case it doesn't need to be marked as Reserved. On

Re: [PATCH] staging: comedi: use dma_mmap_coherent for DMA-able buffer mmap

2019-06-25 Thread Dan Carpenter
On Tue, Jun 25, 2019 at 12:26:59PM +0100, Ian Abbott wrote: > drivers/staging/comedi/comedi_buf.c | 150 ++- > drivers/staging/comedi/comedi_fops.c | 39 --- > 2 files changed, 125 insertions(+), 64 deletions(-) > > diff --git a/drivers/staging/comedi/comedi_buf.c

[PATCH] staging: comedi: use dma_mmap_coherent for DMA-able buffer mmap

2019-06-25 Thread Ian Abbott
Comedi's acquisition buffer allocation code can allocate the buffer from normal kernel memory or from DMA coherent memory depending on the `dma_async_dir` value in the comedi subdevice. (A value of `DMA_NONE` causes the buffer to be allocated from normal kernel memory. Other values cause the