diff mbox

[14/15] ppc64 iommu: use coherent_dma_mask for alloc_coherent

Message ID 1284573958-8397-15-git-send-email-nacc@us.ibm.com (mailing list archive)
State Superseded
Delegated to: Benjamin Herrenschmidt
Headers show

Commit Message

Nishanth Aravamudan Sept. 15, 2010, 6:05 p.m. UTC
The IOMMU code has been passing the dma-mask instead of the
coherent_dma_mask to the iommu allocator.  Coherent allocations should
be made using the coherent_dma_mask.

Signed-off-by: Milton Miller <miltonm@bga.com>
Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
---
We currently don't check the mask other than to warn when its being set,
so I don't think this is stable material.
---
 arch/powerpc/kernel/dma-iommu.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Comments

Benjamin Herrenschmidt Nov. 29, 2010, 12:58 a.m. UTC | #1
On Wed, 2010-09-15 at 11:05 -0700, Nishanth Aravamudan wrote:
> The IOMMU code has been passing the dma-mask instead of the
> coherent_dma_mask to the iommu allocator.  Coherent allocations should
> be made using the coherent_dma_mask.

Won't that break macio devices too ? afaik, they don't set
coherent_dma_mask. Have you tried booting on a G5 with iommu enabled ?

(It may not be broken, just asking...)

Cheers,
Ben.

> Signed-off-by: Milton Miller <miltonm@bga.com>
> Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
> ---
> We currently don't check the mask other than to warn when its being set,
> so I don't think this is stable material.
> ---
>  arch/powerpc/kernel/dma-iommu.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/powerpc/kernel/dma-iommu.c b/arch/powerpc/kernel/dma-iommu.c
> index 6e54a0f..e755415 100644
> --- a/arch/powerpc/kernel/dma-iommu.c
> +++ b/arch/powerpc/kernel/dma-iommu.c
> @@ -19,7 +19,7 @@ static void *dma_iommu_alloc_coherent(struct device *dev, size_t size,
>  				      dma_addr_t *dma_handle, gfp_t flag)
>  {
>  	return iommu_alloc_coherent(dev, get_iommu_table_base(dev), size,
> -				    dma_handle, device_to_mask(dev), flag,
> +				    dma_handle, dev->coherent_dma_mask, flag,
>  				    dev_to_node(dev));
>  }
>
Nishanth Aravamudan Dec. 1, 2010, 12:31 a.m. UTC | #2
On 29.11.2010 [11:58:16 +1100], Benjamin Herrenschmidt wrote:
> On Wed, 2010-09-15 at 11:05 -0700, Nishanth Aravamudan wrote:
> > The IOMMU code has been passing the dma-mask instead of the
> > coherent_dma_mask to the iommu allocator.  Coherent allocations should
> > be made using the coherent_dma_mask.
> 
> Won't that break macio devices too ? afaik, they don't set
> coherent_dma_mask. Have you tried booting on a G5 with iommu enabled ?
> 
> (It may not be broken, just asking...)

I have not tried this. I unfortunately do not have immediate access to a
G5 to test on, but will ask around.

Thanks,
Nish
diff mbox

Patch

diff --git a/arch/powerpc/kernel/dma-iommu.c b/arch/powerpc/kernel/dma-iommu.c
index 6e54a0f..e755415 100644
--- a/arch/powerpc/kernel/dma-iommu.c
+++ b/arch/powerpc/kernel/dma-iommu.c
@@ -19,7 +19,7 @@  static void *dma_iommu_alloc_coherent(struct device *dev, size_t size,
 				      dma_addr_t *dma_handle, gfp_t flag)
 {
 	return iommu_alloc_coherent(dev, get_iommu_table_base(dev), size,
-				    dma_handle, device_to_mask(dev), flag,
+				    dma_handle, dev->coherent_dma_mask, flag,
 				    dev_to_node(dev));
 }