Re: [PATCH] dma-mapping: fix page attributes for dma_mmap_*

2019-08-06 Thread Christoph Hellwig
On Tue, Aug 06, 2019 at 05:45:03PM +0100, Russell King - ARM Linux admin wrote: > We could have used a different approach, making all IO writes contain > a "drain write buffer" instruction, and map DMA memory as "buffered", > but as there were no Linux barriers defined to order memory accesses > to

Re: [PATCH] dma-mapping: fix page attributes for dma_mmap_*

2019-08-06 Thread Russell King - ARM Linux admin
On Tue, Aug 06, 2019 at 05:45:03PM +0100, Russell King - ARM Linux admin wrote: > On Tue, Aug 06, 2019 at 05:08:54PM +0100, Will Deacon wrote: > > On Sat, Aug 03, 2019 at 08:48:12AM +0200, Christoph Hellwig wrote: > > > On Fri, Aug 02, 2019 at 11:38:03AM +0100, Will Deacon wrote: > > > > > > > > S

Re: [PATCH] dma-mapping: fix page attributes for dma_mmap_*

2019-08-06 Thread Russell King - ARM Linux admin
On Tue, Aug 06, 2019 at 05:08:54PM +0100, Will Deacon wrote: > On Sat, Aug 03, 2019 at 08:48:12AM +0200, Christoph Hellwig wrote: > > On Fri, Aug 02, 2019 at 11:38:03AM +0100, Will Deacon wrote: > > > > > > So this boils down to a terminology mismatch. The Arm architecture > > > doesn't have > >

Re: [PATCH] dma-mapping: fix page attributes for dma_mmap_*

2019-08-06 Thread Will Deacon
On Sat, Aug 03, 2019 at 08:48:12AM +0200, Christoph Hellwig wrote: > On Fri, Aug 02, 2019 at 11:38:03AM +0100, Will Deacon wrote: > > > > So this boils down to a terminology mismatch. The Arm architecture doesn't > > have > > anything called "write combine", so in Linux we instead provide what th

Re: [PATCH] dma-mapping: fix page attributes for dma_mmap_*

2019-08-02 Thread Christoph Hellwig
On Fri, Aug 02, 2019 at 11:38:03AM +0100, Will Deacon wrote: > > So this boils down to a terminology mismatch. The Arm architecture doesn't > have > anything called "write combine", so in Linux we instead provide what the Arm > architecture calls "Normal non-cacheable" memory for pgprot_writecomb

Re: [PATCH] dma-mapping: fix page attributes for dma_mmap_*

2019-08-02 Thread Will Deacon
On Fri, Aug 02, 2019 at 10:14:41AM +0200, Christoph Hellwig wrote: > On Thu, Aug 01, 2019 at 05:44:12PM +0100, Will Deacon wrote: > > > > Although arch_dma_mmap_pgprot() is a bit of a misnomer now that it only > > > > gets involved in the non-coherent case. > > > > > > A better name is welcome. >

Re: [PATCH] dma-mapping: fix page attributes for dma_mmap_*

2019-08-02 Thread Christoph Hellwig
On Thu, Aug 01, 2019 at 05:44:12PM +0100, Will Deacon wrote: > > > Although arch_dma_mmap_pgprot() is a bit of a misnomer now that it only > > > gets involved in the non-coherent case. > > > > A better name is welcome. > > How about arch_dma_noncoherent_mmap_pgprot() ? Too long? Sounds a little

Re: [PATCH] dma-mapping: fix page attributes for dma_mmap_*

2019-08-01 Thread Will Deacon
On Thu, Aug 01, 2019 at 06:34:57PM +0200, Christoph Hellwig wrote: > On Thu, Aug 01, 2019 at 05:23:06PM +0100, Will Deacon wrote: > > > - if (!dev_is_dma_coherent(dev) || (attrs & DMA_ATTR_WRITE_COMBINE)) > > > - return pgprot_writecombine(prot); > > > - return prot; > > > + return pgprot_w

Re: [PATCH] dma-mapping: fix page attributes for dma_mmap_*

2019-08-01 Thread Christoph Hellwig
On Thu, Aug 01, 2019 at 05:23:06PM +0100, Will Deacon wrote: > > - if (!dev_is_dma_coherent(dev) || (attrs & DMA_ATTR_WRITE_COMBINE)) > > - return pgprot_writecombine(prot); > > - return prot; > > + return pgprot_writecombine(prot); > > } > > Seems like a sensible cleanup to me: >

Re: [PATCH] dma-mapping: fix page attributes for dma_mmap_*

2019-08-01 Thread Will Deacon
On Thu, Aug 01, 2019 at 05:21:18PM +0300, Christoph Hellwig wrote: > All the way back to introducing dma_common_mmap we've defaulyed to mark > the pages as uncached. But this is wrong for DMA coherent devices or > if using DMA_ATTR_NON_CONSISTENT. Later on DMA_ATTR_WRITE_COMBINE > also got incorr

[PATCH] dma-mapping: fix page attributes for dma_mmap_*

2019-08-01 Thread Christoph Hellwig
All the way back to introducing dma_common_mmap we've defaulyed to mark the pages as uncached. But this is wrong for DMA coherent devices or if using DMA_ATTR_NON_CONSISTENT. Later on DMA_ATTR_WRITE_COMBINE also got incorrect treatment as that flag is only treated special on the alloc side for no