Re: [PATCH v2 13/29] nios2: DMA mapping API

2014-07-30 Thread James Bottomley
On Tue, 2014-07-15 at 11:38 +0200, Arnd Bergmann wrote: > More importantly: you do the same operation for both _for_cpu and _for_device. > I assume your CPU can never do speculative cache prefetches, so it's not > incorrect, but you do twice the number of invalidations and flushes that > you need.

Re: [PATCH v2 13/29] nios2: DMA mapping API

2014-07-29 Thread Ley Foon Tan
On Thu, Jul 24, 2014 at 8:05 PM, Arnd Bergmann wrote: >> I have spent some times look at other architectures and below is what >> I found. Please correct me if I am wrong, especially >> for_device():DMA_FROM_DEVICE. >> >> _for_cpu(): >> case DMA_BIDIRECTIONAL: >> case DMA_FROM_DEVICE: >> /* i

Re: [PATCH v2 13/29] nios2: DMA mapping API

2014-07-28 Thread rkuo
On Thu, Jul 24, 2014 at 02:05:16PM +0200, Arnd Bergmann wrote: > > >> +void dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle, > > >> + size_t size, enum dma_data_direction > > >> direction) > > >> +{ > > >> + BUG_ON(!valid_dma_direction(direction)); >

Re: [PATCH v2 13/29] nios2: DMA mapping API

2014-07-24 Thread Arnd Bergmann
On Thursday 24 July 2014 19:37:11 Ley Foon Tan wrote: > On Tue, Jul 15, 2014 at 5:38 PM, Arnd Bergmann wrote: > > On Tuesday 15 July 2014 16:45:40 Ley Foon Tan wrote: > >> +#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f) > >> +#define dma_free_noncoherent(d, s, v, h) dma_f

Re: [PATCH v2 13/29] nios2: DMA mapping API

2014-07-24 Thread Ley Foon Tan
On Tue, Jul 15, 2014 at 5:38 PM, Arnd Bergmann wrote: > On Tuesday 15 July 2014 16:45:40 Ley Foon Tan wrote: > >> +static inline void __dma_sync(void *vaddr, size_t size, >> + enum dma_data_direction direction) >> +{ >> + switch (direction) { >> + case DMA_FROM_DE

Re: [PATCH v2 13/29] nios2: DMA mapping API

2014-07-15 Thread Arnd Bergmann
On Tuesday 15 July 2014 16:45:40 Ley Foon Tan wrote: > +static inline void __dma_sync(void *vaddr, size_t size, > + enum dma_data_direction direction) > +{ > + switch (direction) { > + case DMA_FROM_DEVICE: /* invalidate cache */ > + invalidate_dcach

[PATCH v2 13/29] nios2: DMA mapping API

2014-07-15 Thread Ley Foon Tan
This patch adds support for the DMA mapping API. Signed-off-by: Ley Foon Tan --- arch/nios2/include/asm/dma-mapping.h | 106 arch/nios2/mm/dma-mapping.c | 186 +++ 2 files changed, 292 insertions(+) create mode 100644 arch/nios2/incl