]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
x86/sev: Create snp_prepare()
authorTycho Andersen (AMD) <tycho@kernel.org>
Thu, 26 Mar 2026 16:11:05 +0000 (10:11 -0600)
committerBorislav Petkov (AMD) <bp@alien8.de>
Sat, 28 Mar 2026 21:16:03 +0000 (22:16 +0100)
commitca2ca373ec854d203c74e6ac1c4e08a70e8d2509
tree09a34bf4eb4f758e83f7edf19a9d1a7e3d85cc32
parent9c016c3f4928f436b9ad20f30a5a9d538490fbb4
x86/sev: Create snp_prepare()

In preparation for delayed SNP initialization, create a function snp_prepare()
that does the necessary architecture setup.  Export this function for the ccp
module to allow it to do the setup as necessary.

Introduce a cpu_read_lock/unlock() wrapper around the MFDM and SNP enable.
While CPU hotplug is not supported, this makes sure that the bit setting
happens on the same set of CPUs in both cases.

This improvement was suggested by Sashiko:

  https://sashiko.dev/#/patchset/20260324161301.1353976-1-tycho%40kernel.org

Also move {mfd,snp}_enable() out of the __init section, since these will be
called later.

Signed-off-by: Tycho Andersen (AMD) <tycho@kernel.org>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com>
Link: https://patch.msgid.link/20260326161110.1764303-3-tycho@kernel.org
arch/x86/include/asm/sev.h
arch/x86/virt/svm/sev.c