]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
iommu/vt-d: Fix IOMMU lookup for SR-IOV Virtual Functions
authorAshok Raj <ashok.raj@intel.com>
Fri, 21 Oct 2016 22:32:05 +0000 (15:32 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 2 Dec 2016 08:10:30 +0000 (09:10 +0100)
commiteb060c1a03f7ab09a890559355fe45eb923161a9
tree3f8aaac205385b779242dfa7be420763fa3e3d74
parent8b23f16343f6e1b7ffc3d4f2cd2239bcb97bfbb3
iommu/vt-d: Fix IOMMU lookup for SR-IOV Virtual Functions

commit 1c387188c60f53b338c20eee32db055dfe022a9b upstream.

The VT-d specification (§8.3.3) says:
    ‘Virtual Functions’ of a ‘Physical Function’ are under the scope
    of the same remapping unit as the ‘Physical Function’.

The BIOS is not required to list all the possible VFs in the scope
tables, and arguably *shouldn't* make any attempt to do so, since there
could be a huge number of them.

This has been broken basically for ever — the VF is never going to match
against a specific unit's scope, so it ends up being assigned to the
INCLUDE_ALL IOMMU. Which was always actually correct by coincidence, but
now we're looking at Root-Complex integrated devices with SR-IOV support
it's going to start being wrong.

Fix it to simply use pci_physfn() before doing the lookup for PCI devices.

Signed-off-by: Sainath Grandhi <sainath.grandhi@intel.com>
Signed-off-by: Ashok Raj <ashok.raj@intel.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/iommu/dmar.c
drivers/iommu/intel-iommu.c