[PATCH] DMA 4GB boundary protection

Olof Johansson olof at lixom.net
Sun Mar 4 16:52:21 EST 2007


On Sun, Mar 04, 2007 at 06:17:38AM +0100, Christoph Hellwig wrote:
> On Sat, Mar 03, 2007 at 09:27:31AM +0100, Benjamin Herrenschmidt wrote:
> > - Drivers are broken -today- and I doubt they can all be audited and
> > fixed (and fixes bacported to distros) quickly
> 
> Which drivers?  All requests coming from the block layer make sure
> you never span the 4GB boundary, and IIRC that same is true for
> networking.  Similarly dma_alloc_coherent and pci_alloc_consinstant
> only allocate from the lower 4G unless told otherwise. 

Since the IOMMU layer adds a completely independent address space, any
mapping might end up straddling the boundary if you're unlucky. But, with
the above info, adding the restrictions in the iommu code seems safer --
at least it won't cause problems on non-translated enviromnents if the
block and network code makes sure it can't happen there.

> A driver writer
> would have to be extra-ordinarily stuid to get this wrong.  (And yes,
> some driver writers are..)

Any pci_map_single or friends should be able to end up there based on
how the iommu allocator works. It doesn't take into consideration any
kind of alignment of the physical regions being mapped.


-Olof



More information about the Linuxppc-dev mailing list