1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Copyright (c) 2021 Western Digital Corporation or its affiliates.
6 * Atish Patra <atish.patra@wdc.com>
9 #ifndef __RISCV_KVM_VCPU_SBI_H__
10 #define __RISCV_KVM_VCPU_SBI_H__
12 #define KVM_SBI_IMPID 3
14 #define KVM_SBI_VERSION_MAJOR 0
15 #define KVM_SBI_VERSION_MINOR 3
17 struct kvm_vcpu_sbi_extension {
18 unsigned long extid_start;
19 unsigned long extid_end;
21 * SBI extension handler. It can be defined for a given extension or group of
22 * extension. But it should always return linux error codes rather than SBI
23 * specific error codes.
25 int (*handler)(struct kvm_vcpu *vcpu, struct kvm_run *run,
26 unsigned long *out_val, struct kvm_cpu_trap *utrap,
30 void kvm_riscv_vcpu_sbi_forward(struct kvm_vcpu *vcpu, struct kvm_run *run);
31 void kvm_riscv_vcpu_sbi_system_reset(struct kvm_vcpu *vcpu,
34 const struct kvm_vcpu_sbi_extension *kvm_vcpu_sbi_find_ext(unsigned long extid);
36 #endif /* __RISCV_KVM_VCPU_SBI_H__ */