[PATCH 2/5] dma-direct: add an explicit dma_direct_get_required_mask

2018-09-27 Thread Christoph Hellwig
This is somewhat modelled after the powerpc version, and differs from the legacy fallback in use fls64 instead of pointlessly splitting up the address into low and high dwords and in that it takes (__)phys_to_dma into account. Signed-off-by: Christoph Hellwig Acked-by: Benjamin Herrenschmidt

Re: [PATCH 2/5] dma-direct: add an explicit dma_direct_get_required_mask

2018-09-27 Thread Robin Murphy
On 27/09/18 16:28, Christoph Hellwig wrote: On Thu, Sep 27, 2018 at 03:12:25PM +0100, Robin Murphy wrote: +u64 dma_direct_get_required_mask(struct device *dev) +{ + u64 max_dma = phys_to_dma_direct(dev, (max_pfn - 1) << PAGE_SHIFT); + + return (1ULL << (fls64(max_dma) - 1)) * 2 - 1;

Re: [PATCH 2/5] dma-direct: add an explicit dma_direct_get_required_mask

2018-09-27 Thread Christoph Hellwig
On Thu, Sep 27, 2018 at 03:12:25PM +0100, Robin Murphy wrote: >> +u64 dma_direct_get_required_mask(struct device *dev) >> +{ >> +u64 max_dma = phys_to_dma_direct(dev, (max_pfn - 1) << PAGE_SHIFT); >> + >> +return (1ULL << (fls64(max_dma) - 1)) * 2 - 1; > > I think that may as well just use

Re: [PATCH 2/5] dma-direct: add an explicit dma_direct_get_required_mask

2018-09-27 Thread Robin Murphy
On 20/09/18 19:52, Christoph Hellwig wrote: This is somewhat modelled after the powerpc version, and differs from the legacy fallback in use fls64 instead of pointlessly splitting up the address into low and high dwords and in that it takes (__)phys_to_dma into account. Signed-off-by: Christoph

Re: [PATCH 2/5] dma-direct: add an explicit dma_direct_get_required_mask

2018-09-26 Thread Benjamin Herrenschmidt
On Thu, 2018-09-20 at 20:52 +0200, Christoph Hellwig wrote: > This is somewhat modelled after the powerpc version, and differs from > the legacy fallback in use fls64 instead of pointlessly splitting up the > address into low and high dwords and in that it takes (__)phys_to_dma > into account.

[PATCH 2/5] dma-direct: add an explicit dma_direct_get_required_mask

2018-09-20 Thread Christoph Hellwig
This is somewhat modelled after the powerpc version, and differs from the legacy fallback in use fls64 instead of pointlessly splitting up the address into low and high dwords and in that it takes (__)phys_to_dma into account. Signed-off-by: Christoph Hellwig --- include/linux/dma-direct.h | 1