]> git.baikalelectronics.ru Git - kernel.git/commitdiff
KVM: selftests: Use vcpu_clear_cpuid_feature() in monitor_mwait_test
authorSean Christopherson <seanjc@google.com>
Fri, 8 Jul 2022 21:42:49 +0000 (14:42 -0700)
committerSean Christopherson <seanjc@google.com>
Thu, 14 Jul 2022 01:14:17 +0000 (18:14 -0700)
Use vcpu_clear_cpuid_feature() to the MONITOR/MWAIT CPUID feature bit in
the MONITOR/MWAIT quirk test.

Signed-off-by: Sean Christopherson <seanjc@google.com>
tools/testing/selftests/kvm/x86_64/monitor_mwait_test.c

index 0ac5bec1e3b765d31111e2dc77d68274bb9b2ad8..016070cad36edb59405b4b10d42b7b398911d125 100644 (file)
@@ -63,8 +63,6 @@ static void guest_code(void)
 int main(int argc, char *argv[])
 {
        uint64_t disabled_quirks;
-       struct kvm_cpuid2 *cpuid;
-       struct kvm_cpuid_entry2 *entry;
        struct kvm_vcpu *vcpu;
        struct kvm_run *run;
        struct kvm_vm *vm;
@@ -73,14 +71,8 @@ int main(int argc, char *argv[])
 
        TEST_REQUIRE(kvm_has_cap(KVM_CAP_DISABLE_QUIRKS2));
 
-       cpuid = kvm_get_supported_cpuid();
-
-       entry = kvm_get_supported_cpuid_index(1, 0);
-       entry->ecx &= ~CPUID_MWAIT;
-       set_cpuid(cpuid, entry);
-
        vm = vm_create_with_one_vcpu(&vcpu, guest_code);
-       vcpu_set_cpuid(vcpu);
+       vcpu_clear_cpuid_feature(vcpu, X86_FEATURE_MWAIT);
 
        run = vcpu->run;