aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iommu/intel-iommu.c
diff options
context:
space:
mode:
authorTom Mingarelli <thomas.mingarelli@hp.com>2012-11-20 14:43:17 -0500
committerJoerg Roedel <joro@8bytes.org>2012-11-21 10:55:32 -0500
commitea2447f700cab264019b52e2b417d689e052dcfd (patch)
tree3184219834b5ad9ae6e65761c8da494f0379f2f1 /drivers/iommu/intel-iommu.c
parentf4a75d2eb7b1e2206094b901be09adb31ba63681 (diff)
intel-iommu: Prevent devices with RMRRs from being placed into SI Domain
This patch is to prevent non-USB devices that have RMRRs associated with them from being placed into the SI Domain during init. This fixes the issue where the RMRR info for devices being placed in and out of the SI Domain gets lost. Signed-off-by: Thomas Mingarelli <thomas.mingarelli@hp.com> Tested-by: Shuah Khan <shuah.khan@hp.com> Reviewed-by: Donald Dutile <ddutile@redhat.com> Reviewed-by: Alex Williamson <alex.williamson@redhat.com> Signed-off-by: Joerg Roedel <joro@8bytes.org>
Diffstat (limited to 'drivers/iommu/intel-iommu.c')
-rw-r--r--drivers/iommu/intel-iommu.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
index d4a4cd445cab..ca3ee46a8d61 100644
--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -2320,8 +2320,39 @@ static int domain_add_dev_info(struct dmar_domain *domain,
2320 return 0; 2320 return 0;
2321} 2321}
2322 2322
2323static bool device_has_rmrr(struct pci_dev *dev)
2324{
2325 struct dmar_rmrr_unit *rmrr;
2326 int i;
2327
2328 for_each_rmrr_units(rmrr) {
2329 for (i = 0; i < rmrr->devices_cnt; i++) {
2330 /*
2331 * Return TRUE if this RMRR contains the device that
2332 * is passed in.
2333 */
2334 if (rmrr->devices[i] == dev)
2335 return true;
2336 }
2337 }
2338 return false;
2339}
2340
2323static int iommu_should_identity_map(struct pci_dev *pdev, int startup) 2341static int iommu_should_identity_map(struct pci_dev *pdev, int startup)
2324{ 2342{
2343
2344 /*
2345 * We want to prevent any device associated with an RMRR from
2346 * getting placed into the SI Domain. This is done because
2347 * problems exist when devices are moved in and out of domains
2348 * and their respective RMRR info is lost. We exempt USB devices
2349 * from this process due to their usage of RMRRs that are known
2350 * to not be needed after BIOS hand-off to OS.
2351 */
2352 if (device_has_rmrr(pdev) &&
2353 (pdev->class >> 8) != PCI_CLASS_SERIAL_USB)
2354 return 0;
2355
2325 if ((iommu_identity_mapping & IDENTMAP_AZALIA) && IS_AZALIA(pdev)) 2356 if ((iommu_identity_mapping & IDENTMAP_AZALIA) && IS_AZALIA(pdev))
2326 return 1; 2357 return 1;
2327 2358