aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/kvm/include/aarch64/processor.h
diff options
context:
space:
mode:
authorOliver Upton <oupton@google.com>2022-04-09 18:45:46 +0000
committerMarc Zyngier <maz@kernel.org>2022-05-03 21:30:20 +0100
commite918e2bc52c8ac1cccd6ef822ac23eded41761b6 (patch)
tree843d473fe466f7378747648b316defecba4c727d /tools/testing/selftests/kvm/include/aarch64/processor.h
parentselftests: KVM: Rename psci_cpu_on_test to psci_test (diff)
downloadlinux-e918e2bc52c8ac1cccd6ef822ac23eded41761b6.tar.gz
linux-e918e2bc52c8ac1cccd6ef822ac23eded41761b6.zip
selftests: KVM: Create helper for making SMCCC calls
The PSCI and PV stolen time tests both need to make SMCCC calls within the guest. Create a helper for making SMCCC calls and rework the existing tests to use the library function. Signed-off-by: Oliver Upton <oupton@google.com> Reviewed-by: Andrew Jones <drjones@redhat.com> Signed-off-by: Marc Zyngier <maz@kernel.org> Link: https://lore.kernel.org/r/20220409184549.1681189-11-oupton@google.com
Diffstat (limited to 'tools/testing/selftests/kvm/include/aarch64/processor.h')
-rw-r--r--tools/testing/selftests/kvm/include/aarch64/processor.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/tools/testing/selftests/kvm/include/aarch64/processor.h b/tools/testing/selftests/kvm/include/aarch64/processor.h
index 8f9f46979a00..59ece9d4e0d1 100644
--- a/tools/testing/selftests/kvm/include/aarch64/processor.h
+++ b/tools/testing/selftests/kvm/include/aarch64/processor.h
@@ -185,4 +185,26 @@ static inline void local_irq_disable(void)
asm volatile("msr daifset, #3" : : : "memory");
}
+/**
+ * struct arm_smccc_res - Result from SMC/HVC call
+ * @a0-a3 result values from registers 0 to 3
+ */
+struct arm_smccc_res {
+ unsigned long a0;
+ unsigned long a1;
+ unsigned long a2;
+ unsigned long a3;
+};
+
+/**
+ * smccc_hvc - Invoke a SMCCC function using the hvc conduit
+ * @function_id: the SMCCC function to be called
+ * @arg0-arg6: SMCCC function arguments, corresponding to registers x1-x7
+ * @res: pointer to write the return values from registers x0-x3
+ *
+ */
+void smccc_hvc(uint32_t function_id, uint64_t arg0, uint64_t arg1,
+ uint64_t arg2, uint64_t arg3, uint64_t arg4, uint64_t arg5,
+ uint64_t arg6, struct arm_smccc_res *res);
+
#endif /* SELFTEST_KVM_PROCESSOR_H */