]> git.baikalelectronics.ru Git - kernel.git/commitdiff
KVM: selftests: Use vcpu_get_cpuid_entry() in CPUID test
authorSean Christopherson <seanjc@google.com>
Tue, 14 Jun 2022 20:06:52 +0000 (20:06 +0000)
committerSean Christopherson <seanjc@google.com>
Thu, 14 Jul 2022 01:14:19 +0000 (18:14 -0700)
Use vcpu_get_cpuid_entry() instead of an open coded equivalent in the
CPUID test.

No functional change intended.

Signed-off-by: Sean Christopherson <seanjc@google.com>
Link: https://lore.kernel.org/r/20220614200707.3315957-28-seanjc@google.com
tools/testing/selftests/kvm/x86_64/cpuid_test.c

index a9345cee9bbc113ab099b3e98de106cdce88c586..7bbc1837b3895e4640bea24566c8b3e9dac5dca4 100644 (file)
@@ -146,7 +146,6 @@ struct kvm_cpuid2 *vcpu_alloc_cpuid(struct kvm_vm *vm, vm_vaddr_t *p_gva, struct
 
 static void set_cpuid_after_run(struct kvm_vcpu *vcpu)
 {
-       struct kvm_cpuid2 *cpuid = vcpu->cpuid;
        struct kvm_cpuid_entry2 *ent;
        int rc;
        u32 eax, ebx, x;
@@ -156,7 +155,7 @@ static void set_cpuid_after_run(struct kvm_vcpu *vcpu)
        TEST_ASSERT(!rc, "Setting unmodified CPUID after KVM_RUN failed: %d", rc);
 
        /* Changing CPU features is forbidden */
-       ent = get_cpuid_entry(cpuid, 0x7, 0);
+       ent = vcpu_get_cpuid_entry(vcpu, 0x7);
        ebx = ent->ebx;
        ent->ebx--;
        rc = __vcpu_set_cpuid(vcpu);
@@ -164,7 +163,7 @@ static void set_cpuid_after_run(struct kvm_vcpu *vcpu)
        ent->ebx = ebx;
 
        /* Changing MAXPHYADDR is forbidden */
-       ent = get_cpuid_entry(cpuid, 0x80000008, 0);
+       ent = vcpu_get_cpuid_entry(vcpu, 0x80000008);
        eax = ent->eax;
        x = eax & 0xff;
        ent->eax = (eax & ~0xffu) | (x - 1);