summaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/kvm/include/ucall_common.h
diff options
context:
space:
mode:
authorSean Christopherson <seanjc@google.com>2022-11-19 02:34:44 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2022-12-02 19:22:31 +0100
commitef16b2dff4d1c71eb32b306d400d4c0f3a383ba7 (patch)
tree8209f55b3709730fd025e0a26613f1764d64f14f /tools/testing/selftests/kvm/include/ucall_common.h
parentKVM: x86: fix APICv/x2AVIC disabled when vm reboot by itself (diff)
downloadlinux-ef16b2dff4d1c71eb32b306d400d4c0f3a383ba7.tar.xz
linux-ef16b2dff4d1c71eb32b306d400d4c0f3a383ba7.zip
KVM: arm64: selftests: Enable single-step without a "full" ucall()
Add a new ucall hook, GUEST_UCALL_NONE(), to allow tests to make ucalls without allocating a ucall struct, and use it to enable single-step in ARM's debug-exceptions test. Like the disable single-step path, the enabling path also needs to ensure that no exclusive access sequences are attempted after enabling single-step, as the exclusive monitor is cleared on ERET from the debug exception taken to EL2. The test currently "works" because clear_bit() isn't actually an atomic operation... yet. Signed-off-by: Sean Christopherson <seanjc@google.com> Message-Id: <20221119013450.2643007-4-seanjc@google.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'tools/testing/selftests/kvm/include/ucall_common.h')
-rw-r--r--tools/testing/selftests/kvm/include/ucall_common.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/tools/testing/selftests/kvm/include/ucall_common.h b/tools/testing/selftests/kvm/include/ucall_common.h
index bdd373189a77..1a6aaef5ccae 100644
--- a/tools/testing/selftests/kvm/include/ucall_common.h
+++ b/tools/testing/selftests/kvm/include/ucall_common.h
@@ -35,6 +35,14 @@ void ucall(uint64_t cmd, int nargs, ...);
uint64_t get_ucall(struct kvm_vcpu *vcpu, struct ucall *uc);
void ucall_init(struct kvm_vm *vm, vm_paddr_t mmio_gpa);
+/*
+ * Perform userspace call without any associated data. This bare call avoids
+ * allocating a ucall struct, which can be useful if the atomic operations in
+ * the full ucall() are problematic and/or unwanted. Note, this will come out
+ * as UCALL_NONE on the backend.
+ */
+#define GUEST_UCALL_NONE() ucall_arch_do_ucall((vm_vaddr_t)NULL)
+
#define GUEST_SYNC_ARGS(stage, arg1, arg2, arg3, arg4) \
ucall(UCALL_SYNC, 6, "hello", stage, arg1, arg2, arg3, arg4)
#define GUEST_SYNC(stage) ucall(UCALL_SYNC, 2, "hello", stage)