From: Raghavendra Rao Ananta Date: Thu, 7 Oct 2021 23:34:29 +0000 (+0000) Subject: KVM: arm64: selftests: Add support for cpu_relax X-Git-Tag: v6.1-rc5~2600^2~11^2~7^2~10 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=740826ec02a65a5b25335fddfe8bce4ac99c7a11;p=platform%2Fkernel%2Flinux-starfive.git KVM: arm64: selftests: Add support for cpu_relax Implement the guest helper routine, cpu_relax(), to yield the processor to other tasks. The function was derived from arch/arm64/include/asm/vdso/processor.h. Signed-off-by: Raghavendra Rao Ananta Reviewed-by: Oliver Upton Reviewed-by: Andrew Jones Signed-off-by: Marc Zyngier Link: https://lore.kernel.org/r/20211007233439.1826892-6-rananta@google.com --- diff --git a/tools/testing/selftests/kvm/include/aarch64/processor.h b/tools/testing/selftests/kvm/include/aarch64/processor.h index 9379778..265054c 100644 --- a/tools/testing/selftests/kvm/include/aarch64/processor.h +++ b/tools/testing/selftests/kvm/include/aarch64/processor.h @@ -122,6 +122,11 @@ void vm_install_exception_handler(struct kvm_vm *vm, void vm_install_sync_handler(struct kvm_vm *vm, int vector, int ec, handler_fn handler); +static inline void cpu_relax(void) +{ + asm volatile("yield" ::: "memory"); +} + #define isb() asm volatile("isb" : : : "memory") #define dsb(opt) asm volatile("dsb " #opt : : : "memory") #define dmb(opt) asm volatile("dmb " #opt : : : "memory")