Replace calls to kvm_check_cap() that treat its return as a boolean with
calls to kvm_has_cap(). Several instances of kvm_check_cap() were missed
when kvm_has_cap() was introduced.
Reported-by: Andrew Jones <drjones@redhat.com>
Fixes:
3ea9b809650b ("KVM: selftests: Add kvm_has_cap() to provide syntactic sugar")
Signed-off-by: Sean Christopherson <seanjc@google.com>
Message-Id: <
20220613161942.1586791-5-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
int main(void)
{
- TEST_REQUIRE(kvm_check_cap(KVM_CAP_ARM_SYSTEM_SUSPEND));
+ TEST_REQUIRE(kvm_has_cap(KVM_CAP_ARM_SYSTEM_SUSPEND));
host_test_cpu_on();
host_test_system_suspend();
vcpu_regs_get(vcpu, &state->regs);
vcpu_save_xsave_state(vcpu, state);
- if (kvm_check_cap(KVM_CAP_XCRS))
+ if (kvm_has_cap(KVM_CAP_XCRS))
vcpu_xcrs_get(vcpu, &state->xcrs);
vcpu_sregs_get(vcpu, &state->sregs);
vcpu_sregs_set(vcpu, &state->sregs);
vcpu_msrs_set(vcpu, &state->msrs);
- if (kvm_check_cap(KVM_CAP_XCRS))
+ if (kvm_has_cap(KVM_CAP_XCRS))
vcpu_xcrs_set(vcpu, &state->xcrs);
vcpu_xsave_set(vcpu, state->xsave);
struct kvm_vm *vm;
int idx;
- TEST_REQUIRE(kvm_check_cap(KVM_CAP_SYNC_REGS));
+ TEST_REQUIRE(kvm_has_cap(KVM_CAP_SYNC_REGS));
/* Tell stdout not to buffer its content */
setbuf(stdout, NULL);
/* Tell stdout not to buffer its content */
setbuf(stdout, NULL);
- TEST_REQUIRE(kvm_check_cap(KVM_CAP_PMU_EVENT_FILTER));
+ TEST_REQUIRE(kvm_has_cap(KVM_CAP_PMU_EVENT_FILTER));
TEST_REQUIRE(use_intel_pmu() || use_amd_pmu());
guest_code = use_intel_pmu() ? intel_guest_code : amd_guest_code;
have_sev_es = !!(cpuid->eax & X86_FEATURE_SEV_ES);
- if (kvm_check_cap(KVM_CAP_VM_MOVE_ENC_CONTEXT_FROM)) {
+ if (kvm_has_cap(KVM_CAP_VM_MOVE_ENC_CONTEXT_FROM)) {
test_sev_migrate_from(/* es= */ false);
if (have_sev_es)
test_sev_migrate_from(/* es= */ true);
test_sev_migrate_locking();
test_sev_migrate_parameters();
- if (kvm_check_cap(KVM_CAP_VM_COPY_ENC_CONTEXT_FROM))
+ if (kvm_has_cap(KVM_CAP_VM_COPY_ENC_CONTEXT_FROM))
test_sev_move_copy();
}
- if (kvm_check_cap(KVM_CAP_VM_COPY_ENC_CONTEXT_FROM)) {
+ if (kvm_has_cap(KVM_CAP_VM_COPY_ENC_CONTEXT_FROM)) {
test_sev_mirror(/* es= */ false);
if (have_sev_es)
test_sev_mirror(/* es= */ true);
vcpu_set_msr(vcpu, MSR_IA32_SMBASE, SMRAM_GPA);
- if (kvm_check_cap(KVM_CAP_NESTED_STATE)) {
+ if (kvm_has_cap(KVM_CAP_NESTED_STATE)) {
if (nested_svm_supported())
vcpu_alloc_svm(vm, &nested_gva);
else if (nested_vmx_supported())
vcpu_regs_get(vcpu, ®s1);
- if (kvm_check_cap(KVM_CAP_NESTED_STATE)) {
+ if (kvm_has_cap(KVM_CAP_NESTED_STATE)) {
if (nested_svm_supported())
vcpu_alloc_svm(vm, &nested_gva);
else if (nested_vmx_supported())