summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/kvm/lib/x86_64/ucall.c
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2022-08-04 15:27:35 +0100
committerMark Brown <broonie@kernel.org>2022-08-04 15:27:35 +0100
commit09efcb1c4a2dfffd7ec92055de289406bce5df4c (patch)
tree6bf19dd825f16f81a08515cc2d6b4472fdd3f72e /tools/testing/selftests/kvm/lib/x86_64/ucall.c
parent89c06c948e62505ce78ba5c70819098fab7429a0 (diff)
parent281106f938d3daaea6f8b6723a8217a2a1ef6936 (diff)
Merge branch 'next' of git://git.kernel.org/pub/scm/virt/kvm/kvm.git
Diffstat (limited to 'tools/testing/selftests/kvm/lib/x86_64/ucall.c')
-rw-r--r--tools/testing/selftests/kvm/lib/x86_64/ucall.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/tools/testing/selftests/kvm/lib/x86_64/ucall.c b/tools/testing/selftests/kvm/lib/x86_64/ucall.c
index a3489973e290..e5f0f9e0d3ee 100644
--- a/tools/testing/selftests/kvm/lib/x86_64/ucall.c
+++ b/tools/testing/selftests/kvm/lib/x86_64/ucall.c
@@ -24,7 +24,7 @@ void ucall(uint64_t cmd, int nargs, ...)
va_list va;
int i;
- nargs = nargs <= UCALL_MAX_ARGS ? nargs : UCALL_MAX_ARGS;
+ nargs = min(nargs, UCALL_MAX_ARGS);
va_start(va, nargs);
for (i = 0; i < nargs; ++i)
@@ -35,9 +35,9 @@ void ucall(uint64_t cmd, int nargs, ...)
: : [port] "d" (UCALL_PIO_PORT), "D" (&uc) : "rax", "memory");
}
-uint64_t get_ucall(struct kvm_vm *vm, uint32_t vcpu_id, struct ucall *uc)
+uint64_t get_ucall(struct kvm_vcpu *vcpu, struct ucall *uc)
{
- struct kvm_run *run = vcpu_state(vm, vcpu_id);
+ struct kvm_run *run = vcpu->run;
struct ucall ucall = {};
if (uc)
@@ -46,11 +46,11 @@ uint64_t get_ucall(struct kvm_vm *vm, uint32_t vcpu_id, struct ucall *uc)
if (run->exit_reason == KVM_EXIT_IO && run->io.port == UCALL_PIO_PORT) {
struct kvm_regs regs;
- vcpu_regs_get(vm, vcpu_id, &regs);
- memcpy(&ucall, addr_gva2hva(vm, (vm_vaddr_t)regs.rdi),
+ vcpu_regs_get(vcpu, &regs);
+ memcpy(&ucall, addr_gva2hva(vcpu->vm, (vm_vaddr_t)regs.rdi),
sizeof(ucall));
- vcpu_run_complete_io(vm, vcpu_id);
+ vcpu_run_complete_io(vcpu);
if (uc)
memcpy(uc, &ucall, sizeof(ucall));
}