From: Tom Lendacky <thomas.lendacky@amd.com>
To: Tycho Andersen <tycho@kernel.org>,
Thomas Gleixner <tglx@kernel.org>, Ingo Molnar <mingo@redhat.com>,
Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>
Cc: Ashish Kalra <ashish.kalra@amd.com>,
Nikunj A Dadhania <nikunj@amd.com>, Kees Cook <kees@kernel.org>,
linux-kernel@vger.kernel.org, Srikanth.Aithal@amd.com,
David.Kaplan@amd.com, Yazen.Ghannam@amd.com
Subject: Re: [PATCH v4] x86/virt/sev: Revert "Drop WBINVD before setting MSR_AMD64_SYSCFG_SNP_EN"
Date: Tue, 7 Jul 2026 11:07:23 -0500 [thread overview]
Message-ID: <82f90ab5-0849-40f5-8f90-1aff2ca11e97@amd.com> (raw)
In-Reply-To: <20260707150033.2364758-1-tycho@kernel.org>
On 7/7/26 10:00, Tycho Andersen wrote:
> From: "Tycho Andersen (AMD)" <tycho@kernel.org>
>
> This reverts commit 99cf1fb58e68 ("x86/virt/sev: Drop WBINVD before setting
> MSR_AMD64_SYSCFG_SNP_EN").
>
> Section 8.8 of the SNP spec says:
>
> Before invoking SNP_INIT_EX with INIT_RMP set to 1, software must
> ensure that no CPUs contain dirty cache lines for the memory containing
> the RMP.
>
> Cachelines can be moved from cache to cache in a dirty state. The
> wbinvd_on_all_cpus() before SNP_INIT_EX flushes the caches for each cpu,
> but if the IPIs for WBINVD race with this dirty cacheline movement, it is
> possible that they may not get flushed violating the firmware requirement.
>
> Doing wbinvd_on_all_cpus() before setting SNPEn is safer since the RMP
> table is not yet in use.
>
> [ Heroically bisected by Srikanth. ]
> Reported-by: Srikanth Aithal <Srikanth.Aithal@amd.com>
> Tested-by: Srikanth Aithal <Srikanth.Aithal@amd.com>
> Fixes: 99cf1fb58e68 ("x86/virt/sev: Drop WBINVD before setting MSR_AMD64_SYSCFG_SNP_EN")
> Signed-off-by: Tycho Andersen (AMD) <tycho@kernel.org>
Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com>
> ---
> arch/x86/virt/svm/sev.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/arch/x86/virt/svm/sev.c b/arch/x86/virt/svm/sev.c
> index 8bcdce98f6dc..cff285d8ad8e 100644
> --- a/arch/x86/virt/svm/sev.c
> +++ b/arch/x86/virt/svm/sev.c
> @@ -536,6 +536,8 @@ int snp_prepare(void)
> goto unlock;
> }
>
> + wbinvd_on_all_cpus();
> +
> /*
> * MtrrFixDramModEn is not shared between threads on a core,
> * therefore it must be set on all CPUs prior to enabling SNP.
>
> base-commit: aa6d9def48ea424a50c21de90ebe609c383cb05d
next prev parent reply other threads:[~2026-07-07 16:07 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-07 15:00 [PATCH v4] x86/virt/sev: Revert "Drop WBINVD before setting MSR_AMD64_SYSCFG_SNP_EN" Tycho Andersen
2026-07-07 15:03 ` Tycho Andersen
2026-07-07 16:07 ` Tom Lendacky [this message]
2026-07-07 16:29 ` [tip: x86/urgent] " tip-bot2 for Tycho Andersen (AMD)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=82f90ab5-0849-40f5-8f90-1aff2ca11e97@amd.com \
--to=thomas.lendacky@amd.com \
--cc=David.Kaplan@amd.com \
--cc=Srikanth.Aithal@amd.com \
--cc=Yazen.Ghannam@amd.com \
--cc=ashish.kalra@amd.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=kees@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=nikunj@amd.com \
--cc=tglx@kernel.org \
--cc=tycho@kernel.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox