xref: /linux/tools/testing/selftests/kvm/include/loongarch/ucall.h (revision 43db1111073049220381944af4a3b8a5400eda71)
1*304b93b1SBibo Mao /* SPDX-License-Identifier: GPL-2.0-only */
2*304b93b1SBibo Mao #ifndef SELFTEST_KVM_UCALL_H
3*304b93b1SBibo Mao #define SELFTEST_KVM_UCALL_H
4*304b93b1SBibo Mao 
5*304b93b1SBibo Mao #include "kvm_util.h"
6*304b93b1SBibo Mao 
7*304b93b1SBibo Mao #define UCALL_EXIT_REASON       KVM_EXIT_MMIO
8*304b93b1SBibo Mao 
9*304b93b1SBibo Mao /*
10*304b93b1SBibo Mao  * ucall_exit_mmio_addr holds per-VM values (global data is duplicated by each
11*304b93b1SBibo Mao  * VM), it must not be accessed from host code.
12*304b93b1SBibo Mao  */
13*304b93b1SBibo Mao extern vm_vaddr_t *ucall_exit_mmio_addr;
14*304b93b1SBibo Mao 
ucall_arch_do_ucall(vm_vaddr_t uc)15*304b93b1SBibo Mao static inline void ucall_arch_do_ucall(vm_vaddr_t uc)
16*304b93b1SBibo Mao {
17*304b93b1SBibo Mao 	WRITE_ONCE(*ucall_exit_mmio_addr, uc);
18*304b93b1SBibo Mao }
19*304b93b1SBibo Mao 
20*304b93b1SBibo Mao #endif
21