Re: [PATCH kernel v2 1/2] dma: Allow mixing bypass and normal IOMMU operation

2020-10-28 Thread Alexey Kardashevskiy
On 29/10/2020 04:21, Christoph Hellwig wrote: On Wed, Oct 28, 2020 at 05:55:23PM +1100, Alexey Kardashevskiy wrote: It is passing an address of the end of the mapped area so passing a page struct means passing page and offset which is an extra parameter and we do not want to do anything

Re: [PATCH kernel v2 1/2] dma: Allow mixing bypass and normal IOMMU operation

2020-10-28 Thread Christoph Hellwig
On Wed, Oct 28, 2020 at 05:55:23PM +1100, Alexey Kardashevskiy wrote: > > It is passing an address of the end of the mapped area so passing a page > struct means passing page and offset which is an extra parameter and we do > not want to do anything with the page in those hooks anyway so I'd

Re: [PATCH kernel v2 1/2] dma: Allow mixing bypass and normal IOMMU operation

2020-10-28 Thread Alexey Kardashevskiy
On 28/10/2020 03:48, Christoph Hellwig wrote: +static inline bool dma_handle_direct(struct device *dev, dma_addr_t dma_handle) +{ + return dma_handle >= dev->archdata.dma_offset; +} This won't compile except for powerpc, and directly accesing arch members in common code is a bad idea.

Re: [PATCH kernel v2 1/2] dma: Allow mixing bypass and normal IOMMU operation

2020-10-27 Thread Christoph Hellwig
> +static inline bool dma_handle_direct(struct device *dev, dma_addr_t > dma_handle) > +{ > + return dma_handle >= dev->archdata.dma_offset; > +} This won't compile except for powerpc, and directly accesing arch members in common code is a bad idea. Maybe both your helpers need to be

[PATCH kernel v2 1/2] dma: Allow mixing bypass and normal IOMMU operation

2020-10-27 Thread Alexey Kardashevskiy
At the moment we allow bypassing DMA ops only when we can do this for the entire RAM. However there are configs with mixed type memory where we could still allow bypassing IOMMU in most cases; POWERPC with persistent memory is one example. This adds another check for the bus limit to determine