summaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/kvm/system_counter_offset_test.c
diff options
context:
space:
mode:
authorSean Christopherson <seanjc@google.com>2022-06-02 13:41:33 -0700
committerPaolo Bonzini <pbonzini@redhat.com>2022-06-11 11:47:22 -0400
commit768e9a61856b75de08f5efa5813bb3e7f16ec271 (patch)
tree013104333c2f15ff33996b92a2b5b5dc6fc1853a /tools/testing/selftests/kvm/system_counter_offset_test.c
parent5260db3eb8f96c0dc631b0f41035a5f1957d9a58 (diff)
downloadlinux-768e9a61856b75de08f5efa5813bb3e7f16ec271.tar.bz2
KVM: selftests: Purge vm+vcpu_id == vcpu silliness
Take a vCPU directly instead of a VM+vcpu pair in all vCPU-scoped helpers and ioctls. Signed-off-by: Sean Christopherson <seanjc@google.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'tools/testing/selftests/kvm/system_counter_offset_test.c')
-rw-r--r--tools/testing/selftests/kvm/system_counter_offset_test.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/tools/testing/selftests/kvm/system_counter_offset_test.c b/tools/testing/selftests/kvm/system_counter_offset_test.c
index 0690ce0ae4fa..7c8be0930737 100644
--- a/tools/testing/selftests/kvm/system_counter_offset_test.c
+++ b/tools/testing/selftests/kvm/system_counter_offset_test.c
@@ -28,8 +28,7 @@ static struct test_case test_cases[] = {
static void check_preconditions(struct kvm_vcpu *vcpu)
{
- if (!__vcpu_has_device_attr(vcpu->vm, vcpu->id, KVM_VCPU_TSC_CTRL,
- KVM_VCPU_TSC_OFFSET))
+ if (!__vcpu_has_device_attr(vcpu, KVM_VCPU_TSC_CTRL, KVM_VCPU_TSC_OFFSET))
return;
print_skip("KVM_VCPU_TSC_OFFSET not supported; skipping test");
@@ -38,8 +37,8 @@ static void check_preconditions(struct kvm_vcpu *vcpu)
static void setup_system_counter(struct kvm_vcpu *vcpu, struct test_case *test)
{
- vcpu_device_attr_set(vcpu->vm, vcpu->id, KVM_VCPU_TSC_CTRL,
- KVM_VCPU_TSC_OFFSET, &test->tsc_offset);
+ vcpu_device_attr_set(vcpu, KVM_VCPU_TSC_CTRL, KVM_VCPU_TSC_OFFSET,
+ &test->tsc_offset);
}
static uint64_t guest_read_system_counter(struct test_case *test)
@@ -101,10 +100,10 @@ static void enter_guest(struct kvm_vcpu *vcpu)
setup_system_counter(vcpu, test);
start = host_read_guest_system_counter(test);
- vcpu_run(vcpu->vm, vcpu->id);
+ vcpu_run(vcpu);
end = host_read_guest_system_counter(test);
- switch (get_ucall(vcpu->vm, vcpu->id, &uc)) {
+ switch (get_ucall(vcpu, &uc)) {
case UCALL_SYNC:
handle_sync(&uc, start, end);
break;
@@ -113,7 +112,7 @@ static void enter_guest(struct kvm_vcpu *vcpu)
return;
default:
TEST_ASSERT(0, "unhandled ucall %ld\n",
- get_ucall(vcpu->vm, vcpu->id, &uc));
+ get_ucall(vcpu, &uc));
}
}
}