Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

x86/sev: Use MSR protocol for remapping SVSM calling area

As the preceding code comment already indicates, remapping the SVSM
calling area occurs long before the GHCB page is configured, and so
calling svsm_perform_call_protocol() is guaranteed to result in a call
to svsm_perform_msr_protocol().

So just call the latter directly. This allows most of the GHCB based API
infrastructure to be moved out of the startup code in a subsequent
patch.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Reviewed-by: Borislav Petkov (AMD) <bp@alien8.de>
Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com>
Link: https://lore.kernel.org/20250828102202.1849035-26-ardb+git@google.com

authored by

Ard Biesheuvel and committed by
Borislav Petkov (AMD)
c15a4705 e2e29752

+13 -3
+11
arch/x86/boot/startup/sev-shared.c
··· 724 724 } 725 725 } 726 726 727 + static int __head svsm_call_msr_protocol(struct svsm_call *call) 728 + { 729 + int ret; 730 + 731 + do { 732 + ret = svsm_perform_msr_protocol(call); 733 + } while (ret == -EAGAIN); 734 + 735 + return ret; 736 + } 737 + 727 738 static void __head svsm_pval_4k_page(unsigned long paddr, bool validate) 728 739 { 729 740 struct svsm_pvalidate_call *pc;
+2 -3
arch/x86/boot/startup/sev-startup.c
··· 295 295 static __head void svsm_setup(struct cc_blob_sev_info *cc_info) 296 296 { 297 297 struct svsm_call call = {}; 298 - int ret; 299 298 u64 pa; 300 299 301 300 /* ··· 324 325 call.caa = svsm_get_caa(); 325 326 call.rax = SVSM_CORE_CALL(SVSM_CORE_REMAP_CA); 326 327 call.rcx = pa; 327 - ret = svsm_perform_call_protocol(&call); 328 - if (ret) 328 + 329 + if (svsm_call_msr_protocol(&call)) 329 330 sev_es_terminate(SEV_TERM_SET_LINUX, GHCB_TERM_SVSM_CA_REMAP_FAIL); 330 331 331 332 boot_svsm_caa = (struct svsm_ca *)pa;