All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] powerpc: remove device_to_mask
@ 2019-06-29  8:03 Christoph Hellwig
  2019-07-01  3:06 ` Alexey Kardashevskiy
  2019-07-04 15:52 ` Michael Ellerman
  0 siblings, 2 replies; 4+ messages in thread
From: Christoph Hellwig @ 2019-06-29  8:03 UTC (permalink / raw)
  To: paulus, mpe; +Cc: linuxppc-dev

Use the dma_get_mask helper from dma-mapping.h instead.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/powerpc/include/asm/iommu.h     | 8 --------
 arch/powerpc/kernel/dma-iommu.c      | 4 ++--
 arch/powerpc/platforms/pseries/vio.c | 4 ++--
 3 files changed, 4 insertions(+), 12 deletions(-)

diff --git a/arch/powerpc/include/asm/iommu.h b/arch/powerpc/include/asm/iommu.h
index 0ac52392ed99..f98f2864b66a 100644
--- a/arch/powerpc/include/asm/iommu.h
+++ b/arch/powerpc/include/asm/iommu.h
@@ -327,13 +327,5 @@ extern bool iommu_fixed_is_weak;
 
 extern const struct dma_map_ops dma_iommu_ops;
 
-static inline unsigned long device_to_mask(struct device *dev)
-{
-	if (dev->dma_mask && *dev->dma_mask)
-		return *dev->dma_mask;
-	/* Assume devices without mask can take 32 bit addresses */
-	return 0xfffffffful;
-}
-
 #endif /* __KERNEL__ */
 #endif /* _ASM_IOMMU_H */
diff --git a/arch/powerpc/kernel/dma-iommu.c b/arch/powerpc/kernel/dma-iommu.c
index 09231ef06d01..168af3a5b4b1 100644
--- a/arch/powerpc/kernel/dma-iommu.c
+++ b/arch/powerpc/kernel/dma-iommu.c
@@ -71,7 +71,7 @@ static dma_addr_t dma_iommu_map_page(struct device *dev, struct page *page,
 		return dma_direct_map_page(dev, page, offset, size, direction,
 				attrs);
 	return iommu_map_page(dev, get_iommu_table_base(dev), page, offset,
-			      size, device_to_mask(dev), direction, attrs);
+			      size, dma_get_mask(dev), direction, attrs);
 }
 
 
@@ -92,7 +92,7 @@ static int dma_iommu_map_sg(struct device *dev, struct scatterlist *sglist,
 	if (dma_iommu_map_bypass(dev, attrs))
 		return dma_direct_map_sg(dev, sglist, nelems, direction, attrs);
 	return ppc_iommu_map_sg(dev, get_iommu_table_base(dev), sglist, nelems,
-				device_to_mask(dev), direction, attrs);
+				dma_get_mask(dev), direction, attrs);
 }
 
 static void dma_iommu_unmap_sg(struct device *dev, struct scatterlist *sglist,
diff --git a/arch/powerpc/platforms/pseries/vio.c b/arch/powerpc/platforms/pseries/vio.c
index 141795275ccb..97c0e3e5eae5 100644
--- a/arch/powerpc/platforms/pseries/vio.c
+++ b/arch/powerpc/platforms/pseries/vio.c
@@ -524,7 +524,7 @@ static dma_addr_t vio_dma_iommu_map_page(struct device *dev, struct page *page,
 
 	if (vio_cmo_alloc(viodev, roundup(size, IOMMU_PAGE_SIZE(tbl))))
 		goto out_fail;
-	ret = iommu_map_page(dev, tbl, page, offset, size, device_to_mask(dev),
+	ret = iommu_map_page(dev, tbl, page, offset, size, dma_get_mask(dev),
 			direction, attrs);
 	if (unlikely(ret == DMA_MAPPING_ERROR))
 		goto out_deallocate;
@@ -564,7 +564,7 @@ static int vio_dma_iommu_map_sg(struct device *dev, struct scatterlist *sglist,
 
 	if (vio_cmo_alloc(viodev, alloc_size))
 		goto out_fail;
-	ret = ppc_iommu_map_sg(dev, tbl, sglist, nelems, device_to_mask(dev),
+	ret = ppc_iommu_map_sg(dev, tbl, sglist, nelems, dma_get_mask(dev),
 			direction, attrs);
 	if (unlikely(!ret))
 		goto out_deallocate;
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] powerpc: remove device_to_mask
  2019-06-29  8:03 [PATCH] powerpc: remove device_to_mask Christoph Hellwig
@ 2019-07-01  3:06 ` Alexey Kardashevskiy
  2019-07-01  8:52   ` Michael Ellerman
  2019-07-04 15:52 ` Michael Ellerman
  1 sibling, 1 reply; 4+ messages in thread
From: Alexey Kardashevskiy @ 2019-07-01  3:06 UTC (permalink / raw)
  To: Christoph Hellwig, paulus, mpe; +Cc: linuxppc-dev



On 29/06/2019 18:03, Christoph Hellwig wrote:
> Use the dma_get_mask helper from dma-mapping.h instead.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>



Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>



> ---
>  arch/powerpc/include/asm/iommu.h     | 8 --------
>  arch/powerpc/kernel/dma-iommu.c      | 4 ++--
>  arch/powerpc/platforms/pseries/vio.c | 4 ++--
>  3 files changed, 4 insertions(+), 12 deletions(-)
> 
> diff --git a/arch/powerpc/include/asm/iommu.h b/arch/powerpc/include/asm/iommu.h
> index 0ac52392ed99..f98f2864b66a 100644
> --- a/arch/powerpc/include/asm/iommu.h
> +++ b/arch/powerpc/include/asm/iommu.h
> @@ -327,13 +327,5 @@ extern bool iommu_fixed_is_weak;
>  
>  extern const struct dma_map_ops dma_iommu_ops;
>  
> -static inline unsigned long device_to_mask(struct device *dev)
> -{
> -	if (dev->dma_mask && *dev->dma_mask)
> -		return *dev->dma_mask;
> -	/* Assume devices without mask can take 32 bit addresses */
> -	return 0xfffffffful;
> -}
> -
>  #endif /* __KERNEL__ */
>  #endif /* _ASM_IOMMU_H */
> diff --git a/arch/powerpc/kernel/dma-iommu.c b/arch/powerpc/kernel/dma-iommu.c
> index 09231ef06d01..168af3a5b4b1 100644
> --- a/arch/powerpc/kernel/dma-iommu.c
> +++ b/arch/powerpc/kernel/dma-iommu.c
> @@ -71,7 +71,7 @@ static dma_addr_t dma_iommu_map_page(struct device *dev, struct page *page,
>  		return dma_direct_map_page(dev, page, offset, size, direction,
>  				attrs);
>  	return iommu_map_page(dev, get_iommu_table_base(dev), page, offset,
> -			      size, device_to_mask(dev), direction, attrs);
> +			      size, dma_get_mask(dev), direction, attrs);
>  }
>  
>  
> @@ -92,7 +92,7 @@ static int dma_iommu_map_sg(struct device *dev, struct scatterlist *sglist,
>  	if (dma_iommu_map_bypass(dev, attrs))
>  		return dma_direct_map_sg(dev, sglist, nelems, direction, attrs);
>  	return ppc_iommu_map_sg(dev, get_iommu_table_base(dev), sglist, nelems,
> -				device_to_mask(dev), direction, attrs);
> +				dma_get_mask(dev), direction, attrs);
>  }
>  
>  static void dma_iommu_unmap_sg(struct device *dev, struct scatterlist *sglist,
> diff --git a/arch/powerpc/platforms/pseries/vio.c b/arch/powerpc/platforms/pseries/vio.c
> index 141795275ccb..97c0e3e5eae5 100644
> --- a/arch/powerpc/platforms/pseries/vio.c
> +++ b/arch/powerpc/platforms/pseries/vio.c
> @@ -524,7 +524,7 @@ static dma_addr_t vio_dma_iommu_map_page(struct device *dev, struct page *page,
>  
>  	if (vio_cmo_alloc(viodev, roundup(size, IOMMU_PAGE_SIZE(tbl))))
>  		goto out_fail;
> -	ret = iommu_map_page(dev, tbl, page, offset, size, device_to_mask(dev),
> +	ret = iommu_map_page(dev, tbl, page, offset, size, dma_get_mask(dev),
>  			direction, attrs);
>  	if (unlikely(ret == DMA_MAPPING_ERROR))
>  		goto out_deallocate;
> @@ -564,7 +564,7 @@ static int vio_dma_iommu_map_sg(struct device *dev, struct scatterlist *sglist,
>  
>  	if (vio_cmo_alloc(viodev, alloc_size))
>  		goto out_fail;
> -	ret = ppc_iommu_map_sg(dev, tbl, sglist, nelems, device_to_mask(dev),
> +	ret = ppc_iommu_map_sg(dev, tbl, sglist, nelems, dma_get_mask(dev),
>  			direction, attrs);
>  	if (unlikely(!ret))
>  		goto out_deallocate;
> 

-- 
Alexey

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] powerpc: remove device_to_mask
  2019-07-01  3:06 ` Alexey Kardashevskiy
@ 2019-07-01  8:52   ` Michael Ellerman
  0 siblings, 0 replies; 4+ messages in thread
From: Michael Ellerman @ 2019-07-01  8:52 UTC (permalink / raw)
  To: Alexey Kardashevskiy, Christoph Hellwig, paulus; +Cc: linuxppc-dev

Alexey Kardashevskiy <aik@ozlabs.ru> writes:
> On 29/06/2019 18:03, Christoph Hellwig wrote:
>> Use the dma_get_mask helper from dma-mapping.h instead.
>> 
>> Signed-off-by: Christoph Hellwig <hch@lst.de>
>
> Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>

I'll add to the change log "because they are functionally identical."

cheers

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] powerpc: remove device_to_mask
  2019-06-29  8:03 [PATCH] powerpc: remove device_to_mask Christoph Hellwig
  2019-07-01  3:06 ` Alexey Kardashevskiy
@ 2019-07-04 15:52 ` Michael Ellerman
  1 sibling, 0 replies; 4+ messages in thread
From: Michael Ellerman @ 2019-07-04 15:52 UTC (permalink / raw)
  To: Christoph Hellwig, paulus; +Cc: linuxppc-dev

On Sat, 2019-06-29 at 08:03:59 UTC, Christoph Hellwig wrote:
> Use the dma_get_mask helper from dma-mapping.h instead.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/24911acd64cee411c9e626d3d0ca0733805b009b

cheers

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-07-04 16:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-29  8:03 [PATCH] powerpc: remove device_to_mask Christoph Hellwig
2019-07-01  3:06 ` Alexey Kardashevskiy
2019-07-01  8:52   ` Michael Ellerman
2019-07-04 15:52 ` Michael Ellerman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.