Skip to content

Commit 740826e

Browse files
rananta468Marc Zyngier
authored andcommitted
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 <[email protected]> Reviewed-by: Oliver Upton <[email protected]> Reviewed-by: Andrew Jones <[email protected]> Signed-off-by: Marc Zyngier <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent b3c79c6 commit 740826e

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

tools/testing/selftests/kvm/include/aarch64/processor.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,11 @@ void vm_install_exception_handler(struct kvm_vm *vm,
122122
void vm_install_sync_handler(struct kvm_vm *vm,
123123
int vector, int ec, handler_fn handler);
124124

125+
static inline void cpu_relax(void)
126+
{
127+
asm volatile("yield" ::: "memory");
128+
}
129+
125130
#define isb() asm volatile("isb" : : : "memory")
126131
#define dsb(opt) asm volatile("dsb " #opt : : : "memory")
127132
#define dmb(opt) asm volatile("dmb " #opt : : : "memory")

0 commit comments

Comments
 (0)