Re: [PATCH 2/3] dma: Introduce dma_max_mapping_size()

2019-01-16 Thread Christoph Hellwig
On Tue, Jan 15, 2019 at 05:23:22PM +0100, Joerg Roedel wrote: > Right, I thought about that too, but didn't find a generic way to check > for all the cases. There are various checks that could be done: > > 1) Check if SWIOTLB is initialized at all, if not, return > SIZE_MAX as the l

Re: [PATCH 2/3] dma: Introduce dma_max_mapping_size()

2019-01-16 Thread Joerg Roedel
On Tue, Jan 15, 2019 at 02:37:54PM +0100, Christoph Hellwig wrote: > > +size_t dma_direct_max_mapping_size(struct device *dev) > > +{ > > + /* > > +* Return the minimum of the direct DMA limit and the SWIOTLB limit. > > +* Since direct DMA has no limit, it is fine to just return the SWIOT

[PATCH 2/3] dma: Introduce dma_max_mapping_size()

2019-01-16 Thread Joerg Roedel
From: Joerg Roedel The function returns the maximum size that can be mapped using DMA-API functions. The patch also adds the implementation for direct DMA and a new dma_map_ops pointer so that other implementations can expose their limit. Signed-off-by: Joerg Roedel --- include/linux/dma-mappi

Re: [PATCH 2/3] dma: Introduce dma_max_mapping_size()

2019-01-16 Thread Christoph Hellwig
> +size_t dma_direct_max_mapping_size(struct device *dev) > +{ > + /* > + * Return the minimum of the direct DMA limit and the SWIOTLB limit. > + * Since direct DMA has no limit, it is fine to just return the SWIOTLB > + * limit. > + */ > + return swiotlb_max_mapping_siz