]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
iommu: Rework iommu_group_get_for_pci_dev()
authorAlex Williamson <alex.williamson@redhat.com>
Fri, 19 Sep 2014 16:03:06 +0000 (10:03 -0600)
committerJoerg Roedel <jroedel@suse.de>
Thu, 25 Sep 2014 14:39:06 +0000 (16:39 +0200)
commitf096c061f5525d1b35a65b793057b52061dcb486
tree9d79f925e4fc7820ea39686bd0bef3eb757891e6
parentd943b0ffba153cd63f836647b873b445842a2f58
iommu: Rework iommu_group_get_for_pci_dev()

It turns out that our assumption that aliases are always to the same
slot isn't true.  One particular platform reports an IVRS alias of the
SATA controller (00:11.0) for the legacy IDE controller (00:14.1).
When we hit this, we attempt to use a single IOMMU group for
everything on the same bus, which in this case is the root complex.
We already have multiple groups defined for the root complex by this
point, resulting in multiple WARN_ON hits.

This patch makes these sorts of aliases work again with IOMMU groups
by reworking how we search through the PCI address space to find
existing groups.  This should also now handle looped dependencies and
all sorts of crazy inter-dependencies that we'll likely never see.

The recursion used here should never be very deep.  It's unlikely to
have individual aliases and only theoretical that we'd ever see a
chain where one alias causes us to search through to yet another
alias.  We're also only dealing with PCIe device on a single bus,
which means we'll typically only see multiple slots in use on the root
complex.  Loops are also a theoretically possibility, which I've
tested using fake DMA alias quirks and prevent from causing problems
using a bitmap of the devfn space that's been visited.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Cc: stable@vger.kernel.org # 3.17
Signed-off-by: Joerg Roedel <jroedel@suse.de>
drivers/iommu/iommu.c