RISC-V: KVM: Add extensible CSR emulation framework
authorAnup Patel <apatel@ventanamicro.com>
Fri, 29 Jul 2022 11:44:53 +0000 (17:14 +0530)
committerAnup Patel <anup@brainfault.org>
Fri, 29 Jul 2022 11:44:53 +0000 (17:14 +0530)
commit8a061562e2f2b32bfb5bff5bf3afc64e37d95a27
treeca9fef5fb33c95fe9580daf738f3c033e5c92270
parent1222b55cee2396a1a286e924d9f6abb6d7a04f55
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>
arch/riscv/include/asm/kvm_host.h
arch/riscv/include/asm/kvm_vcpu_insn.h
arch/riscv/kvm/vcpu.c
arch/riscv/kvm/vcpu_insn.c
include/uapi/linux/kvm.h