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, crypto/ccp: Move HSAVE_PA setup to arch/x86/

Now that there is snp_prepare() that indicates when the CCP driver wants to
prepare the architecture for SNP_INIT(_EX), move this architecture-specific
bit of code to a more sensible place.

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/20260324161301.1353976-6-tycho@kernel.org

authored by

Tycho Andersen (AMD) and committed by
Borislav Petkov (AMD)
7b2bc5f0 299933b1

+8 -8
+8
arch/x86/virt/svm/sev.c
··· 506 506 return true; 507 507 } 508 508 509 + static void clear_hsave_pa(void *arg) 510 + { 511 + wrmsrq(MSR_VM_HSAVE_PA, 0); 512 + } 513 + 509 514 void snp_prepare(void) 510 515 { 511 516 u64 val; ··· 533 528 */ 534 529 on_each_cpu(mfd_reconfigure, (void *)1, 1); 535 530 on_each_cpu(snp_enable, NULL, 1); 531 + 532 + /* SNP_INIT requires MSR_VM_HSAVE_PA to be cleared on all CPUs. */ 533 + on_each_cpu(clear_hsave_pa, NULL, 1); 536 534 537 535 cpus_read_unlock(); 538 536 }
-8
drivers/crypto/ccp/sev-dev.c
··· 1076 1076 return __sev_init_locked(psp_ret); 1077 1077 } 1078 1078 1079 - static void snp_set_hsave_pa(void *arg) 1080 - { 1081 - wrmsrq(MSR_VM_HSAVE_PA, 0); 1082 - } 1083 - 1084 1079 /* Hypervisor Fixed pages API interface */ 1085 1080 static void snp_hv_fixed_pages_state_update(struct sev_device *sev, 1086 1081 enum snp_hv_fixed_pages_state page_state) ··· 1369 1374 } 1370 1375 1371 1376 snp_prepare(); 1372 - 1373 - /* SNP_INIT requires MSR_VM_HSAVE_PA to be cleared on all CPUs. */ 1374 - on_each_cpu(snp_set_hsave_pa, NULL, 1); 1375 1377 1376 1378 /* 1377 1379 * Starting in SNP firmware v1.52, the SNP_INIT_EX command takes a list