Skip to content

Commit a613666

Browse files
committed
KVM: SVM: Ensure PSP module is initialized if KVM module is built-in
The kernel's initcall infrastructure lacks the ability to express dependencies between initcalls, whereas the modules infrastructure automatically handles dependencies via symbol loading. Ensure the PSP SEV driver is initialized before proceeding in sev_hardware_setup() if KVM is built-in as the dependency isn't handled by the initcall infrastructure. Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com> Signed-off-by: Ashish Kalra <ashish.kalra@amd.com> Link: https://lore.kernel.org/r/f78ddb64087df27e7bcb1ae0ab53f55aa0804fab.1739226950.git.ashish.kalra@amd.com Signed-off-by: Sean Christopherson <seanjc@google.com>
1 parent f735425 commit a613666

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

arch/x86/kvm/svm/sev.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2951,6 +2951,16 @@ void __init sev_hardware_setup(void)
29512951
WARN_ON_ONCE(!boot_cpu_has(X86_FEATURE_FLUSHBYASID)))
29522952
goto out;
29532953

2954+
/*
2955+
* The kernel's initcall infrastructure lacks the ability to express
2956+
* dependencies between initcalls, whereas the modules infrastructure
2957+
* automatically handles dependencies via symbol loading. Ensure the
2958+
* PSP SEV driver is initialized before proceeding if KVM is built-in,
2959+
* as the dependency isn't handled by the initcall infrastructure.
2960+
*/
2961+
if (IS_BUILTIN(CONFIG_KVM_AMD) && sev_module_init())
2962+
goto out;
2963+
29542964
/* Retrieve SEV CPUID information */
29552965
cpuid(0x8000001f, &eax, &ebx, &ecx, &edx);
29562966

0 commit comments

Comments
 (0)