KVM: selftests: Make test skipping consistent
Signed-off-by: Andrew Jones <drjones@redhat.com> Message-Id: <20201111122636.73346-12-drjones@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
87c5f35e5c
commit
08d3e27718
@ -211,8 +211,8 @@ int main(void)
|
|||||||
struct kvm_vm *vm;
|
struct kvm_vm *vm;
|
||||||
|
|
||||||
if (!kvm_check_cap(KVM_CAP_ENFORCE_PV_FEATURE_CPUID)) {
|
if (!kvm_check_cap(KVM_CAP_ENFORCE_PV_FEATURE_CPUID)) {
|
||||||
pr_info("will skip kvm paravirt restriction tests.\n");
|
print_skip("KVM_CAP_ENFORCE_PV_FEATURE_CPUID not supported");
|
||||||
return 0;
|
exit(KSFT_SKIP);
|
||||||
}
|
}
|
||||||
|
|
||||||
vm = vm_create_default(VCPU_ID, 0, guest_main);
|
vm = vm_create_default(VCPU_ID, 0, guest_main);
|
||||||
|
@ -209,7 +209,11 @@ int main(int argc, char *argv[])
|
|||||||
run = vcpu_state(vm, VCPU_ID);
|
run = vcpu_state(vm, VCPU_ID);
|
||||||
|
|
||||||
rc = kvm_check_cap(KVM_CAP_X86_USER_SPACE_MSR);
|
rc = kvm_check_cap(KVM_CAP_X86_USER_SPACE_MSR);
|
||||||
TEST_ASSERT(rc, "KVM_CAP_X86_USER_SPACE_MSR is available");
|
if (!rc) {
|
||||||
|
print_skip("KVM_CAP_X86_USER_SPACE_MSR not supported");
|
||||||
|
exit(KSFT_SKIP);
|
||||||
|
}
|
||||||
|
|
||||||
vm_enable_cap(vm, &cap);
|
vm_enable_cap(vm, &cap);
|
||||||
|
|
||||||
rc = kvm_check_cap(KVM_CAP_X86_MSR_FILTER);
|
rc = kvm_check_cap(KVM_CAP_X86_MSR_FILTER);
|
||||||
|
@ -169,6 +169,11 @@ int main(int argc, char *argv[])
|
|||||||
*/
|
*/
|
||||||
nested_vmx_check_supported();
|
nested_vmx_check_supported();
|
||||||
|
|
||||||
|
if (!kvm_check_cap(KVM_CAP_NESTED_STATE)) {
|
||||||
|
print_skip("KVM_CAP_NESTED_STATE not supported");
|
||||||
|
exit(KSFT_SKIP);
|
||||||
|
}
|
||||||
|
|
||||||
/* Create VM */
|
/* Create VM */
|
||||||
vm = vm_create_default(VCPU_ID, 0, guest_code);
|
vm = vm_create_default(VCPU_ID, 0, guest_code);
|
||||||
vcpu_set_cpuid(vm, VCPU_ID, kvm_get_supported_cpuid());
|
vcpu_set_cpuid(vm, VCPU_ID, kvm_get_supported_cpuid());
|
||||||
@ -176,13 +181,8 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
vcpu_regs_get(vm, VCPU_ID, ®s1);
|
vcpu_regs_get(vm, VCPU_ID, ®s1);
|
||||||
|
|
||||||
if (kvm_check_cap(KVM_CAP_NESTED_STATE)) {
|
vcpu_alloc_vmx(vm, &vmx_pages_gva);
|
||||||
vcpu_alloc_vmx(vm, &vmx_pages_gva);
|
vcpu_args_set(vm, VCPU_ID, 1, vmx_pages_gva);
|
||||||
vcpu_args_set(vm, VCPU_ID, 1, vmx_pages_gva);
|
|
||||||
} else {
|
|
||||||
pr_info("will skip vmx preemption timer checks\n");
|
|
||||||
goto done;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (stage = 1;; stage++) {
|
for (stage = 1;; stage++) {
|
||||||
_vcpu_run(vm, VCPU_ID);
|
_vcpu_run(vm, VCPU_ID);
|
||||||
|
Loading…
Reference in New Issue
Block a user