summaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/sev.c
diff options
context:
space:
mode:
authorTom Lendacky <thomas.lendacky@amd.com>2024-06-05 17:18:45 +0200
committerBorislav Petkov (AMD) <bp@alien8.de>2024-06-11 07:22:46 +0200
commit878e70dbd26e234e6e6941dac3a233af6f632184 (patch)
treea72b58480c89933154a92ba6546de8e03778b48f /arch/x86/kernel/sev.c
parentx86/irqflags: Provide native versions of the local_irq_save()/restore() (diff)
downloadlinux-878e70dbd26e234e6e6941dac3a233af6f632184.tar.xz
linux-878e70dbd26e234e6e6941dac3a233af6f632184.zip
x86/sev: Check for the presence of an SVSM in the SNP secrets page
During early boot phases, check for the presence of an SVSM when running as an SEV-SNP guest. An SVSM is present if not running at VMPL0 and the 64-bit value at offset 0x148 into the secrets page is non-zero. If an SVSM is present, save the SVSM Calling Area address (CAA), located at offset 0x150 into the secrets page, and set the VMPL level of the guest, which should be non-zero, to indicate the presence of an SVSM. [ bp: Touchups. ] Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Link: https://lore.kernel.org/r/9d3fe161be93d4ea60f43c2a3f2c311fe708b63b.1717600736.git.thomas.lendacky@amd.com
Diffstat (limited to '')
-rw-r--r--arch/x86/kernel/sev.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/arch/x86/kernel/sev.c b/arch/x86/kernel/sev.c
index 3342ed58e168..36a117a38b10 100644
--- a/arch/x86/kernel/sev.c
+++ b/arch/x86/kernel/sev.c
@@ -2109,6 +2109,13 @@ bool __head snp_init(struct boot_params *bp)
setup_cpuid_table(cc_info);
/*
+ * Record the SVSM Calling Area address (CAA) if the guest is not
+ * running at VMPL0. The CA will be used to communicate with the
+ * SVSM to perform the SVSM services.
+ */
+ svsm_setup_ca(cc_info);
+
+ /*
* The CC blob will be used later to access the secrets page. Cache
* it here like the boot kernel does.
*/