[PATCH] DMA 4GB boundary protection

Olof Johansson olof at lixom.net
Thu Mar 22 08:39:45 EST 2007


On Wed, Mar 21, 2007 at 04:05:48PM -0500, Jake Moilanen wrote:
> > > 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.
> 
> Agreed.  While it's not an issue at 4KB, when we go to say 64k, or 16MB
> TCE sizes, this extra space will be wasted.  But, I believe we'll need a
> little code for this anyways.

Doing 16MB mappings will have it's challenges anyway, especially for
things such as network and file I/O. It's similar to what happens for
64kB base page size and the buffer cache: lots and lots of waste, and
the risk of running out of address space is high (depending on how big
the window is per device, of course).

> > 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.
> 
> Done.
> 
> > Also, remember to use IOMMU_PAGE_SHIFT instead of PAGE_SHIFT, they might
> > be different.
> 
> Yup...
> 
> Here's a patch addressing Olof's concerns.

Thanks, I'll have a closer look at it tonight.


-Olof



More information about the Linuxppc-dev mailing list