]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
iommu/amd: Free IOMMU resources when disabled on command line
authorJoerg Roedel <jroedel@suse.de>
Fri, 16 Jun 2017 14:09:59 +0000 (16:09 +0200)
committerJoerg Roedel <jroedel@suse.de>
Thu, 22 Jun 2017 10:54:21 +0000 (12:54 +0200)
After we made sure that all IOMMUs have been disabled we
need to make sure that all resources we allocated are
released again.

Signed-off-by: Joerg Roedel <jroedel@suse.de>
drivers/iommu/amd_iommu_init.c

index 8cc507f96f3a805c4a46a8fceb5f4d3d8de82364..128f9665c326ada5a2a7169ea72263d61947a58c 100644 (file)
@@ -2430,6 +2430,13 @@ static int __init state_next(void)
        case IOMMU_IVRS_DETECTED:
                ret = early_amd_iommu_init();
                init_state = ret ? IOMMU_INIT_ERROR : IOMMU_ACPI_FINISHED;
+               if (init_state == IOMMU_ACPI_FINISHED && amd_iommu_disabled) {
+                       pr_info("AMD-Vi: AMD IOMMU disabled on kernel command-line\n");
+                       free_dma_resources();
+                       free_iommu_resources();
+                       init_state = IOMMU_CMDLINE_DISABLED;
+                       ret = -EINVAL;
+               }
                break;
        case IOMMU_ACPI_FINISHED:
                early_enable_iommus();