Skip to content

Commit ea2447f

Browse files
Tom Mingarellijoergroedel
authored andcommitted
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 <[email protected]> Tested-by: Shuah Khan <[email protected]> Reviewed-by: Donald Dutile <[email protected]> Reviewed-by: Alex Williamson <[email protected]> Signed-off-by: Joerg Roedel <[email protected]>
1 parent f4a75d2 commit ea2447f

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

drivers/iommu/intel-iommu.c

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2320,8 +2320,39 @@ static int domain_add_dev_info(struct dmar_domain *domain,
23202320
return 0;
23212321
}
23222322

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+
23232341
static int iommu_should_identity_map(struct pci_dev *pdev, int startup)
23242342
{
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+
23252356
if ((iommu_identity_mapping & IDENTMAP_AZALIA) && IS_AZALIA(pdev))
23262357
return 1;
23272358

0 commit comments

Comments
 (0)