--- 362ab88c73ac0bedd5f4ce4765ebe596d8c0924b +++ 3925adfba7654c1c40da35e5b30a96141d67ea5d @@ -1284,6 +1284,8 @@ int __init amd_iommu_init(void) if (ret) goto free; + enable_iommus(); + if (iommu_pass_through) ret = amd_iommu_init_passthrough(); else @@ -1294,8 +1296,6 @@ int __init amd_iommu_init(void) amd_iommu_init_api(); - enable_iommus(); - if (iommu_pass_through) goto out; @@ -1314,6 +1314,8 @@ out: return ret; free: + disable_iommus(); + free_pages((unsigned long)amd_iommu_pd_alloc_bitmap, get_order(MAX_DOMAIN_ID/8));