Skip to content

Commit 853c110

Browse files
committed
KVM: x86: support CONFIG_KVM_AMD=y with CONFIG_CRYPTO_DEV_CCP_DD=m
SEV requires access to the AMD cryptographic device APIs, and this does not work when KVM is builtin and the crypto driver is a module. Actually the Kconfig conditions for CONFIG_KVM_AMD_SEV try to disable SEV in that case, but it does not work because the actual crypto calls are not culled, only sev_hardware_setup() is. This patch adds two CONFIG_KVM_AMD_SEV checks that gate all the remaining SEV code; it fixes this particular configuration, and drops 5 KiB of code when CONFIG_KVM_AMD_SEV=n. Reported-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
1 parent cc906f0 commit 853c110

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

arch/x86/kvm/svm.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,14 +436,18 @@ static inline struct kvm_svm *to_kvm_svm(struct kvm *kvm)
436436

437437
static inline bool svm_sev_enabled(void)
438438
{
439-
return max_sev_asid;
439+
return IS_ENABLED(CONFIG_KVM_AMD_SEV) ? max_sev_asid : 0;
440440
}
441441

442442
static inline bool sev_guest(struct kvm *kvm)
443443
{
444+
#ifdef CONFIG_KVM_AMD_SEV
444445
struct kvm_sev_info *sev = &to_kvm_svm(kvm)->sev_info;
445446

446447
return sev->active;
448+
#else
449+
return false;
450+
#endif
447451
}
448452

449453
static inline int sev_get_asid(struct kvm *kvm)

0 commit comments

Comments
 (0)