]> git.baikalelectronics.ru Git - kernel.git/commitdiff
iommu/amd: Do not use IOMMUv2 functionality when SME is active
authorJoerg Roedel <jroedel@suse.de>
Mon, 24 Aug 2020 10:54:15 +0000 (12:54 +0200)
committerJoerg Roedel <jroedel@suse.de>
Fri, 4 Sep 2020 10:07:08 +0000 (12:07 +0200)
When memory encryption is active the device is likely not in a direct
mapped domain. Forbid using IOMMUv2 functionality for now until finer
grained checks for this have been implemented.

Signed-off-by: Joerg Roedel <jroedel@suse.de>
Link: https://lore.kernel.org/r/20200824105415.21000-3-joro@8bytes.org
Signed-off-by: Joerg Roedel <jroedel@suse.de>
drivers/iommu/amd/iommu_v2.c

index c259108ab6dd78fcb0514fd8d6f03240dc21b7d2..0d175aed1d92fb4203fbebf09c4d2fd1854bf871 100644 (file)
@@ -737,6 +737,13 @@ int amd_iommu_init_device(struct pci_dev *pdev, int pasids)
 
        might_sleep();
 
+       /*
+        * When memory encryption is active the device is likely not in a
+        * direct-mapped domain. Forbid using IOMMUv2 functionality for now.
+        */
+       if (mem_encrypt_active())
+               return -ENODEV;
+
        if (!amd_iommu_v2_supported())
                return -ENODEV;