From: Suravee Suthikulpanit Date: Wed, 13 Jul 2022 22:56:51 +0000 (-0500) Subject: iommu/amd: Do not support IOMMUv2 APIs when SNP is enabled X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=30315e71b42603307989d813a620781ff8238f3c;p=linux.git iommu/amd: Do not support IOMMUv2 APIs when SNP is enabled The IOMMUv2 APIs (for supporting shared virtual memory with PASID) configures the domain with IOMMU v2 page table, and sets DTE[Mode]=0. This configuration cannot be supported on SNP-enabled system. Signed-off-by: Suravee Suthikulpanit Link: https://lore.kernel.org/r/20220713225651.20758-10-suravee.suthikulpanit@amd.com Signed-off-by: Joerg Roedel --- diff --git a/drivers/iommu/amd/init.c b/drivers/iommu/amd/init.c index 538c750ceed64..d86496114ca53 100644 --- a/drivers/iommu/amd/init.c +++ b/drivers/iommu/amd/init.c @@ -3458,7 +3458,12 @@ __setup("ivrs_acpihid", parse_ivrs_acpihid); bool amd_iommu_v2_supported(void) { - return amd_iommu_v2_present; + /* + * Since DTE[Mode]=0 is prohibited on SNP-enabled system + * (i.e. EFR[SNPSup]=1), IOMMUv2 page table cannot be used without + * setting up IOMMUv1 page table. + */ + return amd_iommu_v2_present && !amd_iommu_snp_en; } EXPORT_SYMBOL(amd_iommu_v2_supported);