[PATCH] DMA 4GB boundary protection

Olof Johansson olof at lixom.net
Sun Mar 4 10:29:15 EST 2007


On Fri, Mar 02, 2007 at 03:49:43PM -0600, Jake Moilanen wrote:
> This normally is not an issue as firmware gives us dma-windows under
> 4gigs.  However, some of the new System-P boxes have dma-windows above
> 4gigs, and this present a problem.

Above 4 gigs, or that crosses the 4GB boundary? There's a difference.

> I propose fixing it in the IOMMU allocation instead of making each
> driver protect against it as it is more efficient, and won't require
> changing every driver which has not considered this issue.

The drawback of this patch is that it adds code to every single allocation.
Instead, you should just mark the last entry before the 4GB boundary
as allocated when you setup the bitmaps for the table. That way, no
allocation will ever be able to cross over.

Even nicer would be to only do it when a boot option is specified, so
we actually have a chance to expose and find the driver bugs instead of
papering them over.

Also, remember to use IOMMU_PAGE_SHIFT instead of PAGE_SHIFT, they might
be different.


-Olof



More information about the Linuxppc-dev mailing list