1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Copyright (c) 2022 Ventana Micro Systems Inc.
6 #ifndef __KVM_VCPU_RISCV_INSN_H
7 #define __KVM_VCPU_RISCV_INSN_H
13 struct kvm_mmio_decode
{
21 struct kvm_csr_decode
{
26 /* Return values used by function emulating a particular instruction */
27 enum kvm_insn_return
{
28 KVM_INSN_EXIT_TO_USER_SPACE
= 0,
29 KVM_INSN_CONTINUE_NEXT_SEPC
,
30 KVM_INSN_CONTINUE_SAME_SEPC
,
31 KVM_INSN_ILLEGAL_TRAP
,
35 void kvm_riscv_vcpu_wfi(struct kvm_vcpu
*vcpu
);
36 int kvm_riscv_vcpu_csr_return(struct kvm_vcpu
*vcpu
, struct kvm_run
*run
);
37 int kvm_riscv_vcpu_virtual_insn(struct kvm_vcpu
*vcpu
, struct kvm_run
*run
,
38 struct kvm_cpu_trap
*trap
);
40 int kvm_riscv_vcpu_mmio_load(struct kvm_vcpu
*vcpu
, struct kvm_run
*run
,
41 unsigned long fault_addr
,
42 unsigned long htinst
);
43 int kvm_riscv_vcpu_mmio_store(struct kvm_vcpu
*vcpu
, struct kvm_run
*run
,
44 unsigned long fault_addr
,
45 unsigned long htinst
);
46 int kvm_riscv_vcpu_mmio_return(struct kvm_vcpu
*vcpu
, struct kvm_run
*run
);