Skip to content

Commit 281106f

Browse files
avaginbonzini
authored andcommitted
selftests: kvm: set rax before vmcall
kvm_hypercall has to place the hypercall number in rax. Trace events show that kvm_pv_test doesn't work properly: kvm_pv_test-53132: kvm_hypercall: nr 0x0 a0 0x0 a1 0x0 a2 0x0 a3 0x0 kvm_pv_test-53132: kvm_hypercall: nr 0x0 a0 0x0 a1 0x0 a2 0x0 a3 0x0 kvm_pv_test-53132: kvm_hypercall: nr 0x0 a0 0x0 a1 0x0 a2 0x0 a3 0x0 With this change, it starts working as expected: kvm_pv_test-54285: kvm_hypercall: nr 0x5 a0 0x0 a1 0x0 a2 0x0 a3 0x0 kvm_pv_test-54285: kvm_hypercall: nr 0xa a0 0x0 a1 0x0 a2 0x0 a3 0x0 kvm_pv_test-54285: kvm_hypercall: nr 0xb a0 0x0 a1 0x0 a2 0x0 a3 0x0 Signed-off-by: Andrei Vagin <avagin@google.com> Message-Id: <20220722230241.1944655-5-avagin@google.com> Fixes: ac4a4d6 ("selftests: kvm: test enforcement of paravirtual cpuid features") Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
1 parent dd4d1c3 commit 281106f

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

tools/testing/selftests/kvm/lib/x86_64/processor.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1184,7 +1184,7 @@ uint64_t kvm_hypercall(uint64_t nr, uint64_t a0, uint64_t a1, uint64_t a2,
11841184

11851185
asm volatile("vmcall"
11861186
: "=a"(r)
1187-
: "b"(a0), "c"(a1), "d"(a2), "S"(a3));
1187+
: "a"(nr), "b"(a0), "c"(a1), "d"(a2), "S"(a3));
11881188
return r;
11891189
}
11901190

0 commit comments

Comments
 (0)