summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/kvm/lib/s390x/processor.c
diff options
context:
space:
mode:
authorSean Christopherson <seanjc@google.com>2022-02-15 11:31:16 -0800
committerPaolo Bonzini <pbonzini@redhat.com>2022-06-11 10:18:05 -0400
commit47a7c924b62de4b9d1752c1f5bc111c847229799 (patch)
treeb94a4e579fe190cc455bd163c4f85ac6543819e5 /tools/testing/selftests/kvm/lib/s390x/processor.c
parent21c6ee2b3ac25b36cba22a2c725382ff7706dc95 (diff)
KVM: selftests: Add vcpu_get() to retrieve and assert on vCPU existence
Add vcpu_get() to wrap vcpu_find() and deduplicate a pile of code that asserts the requested vCPU exists. Signed-off-by: Sean Christopherson <seanjc@google.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'tools/testing/selftests/kvm/lib/s390x/processor.c')
-rw-r--r--tools/testing/selftests/kvm/lib/s390x/processor.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/tools/testing/selftests/kvm/lib/s390x/processor.c b/tools/testing/selftests/kvm/lib/s390x/processor.c
index f87c7137598e..7cc1051c4b71 100644
--- a/tools/testing/selftests/kvm/lib/s390x/processor.c
+++ b/tools/testing/selftests/kvm/lib/s390x/processor.c
@@ -208,10 +208,7 @@ void vcpu_args_set(struct kvm_vm *vm, uint32_t vcpuid, unsigned int num, ...)
void vcpu_dump(FILE *stream, struct kvm_vm *vm, uint32_t vcpuid, uint8_t indent)
{
- struct vcpu *vcpu = vcpu_find(vm, vcpuid);
-
- if (!vcpu)
- return;
+ struct vcpu *vcpu = vcpu_get(vm, vcpuid);
fprintf(stream, "%*spstate: psw: 0x%.16llx:0x%.16llx\n",
indent, "", vcpu->state->psw_mask, vcpu->state->psw_addr);