[PATCH 04/11] x86/snp: drop WBINVD before setting SNPEn

Tycho Andersen posted 11 patches 8 hours ago
[PATCH 04/11] x86/snp: drop WBINVD before setting SNPEn
Posted by Tycho Andersen 8 hours ago
From: "Tycho Andersen (AMD)" <tycho@kernel.org>

WBINVD is required before SNP_INIT(_EX), but not before setting SNPEn,
since the ccp driver already does its own WBINVD before SNP_INIT (and this
one would be too early for that anyway...).

Signed-off-by: Tycho Andersen (AMD) <tycho@kernel.org>
---
 arch/x86/virt/svm/sev.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/arch/x86/virt/svm/sev.c b/arch/x86/virt/svm/sev.c
index e7fbbf1cdf8e..258e67ba7415 100644
--- a/arch/x86/virt/svm/sev.c
+++ b/arch/x86/virt/svm/sev.c
@@ -537,9 +537,6 @@ int __init snp_rmptable_init(void)
 
 	snp_clear_rmp();
 
-	/* Flush the caches to ensure that data is written before SNP is enabled. */
-	wbinvd_on_all_cpus();
-
 	/* MtrrFixDramModEn must be enabled on all the CPUs prior to enabling SNP. */
 	on_each_cpu(mfd_enable, NULL, 1);
 
-- 
2.53.0
Re: [PATCH 04/11] x86/snp: drop WBINVD before setting SNPEn
Posted by Tom Lendacky 7 hours ago
On 3/2/26 13:13, Tycho Andersen wrote:
> From: "Tycho Andersen (AMD)" <tycho@kernel.org>
> 
> WBINVD is required before SNP_INIT(_EX), but not before setting SNPEn,
> since the ccp driver already does its own WBINVD before SNP_INIT (and this
> one would be too early for that anyway...).
> 
> Signed-off-by: Tycho Andersen (AMD) <tycho@kernel.org>

Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com>

> ---
>  arch/x86/virt/svm/sev.c | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/arch/x86/virt/svm/sev.c b/arch/x86/virt/svm/sev.c
> index e7fbbf1cdf8e..258e67ba7415 100644
> --- a/arch/x86/virt/svm/sev.c
> +++ b/arch/x86/virt/svm/sev.c
> @@ -537,9 +537,6 @@ int __init snp_rmptable_init(void)
>  
>  	snp_clear_rmp();
>  
> -	/* Flush the caches to ensure that data is written before SNP is enabled. */
> -	wbinvd_on_all_cpus();
> -
>  	/* MtrrFixDramModEn must be enabled on all the CPUs prior to enabling SNP. */
>  	on_each_cpu(mfd_enable, NULL, 1);
>