From: Joerg Roedel <jroe...@suse.de>

commit 9f81ca8d1fd68f5697c201f26632ed622e9e462f upstream.

Don't even try to initialize the AMD IOMMU hardware when amd_iommu=off has been
passed on the kernel command line.

Cc: sta...@vger.kernel.org # v5.11
Signed-off-by: Joerg Roedel <jroe...@suse.de>
Link: https://lore.kernel.org/r/20210317091037.31374-3-j...@8bytes.org
Acked-by: Huang Rui <ray.hu...@amd.com>
Signed-off-by: Greg Kroah-Hartman <gre...@linuxfoundation.org>
---
 drivers/iommu/amd/init.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

--- a/drivers/iommu/amd/init.c
+++ b/drivers/iommu/amd/init.c
@@ -2917,12 +2917,12 @@ static int __init state_next(void)
                }
                break;
        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 IOMMU disabled\n");
+               if (amd_iommu_disabled) {
                        init_state = IOMMU_CMDLINE_DISABLED;
                        ret = -EINVAL;
+               } else {
+                       ret = early_amd_iommu_init();
+                       init_state = ret ? IOMMU_INIT_ERROR : 
IOMMU_ACPI_FINISHED;
                }
                break;
        case IOMMU_ACPI_FINISHED:


Reply via email to