Skip to content

Commit d8190dc

Browse files
LuBaolujoergroedel
authored andcommitted
iommu/vt-d: Enable DMA remapping after rmrr mapped
The rmrr devices require identity map of the rmrr regions before enabling DMA remapping. Otherwise, there will be a window during which DMA from/to the rmrr regions will be blocked. In order to alleviate this, we move enabling DMA remapping after all rmrr regions get mapped. Signed-off-by: Lu Baolu <[email protected]> Signed-off-by: Joerg Roedel <[email protected]>
1 parent d850c2e commit d8190dc

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

drivers/iommu/intel-iommu.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3510,11 +3510,6 @@ static int __init init_dmars(void)
35103510
ret = dmar_set_interrupt(iommu);
35113511
if (ret)
35123512
goto free_iommu;
3513-
3514-
if (!translation_pre_enabled(iommu))
3515-
iommu_enable_translation(iommu);
3516-
3517-
iommu_disable_protect_mem_regions(iommu);
35183513
}
35193514

35203515
return 0;
@@ -4902,7 +4897,6 @@ int __init intel_iommu_init(void)
49024897
goto out_free_reserved_range;
49034898
}
49044899
up_write(&dmar_global_lock);
4905-
pr_info("Intel(R) Virtualization Technology for Directed I/O\n");
49064900

49074901
#if defined(CONFIG_X86) && defined(CONFIG_SWIOTLB)
49084902
swiotlb = 0;
@@ -4925,6 +4919,16 @@ int __init intel_iommu_init(void)
49254919
register_memory_notifier(&intel_iommu_memory_nb);
49264920
cpuhp_setup_state(CPUHP_IOMMU_INTEL_DEAD, "iommu/intel:dead", NULL,
49274921
intel_iommu_cpu_dead);
4922+
4923+
/* Finally, we enable the DMA remapping hardware. */
4924+
for_each_iommu(iommu, drhd) {
4925+
if (!translation_pre_enabled(iommu))
4926+
iommu_enable_translation(iommu);
4927+
4928+
iommu_disable_protect_mem_regions(iommu);
4929+
}
4930+
pr_info("Intel(R) Virtualization Technology for Directed I/O\n");
4931+
49284932
intel_iommu_enabled = 1;
49294933
intel_iommu_debugfs_init();
49304934

0 commit comments

Comments
 (0)