iommu/amd: Do not enable SNP when V2 page table is enabled
Subsystems (2)
Vasant Hegde
maintainerPATCH 1/1 iommu/amd: Do not enable SNP when V2 page table is enabled
DTE[Mode]=0 is not supported when SNP is enabled in the host. That means to support SNP, IOMMU must be configued with V1 page table (See IOMMU spec [1] for the details). If user passes kernel command line to configure IOMMU domains with v2 page table (amd_iommu=pgtbl_v2) then disable SNP.
[1] https://www.amd.com/content/dam/amd/en/documents/processor-tech-docs/specifications/48882_IOMMU.pdf
--- drivers/iommu/amd/init.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
drivers/iommu/amd/init.c +6 -7
@@ -3232,13 +3232,18 @@ static void iommu_snp_enable(void)return ;/* * The SNP support requires that IOMMU must be enabled, and is -* not configured in the passthrough mode. +* configured with V1 page table (DTE[Mode] = 0 is not supported). */ if (no_iommu ||iommu_default_passthrough ()) {pr_err ("SNP: IOMMU disabled or configured in passthrough mode, SNP cannot be supported.\n" );return ; } +if (amd_iommu_pgtable !=AMD_IOMMU_V1 ) { +pr_warn ("SNP: IOMMU is configured with V2 page table mode, SNP cannot be supported.\n" ); +return ; + } + amd_iommu_snp_en =check_feature (FEATURE_SNP );if (!amd_iommu_snp_en) {pr_err ("SNP: IOMMU SNP feature not enabled, SNP cannot be supported.\n" );
@@ -3246,12 +3251,6 @@ static void iommu_snp_enable(void) }pr_info ("IOMMU SNP support enabled.\n" ); - -/* Enforce IOMMU v1 pagetable when SNP is enabled. */ -if (amd_iommu_pgtable !=AMD_IOMMU_V1 ) { -pr_warn ("Forcing use of AMD IOMMU v1 page table due to SNP.\n" ); - amd_iommu_pgtable =AMD_IOMMU_V1 ; - }#endif }
Signature · 1 line
2.31.1
Quoted 11 lines · Vasant Hegde
DTE[Mode]=0 is not supported when SNP is enabled in the host. That means to support SNP, IOMMU must be configued with V1 page table (See IOMMU spec [1] for the details). If user passes kernel command line to configure IOMMU domains with v2 page table (amd_iommu=pgtbl_v2) then disable SNP.
[1] https://www.amd.com/content/dam/amd/en/documents/processor-tech-docs/specifications/48882_IOMMU.pdf
Cc Ashish Kalra <[email protected]>Cc Michael Roth <[email protected]>Cc Tom Lendacky <[email protected]>Signed-off-by Vasant Hegde <[email protected]>
Just a heads up, but this will likely end up with a conflict after tip just merged changes around this area.
https://lore.kernel.org/lkml/171222187434.10875.5343618940901502172.tip-bot2@tip-bot2/
Thanks,
Tom
Quoted 41 lines
--- drivers/iommu/amd/init.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)drivers/iommu/amd/init.c +6
-7@@ -3232,13 +3232,18 @@ static void iommu_snp_enable(void)return ;/* * The SNP support requires that IOMMU must be enabled, and is -* not configured in the passthrough mode. +* configured with V1 page table (DTE[Mode] = 0 is not supported). */ if (no_iommu ||iommu_default_passthrough ()) {pr_err ("SNP: IOMMU disabled or configured in passthrough mode, SNP cannot be supported.\n" );return ; } +if (amd_iommu_pgtable !=AMD_IOMMU_V1 ) { +pr_warn ("SNP: IOMMU is configured with V2 page table mode, SNP cannot be supported.\n" ); +return ; + } + amd_iommu_snp_en =check_feature (FEATURE_SNP );if (!amd_iommu_snp_en) {pr_err ("SNP: IOMMU SNP feature not enabled, SNP cannot be supported.\n" );@@ -3246,12 +3251,6 @@ static void iommu_snp_enable(void) }pr_info ("IOMMU SNP support enabled.\n" ); - -/* Enforce IOMMU v1 pagetable when SNP is enabled. */ -if (amd_iommu_pgtable !=AMD_IOMMU_V1 ) { -pr_warn ("Forcing use of AMD IOMMU v1 page table due to SNP.\n" ); - amd_iommu_pgtable =AMD_IOMMU_V1 ; - }#endif }
Tom,
Quoted 13 lines · Tom Lendacky
Quoted 11 lines · Vasant Hegde
DTE[Mode]=0 is not supported when SNP is enabled in the host. That means to support SNP, IOMMU must be configued with V1 page table (See IOMMU spec [1] for the details). If user passes kernel command line to configure IOMMU domains with v2 page table (amd_iommu=pgtbl_v2) then disable SNP.
[1] https://www.amd.com/content/dam/amd/en/documents/processor-tech-docs/specifications/48882_IOMMU.pdf
Cc Ashish Kalra <[email protected]>Cc Michael Roth <[email protected]>Cc Tom Lendacky <[email protected]>Signed-off-by Vasant Hegde <[email protected]>
Quoted 4 lines
Just a heads up, but this will likely end up with a conflict after tip just merged changes around this area.
https://lore.kernel.org/lkml/171222187434.10875.5343618940901502172.tip-bot2@tip-bot2/
Ah right. I will rebase/resend this patch.
-Vasant