Re: [PATCH 2/2] x86 amd_gart_64: Verify we can perform theremapping requested

From: Joerg Roedel
Date: Sat Nov 12 2011 - 04:02:22 EST


On Fri, Nov 11, 2011 at 10:59:33AM -0800, Eric W. Biederman wrote:
> Joerg Roedel <joro@xxxxxxxxxx> writes:
> > Okay, thinking more about this, I am not so sure anymore it is a really
> > good idea to fix it this way. It basically signals the driver that DMA
> > is not possible with the device if the aperture does not fit into
> > the dma_mask. But DMA within the ZONE_DMA might still work, no?
> >
> > So I think the right way to fix it is to return a dma-mapping error if
> > and only if the address needs to be remapped by the aperture (of swiotlb or
> > gart).
>
> Perhaps I am mistaken but since the method is iommu type specific if we
> don't actually use the iommu we should not call the method so I think
> this is patch is already implementing what you want.

No it does not. With GART or SWIOTLB all DMA-mapping functions call
directly into the IOMMU driver. The driver then checks whether it needs
to remap or not (see dma_capable() in SWIOTLB or need_iommu() in GART).

I think the check you want to add needs to happen after these checks in
each of the IOMMU drivers.


Joerg

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/