diff options
| -rw-r--r-- | drivers/iommu/intel-iommu.c | 31 |
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 | ||
| 2323 | static 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 | |||
| 2323 | static int iommu_should_identity_map(struct pci_dev *pdev, int startup) | 2341 | static 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 | ||
