iommu/amd: Clear amd_iommu_snp_en if snp_rmptable_init() fails
Subsystems (2)
PATCH 1/1 iommu/amd: Clear amd_iommu_snp_en if snp_rmptable_init() fails
iommu_snp_enable() checks that the IOMMU can support SNP and sets amd_iommu_snp_en, then calls snp_rmptable_init() to map the RMP table. If that call fails, CC_ATTR_HOST_SEV_SNP is cleared but amd_iommu_snp_en is left set. Later IOMMU initialization uses amd_iommu_snp_en to configure the IOMMU for SNP, on the assumption that RMP setup succeeded.
Clear amd_iommu_snp_en along with CC_ATTR_HOST_SEV_SNP.
--- drivers/iommu/amd/init.c | 1 + 1 file changed, 1 insertion(+)
drivers/iommu/amd/init.c +1 -0
@@ -3445,6 +3445,7 @@ static __init void iommu_snp_enable(void)return ; disable_snp: + amd_iommu_snp_en = false;cc_platform_clear (CC_ATTR_HOST_SEV_SNP );#endif }
Signature · 1 line
2.25.1
Quoted 9 lines · Dheeraj Kumar Srivastava
iommu_snp_enable()checks that the IOMMU can support SNP and setsamd_iommu_snp_en, then callssnp_rmptable_init()to map the RMP table. If that call fails,CC_ATTR_HOST_SEV_SNPis cleared butamd_iommu_snp_enis left set. Later IOMMU initialization usesamd_iommu_snp_ento configure the IOMMU for SNP, on the assumption that RMP setup succeeded.Clear
amd_iommu_snp_enalong withCC_ATTR_HOST_SEV_SNP.Fixes 409f45387c93 ("x86/sev: Fix broken SNP support with KVM module built-in")
Quoted 20 lines
Signed-off-by Dheeraj Kumar Srivastava <[email protected]>--- drivers/iommu/amd/init.c | 1 + 1 file changed, 1 insertion(+)drivers/iommu/amd/init.c +1
-0@@ -3445,6 +3445,7 @@ static __init void iommu_snp_enable(void)return ; disable_snp: + amd_iommu_snp_en = false;cc_platform_clear (CC_ATTR_HOST_SEV_SNP );#endif }Signature · 1 line
2.25.1
Vasant Hegde
maintainerQuoted 10 lines · Dheeraj Kumar Srivastava
iommu_snp_enable()checks that the IOMMU can support SNP and setsamd_iommu_snp_en, then callssnp_rmptable_init()to map the RMP table. If that call fails,CC_ATTR_HOST_SEV_SNPis cleared butamd_iommu_snp_enis left set. Later IOMMU initialization usesamd_iommu_snp_ento configure the IOMMU for SNP, on the assumption that RMP setup succeeded.Clear
amd_iommu_snp_enalong withCC_ATTR_HOST_SEV_SNP.Fixes 409f45387c93 ("x86/sev: Fix broken SNP support with KVM module built-in")Signed-off-by Dheeraj Kumar Srivastava <[email protected]>
Thanks. Queued for rc.
-Vasant