diff options
author | Joerg Roedel <jroedel@suse.de> | 2017-06-16 16:09:59 +0200 |
---|---|---|
committer | Joerg Roedel <jroedel@suse.de> | 2017-06-22 12:54:21 +0200 |
commit | 7ad820e43330bbf974792c5ab4e2c2355e08d597 (patch) | |
tree | 45bcfe3f92893314f76441b09fd26931b84d2d38 /drivers/iommu/amd_iommu_init.c | |
parent | f601927136d69be49f0a14ae820b44c02fa591ba (diff) |
iommu/amd: Free IOMMU resources when disabled on command line
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>
Diffstat (limited to 'drivers/iommu/amd_iommu_init.c')
-rw-r--r-- | drivers/iommu/amd_iommu_init.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c index 8cc507f96f3a..128f9665c326 100644 --- a/drivers/iommu/amd_iommu_init.c +++ b/drivers/iommu/amd_iommu_init.c @@ -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(); |