intel-iommu: Don't use identity mapping for PCI devices behind bridges
authorDavid Woodhouse <David.Woodhouse@intel.com>
Sat, 4 Jul 2009 18:11:08 +0000 (19:11 +0100)
committerDavid Woodhouse <David.Woodhouse@intel.com>
Sat, 4 Jul 2009 18:19:10 +0000 (19:19 +0100)
commit3dfc813d94bba2046c6aed216e0fd69ac93a8e03
tree227c2cecfdab3b9bb86508e9d8b6de51e68bfa70
parent6941af2810c6fc970b88f7c0d52ba4e286acbee5
intel-iommu: Don't use identity mapping for PCI devices behind bridges

Our current strategy for pass-through mode is to put all devices into
the 1:1 domain at startup (which is before we know what their dma_mask
will be), and only _later_ take them out of that domain, if it turns out
that they really can't address all of memory.

However, when there are a bunch of PCI devices behind a bridge, they all
end up with the same source-id on their DMA transactions, and hence in
the same IOMMU domain. This means that we _can't_ easily move them from
the 1:1 domain into their own domain at runtime, because there might be DMA
in-flight from their siblings.

So we have to adjust our pass-through strategy: For PCI devices not on
the root bus, and for the bridges which will take responsibility for
their transactions, we have to start up _out_ of the 1:1 domain, just in
case.

This fixes the BUG() we see when we have 32-bit-capable devices behind a
PCI-PCI bridge, and use the software identity mapping.

It does mean that we might end up using 'normal' mapping mode for some
devices which could actually live with the faster 1:1 mapping -- but
this is only for PCI devices behind bridges, which presumably aren't the
devices for which people are most concerned about performance.

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
drivers/pci/intel-iommu.c