Skip to content

Commit 44e7071

Browse files
sean-jcbonzini
authored andcommitted
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. Signed-off-by: Sean Christopherson <seanjc@google.com> Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com> Signed-off-by: Ashish Kalra <ashish.kalra@amd.com> Message-ID: <f78ddb64087df27e7bcb1ae0ab53f55aa0804fab.1739226950.git.ashish.kalra@amd.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
1 parent 435b344 commit 44e7071

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
@@ -2972,6 +2972,16 @@ void __init sev_hardware_setup(void)
29722972
WARN_ON_ONCE(!boot_cpu_has(X86_FEATURE_FLUSHBYASID)))
29732973
goto out;
29742974

2975+
/*
2976+
* The kernel's initcall infrastructure lacks the ability to express
2977+
* dependencies between initcalls, whereas the modules infrastructure
2978+
* automatically handles dependencies via symbol loading. Ensure the
2979+
* PSP SEV driver is initialized before proceeding if KVM is built-in,
2980+
* as the dependency isn't handled by the initcall infrastructure.
2981+
*/
2982+
if (IS_BUILTIN(CONFIG_KVM_AMD) && sev_module_init())
2983+
goto out;
2984+
29752985
/* Retrieve SEV CPUID information */
29762986
cpuid(0x8000001f, &eax, &ebx, &ecx, &edx);
29772987

0 commit comments

Comments
 (0)