IOMMU Archive on
 help / color / Atom feed
From: Sasha Levin <>
Cc: Sasha Levin <>,, Joerg Roedel <>
Subject: [PATCH AUTOSEL 4.4 106/174] iommu/amd: Make iommu_disable safer
Date: Thu, 16 Jan 2020 12:41:43 -0500
Message-ID: <> (raw)
In-Reply-To: <>

From: Kevin Mitchell <>

[ Upstream commit 3ddbe913e55516d3e2165d43d4d5570761769878 ]

Make it safe to call iommu_disable during early init error conditions
before mmio_base is set, but after the struct amd_iommu has been added
to the amd_iommu_list. For example, this happens if firmware fails to
fill in mmio_phys in the ACPI table leading to a NULL pointer
dereference in iommu_feature_disable.

Fixes: 2c0ae1720c09c ('iommu/amd: Convert iommu initialization to state machine')
Signed-off-by: Kevin Mitchell <>
Signed-off-by: Joerg Roedel <>
Signed-off-by: Sasha Levin <>
 drivers/iommu/amd_iommu_init.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c
index 6a69b5bb231f..036fb186a3be 100644
--- a/drivers/iommu/amd_iommu_init.c
+++ b/drivers/iommu/amd_iommu_init.c
@@ -360,6 +360,9 @@ static void iommu_enable(struct amd_iommu *iommu)
 static void iommu_disable(struct amd_iommu *iommu)
+	if (!iommu->mmio_base)
+		return;
 	/* Disable command buffer */
 	iommu_feature_disable(iommu, CONTROL_CMDBUF_EN);

iommu mailing list

  parent reply index

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <>
2020-01-16 17:41 ` [PATCH AUTOSEL 4.4 085/174] iommu/vt-d: Make kernel parameter igfx_off work with vIOMMU Sasha Levin
2020-01-16 17:41 ` [PATCH AUTOSEL 4.4 096/174] iommu: Use right function to get group for device Sasha Levin
2020-01-16 17:41 ` Sasha Levin [this message]
2020-01-16 17:42 ` [PATCH AUTOSEL 4.4 139/174] iommu/amd: Wait for completion of IOTLB flush in attach_device Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

IOMMU Archive on

Archives are clonable:
	git clone --mirror linux-iommu/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-iommu linux-iommu/ \
	public-inbox-index linux-iommu

Example config snippet for mirrors

Newsgroup available over NNTP:

AGPL code for this site: git clone