KVM: selftests: do not substitute SVM/VMX check with KVM_CAP_NESTED_STATE check
state_test/smm_test use KVM_CAP_NESTED_STATE check as an indicator for nested VMX/SVM presence and this is incorrect. Check for the required features dirrectly. Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com> Message-Id: <20200610135847.754289-2-vkuznets@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
committed by
Paolo Bonzini
parent
77f81f37fb
commit
41a23ab336
@@ -148,14 +148,18 @@ void run_guest(struct vmcb *vmcb, uint64_t vmcb_gpa)
|
||||
: "r15", "memory");
|
||||
}
|
||||
|
||||
void nested_svm_check_supported(void)
|
||||
bool nested_svm_supported(void)
|
||||
{
|
||||
struct kvm_cpuid_entry2 *entry =
|
||||
kvm_get_supported_cpuid_entry(0x80000001);
|
||||
|
||||
if (!(entry->ecx & CPUID_SVM)) {
|
||||
return entry->ecx & CPUID_SVM;
|
||||
}
|
||||
|
||||
void nested_svm_check_supported(void)
|
||||
{
|
||||
if (!nested_svm_supported()) {
|
||||
print_skip("nested SVM not enabled");
|
||||
exit(KSFT_SKIP);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -379,11 +379,16 @@ void prepare_vmcs(struct vmx_pages *vmx, void *guest_rip, void *guest_rsp)
|
||||
init_vmcs_guest_state(guest_rip, guest_rsp);
|
||||
}
|
||||
|
||||
void nested_vmx_check_supported(void)
|
||||
bool nested_vmx_supported(void)
|
||||
{
|
||||
struct kvm_cpuid_entry2 *entry = kvm_get_supported_cpuid_entry(1);
|
||||
|
||||
if (!(entry->ecx & CPUID_VMX)) {
|
||||
return entry->ecx & CPUID_VMX;
|
||||
}
|
||||
|
||||
void nested_vmx_check_supported(void)
|
||||
{
|
||||
if (!nested_vmx_supported()) {
|
||||
print_skip("nested VMX not enabled");
|
||||
exit(KSFT_SKIP);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user