[PATCH 3/3] iommu: Disable passthrough mode when SME is active
From: Joerg Roedel
Date: Fri Aug 09 2019 - 11:22:44 EST
From: Joerg Roedel <jroedel@xxxxxxx>
Using Passthrough mode when SME is active causes certain
devices to use the SWIOTLB bounce buffer. The bounce buffer
code has an upper limit of 256kb for the size of DMA
allocations, which is too small for certain devices and
causes them to fail.
With this patch we enable IOMMU by default when SME is
active in the system, making the default configuration work
for more systems than it does now.
Users that don't want IOMMUs to be enabled still can disable
them with kernel parameters.
Signed-off-by: Joerg Roedel <jroedel@xxxxxxx>
---
drivers/iommu/iommu.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index 62cae6db0970..fbe1aa51bce9 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -104,6 +104,12 @@ static int __init iommu_subsys_init(void)
else
iommu_def_domain_type = IOMMU_DOMAIN_DMA;
+ if ((iommu_def_domain_type == IOMMU_DOMAIN_IDENTITY) &&
+ sme_active()) {
+ pr_info("SME detected - Disabling default IOMMU passthrough\n");
+ iommu_def_domain_type = IOMMU_DOMAIN_DMA;
+ }
+
pr_info("Default domain type: %s\n",
iommu_domain_type_str(iommu_def_domain_type));
--
2.17.1