iommu/amd: Disable iommu only if amd_iommu=off is specified
authorBaoquan He <bhe@redhat.com>
Wed, 9 Aug 2017 08:33:44 +0000 (16:33 +0800)
committerJoerg Roedel <jroedel@suse.de>
Tue, 15 Aug 2017 16:14:41 +0000 (18:14 +0200)
It's ok to disable iommu early in normal kernel or in kdump kernel when
amd_iommu=off is specified. While we should not disable it in kdump kernel
when on-flight dma is still on-going.

Signed-off-by: Baoquan He <bhe@redhat.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
drivers/iommu/amd_iommu_init.c

index 88e7a6e950ae547769e4e3d5f33c496e2c5fcaff..c7d03251c80a42ac24112bcaa5cde64cc626cb6c 100644 (file)
@@ -2499,7 +2499,8 @@ static int __init early_amd_iommu_init(void)
                goto out;
 
        /* Disable any previously enabled IOMMUs */
-       disable_iommus();
+       if (!is_kdump_kernel() || amd_iommu_disabled)
+               disable_iommus();
 
        if (amd_iommu_irq_remap)
                amd_iommu_irq_remap = check_ioapic_information();