Skip to content

Commit 7cad554

Browse files
committed
iommu/amd: Do not force direct mapping when SME is active
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>
1 parent e52d58d commit 7cad554

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

drivers/iommu/amd/iommu.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2659,7 +2659,12 @@ static int amd_iommu_def_domain_type(struct device *dev)
26592659
if (!dev_data)
26602660
return 0;
26612661

2662-
if (dev_data->iommu_v2)
2662+
/*
2663+
* Do not identity map IOMMUv2 capable devices when memory encryption is
2664+
* active, because some of those devices (AMD GPUs) don't have the
2665+
* encryption bit in their DMA-mask and require remapping.
2666+
*/
2667+
if (!mem_encrypt_active() && dev_data->iommu_v2)
26632668
return IOMMU_DOMAIN_IDENTITY;
26642669

26652670
return 0;

0 commit comments

Comments
 (0)