Skip to content

Commit

Permalink
iommu/vt-d: Don't enable iommu's which have been ignored
Browse files Browse the repository at this point in the history
The iommu driver will ignore some iommu units if there's no
device under its scope or those devices have been explicitly
set to bypass the DMA translation. Don't enable those iommu
units, otherwise the devices under its scope won't work.

Fixes: d8190dc ("iommu/vt-d: Enable DMA remapping after rmrr mapped")
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
  • Loading branch information
Lu Baolu authored and Joerg Roedel committed Jun 12, 2019
1 parent c57b260 commit 6a8c674
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions drivers/iommu/intel-iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -3268,7 +3268,12 @@ static int __init init_dmars(void)
goto error;
}

for_each_active_iommu(iommu, drhd) {
for_each_iommu(iommu, drhd) {
if (drhd->ignored) {
iommu_disable_translation(iommu);
continue;
}

/*
* Find the max pasid size of all IOMMU's in the system.
* We need to ensure the system pasid table is no bigger
Expand Down Expand Up @@ -4821,7 +4826,7 @@ int __init intel_iommu_init(void)

/* Finally, we enable the DMA remapping hardware. */
for_each_iommu(iommu, drhd) {
if (!translation_pre_enabled(iommu))
if (!drhd->ignored && !translation_pre_enabled(iommu))
iommu_enable_translation(iommu);

iommu_disable_protect_mem_regions(iommu);
Expand Down

0 comments on commit 6a8c674

Please sign in to comment.