summaryrefslogtreecommitdiff
path: root/drivers/iommu
diff options
context:
space:
mode:
authorJoerg Roedel <jroedel@suse.de>2020-08-24 13:54:14 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-09-17 14:55:37 +0300
commit5aa21abcedd295a4e3338073f09f2c4849f11e39 (patch)
treeecec6b59a9af851569e0ed3932a6d649b2226380 /drivers/iommu
parent4898d0e064b9aa5d5697e4b5844384ed8ccddae0 (diff)
downloadlinux-5aa21abcedd295a4e3338073f09f2c4849f11e39.tar.xz
iommu/amd: Do not force direct mapping when SME is active
[ Upstream commit 7cad554887f1c5fd77e57e6bf4be38370c2160cb ] Do not force devices supporting IOMMUv2 to be direct mapped when memory encryption is active. This might cause them to be unusable because their DMA mask does not include the encryption bit. Signed-off-by: Joerg Roedel <jroedel@suse.de> Link: https://lore.kernel.org/r/20200824105415.21000-2-joro@8bytes.org Signed-off-by: Joerg Roedel <jroedel@suse.de> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/iommu')
-rw-r--r--drivers/iommu/amd/iommu.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/iommu/amd/iommu.c b/drivers/iommu/amd/iommu.c
index 200ee948f6ec..37c74c842f3a 100644
--- a/drivers/iommu/amd/iommu.c
+++ b/drivers/iommu/amd/iommu.c
@@ -2650,7 +2650,12 @@ static int amd_iommu_def_domain_type(struct device *dev)
if (!dev_data)
return 0;
- if (dev_data->iommu_v2)
+ /*
+ * Do not identity map IOMMUv2 capable devices when memory encryption is
+ * active, because some of those devices (AMD GPUs) don't have the
+ * encryption bit in their DMA-mask and require remapping.
+ */
+ if (!mem_encrypt_active() && dev_data->iommu_v2)
return IOMMU_DOMAIN_IDENTITY;
return 0;