]> git.baikalelectronics.ru Git - kernel.git/commit
iommu/amd: Do not support IOMMU_DOMAIN_IDENTITY after SNP is enabled
authorSuravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Wed, 13 Jul 2022 22:56:50 +0000 (17:56 -0500)
committerJoerg Roedel <jroedel@suse.de>
Fri, 15 Jul 2022 08:43:14 +0000 (10:43 +0200)
commitd0b7b36e0d2a36d4dcd16201386464ca50f66918
tree7cdfde6d8a9da49b925ff032b1d487c7859c799b
parent54c4e127f06c4391112c5ceb732fd12c7bd84d0f
iommu/amd: Do not support IOMMU_DOMAIN_IDENTITY after SNP is enabled

Once SNP is enabled (by executing SNP_INIT command), IOMMU can no longer
support the passthrough domain (i.e. IOMMU_DOMAIN_IDENTITY).

The SNP_INIT command is called early in the boot process, and would fail
if the kernel is configure to default to passthrough mode.

After the system is already booted, users can try to change IOMMU domain
type of a particular IOMMU group. In this case, the IOMMU driver needs to
check the SNP-enable status and return failure when requesting to change
domain type to identity.

Therefore, return failure when trying to allocate identity domain.

Reviewed-by: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Link: https://lore.kernel.org/r/20220713225651.20758-9-suravee.suthikulpanit@amd.com
[ joro: Removed WARN_ON_ONCE() ]
Signed-off-by: Joerg Roedel <jroedel@suse.de>
drivers/iommu/amd/iommu.c