summaryrefslogtreecommitdiff
path: root/include/uapi
diff options
context:
space:
mode:
authorAnup Patel <apatel@ventanamicro.com>2022-07-29 14:44:53 +0300
committerAnup Patel <anup@brainfault.org>2022-07-29 14:44:53 +0300
commit8a061562e2f2b32bfb5bff5bf3afc64e37d95a27 (patch)
treeca9fef5fb33c95fe9580daf738f3c033e5c92270 /include/uapi
parent1222b55cee2396a1a286e924d9f6abb6d7a04f55 (diff)
downloadlinux-8a061562e2f2b32bfb5bff5bf3afc64e37d95a27.tar.xz
RISC-V: KVM: Add extensible CSR emulation framework
We add an extensible CSR emulation framework which is based upon the existing system instruction emulation. This will be useful to upcoming AIA, PMU, Nested and other virtualization features. The CSR emulation framework also has provision to emulate CSR in user space but this will be used only in very specific cases such as AIA IMSIC CSR emulation in user space or vendor specific CSR emulation in user space. By default, all CSRs not handled by KVM RISC-V will be redirected back to Guest VCPU as illegal instruction trap. Signed-off-by: Anup Patel <apatel@ventanamicro.com> Signed-off-by: Anup Patel <anup@brainfault.org>
Diffstat (limited to 'include/uapi')
-rw-r--r--include/uapi/linux/kvm.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h
index 860f867c50c0..0c1f42a40fd3 100644
--- a/include/uapi/linux/kvm.h
+++ b/include/uapi/linux/kvm.h
@@ -270,6 +270,7 @@ struct kvm_xen_exit {
#define KVM_EXIT_X86_BUS_LOCK 33
#define KVM_EXIT_XEN 34
#define KVM_EXIT_RISCV_SBI 35
+#define KVM_EXIT_RISCV_CSR 36
/* For KVM_EXIT_INTERNAL_ERROR */
/* Emulate instruction failed. */
@@ -496,6 +497,13 @@ struct kvm_run {
unsigned long args[6];
unsigned long ret[2];
} riscv_sbi;
+ /* KVM_EXIT_RISCV_CSR */
+ struct {
+ unsigned long csr_num;
+ unsigned long new_value;
+ unsigned long write_mask;
+ unsigned long ret_value;
+ } riscv_csr;
/* Fix the size of the union. */
char padding[256];
};