]> git.baikalelectronics.ru Git - kernel.git/commit
RISC-V: KVM: Handle MMIO exits for VCPU
authorAnup Patel <anup.patel@wdc.com>
Mon, 27 Sep 2021 11:40:06 +0000 (17:10 +0530)
committerAnup Patel <anup@brainfault.org>
Mon, 4 Oct 2021 10:21:47 +0000 (15:51 +0530)
commit66da6244f0cdacf3b8f8341969e7dca6fb8f8c5f
tree4f77126d24e2124aa992f910012f49ce260602fa
parentc5536e0679391ce564fc3f7361d0a49add468a7f
RISC-V: KVM: Handle MMIO exits for VCPU

We will get stage2 page faults whenever Guest/VM access SW emulated
MMIO device or unmapped Guest RAM.

This patch implements MMIO read/write emulation by extracting MMIO
details from the trapped load/store instruction and forwarding the
MMIO read/write to user-space. The actual MMIO emulation will happen
in user-space and KVM kernel module will only take care of register
updates before resuming the trapped VCPU.

The handling for stage2 page faults for unmapped Guest RAM will be
implemeted by a separate patch later.

[jiangyifei: ioeventfd and in-kernel mmio device support]
Signed-off-by: Yifei Jiang <jiangyifei@huawei.com>
Signed-off-by: Anup Patel <anup.patel@wdc.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Alexander Graf <graf@amazon.com>
Acked-by: Palmer Dabbelt <palmerdabbelt@google.com>
arch/riscv/include/asm/kvm_host.h
arch/riscv/kernel/asm-offsets.c
arch/riscv/kvm/Kconfig
arch/riscv/kvm/Makefile
arch/riscv/kvm/mmu.c
arch/riscv/kvm/vcpu_exit.c
arch/riscv/kvm/vcpu_switch.S
arch/riscv/kvm/vm.c