Re: [PATCH v7 10/21] RISC-V: KVM: Handle MMIO exits for VCPU

From: Alexander Graf
Date: Mon Sep 23 2019 - 02:50:51 EST




On 04.09.19 18:15, Anup Patel wrote:
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.

Signed-off-by: Anup Patel <anup.patel@xxxxxxx>
Acked-by: Paolo Bonzini <pbonzini@xxxxxxxxxx>
Reviewed-by: Paolo Bonzini <pbonzini@xxxxxxxxxx>

This version is indeed much better. I would not mind a bit more documentation when it comes to implicit register value assumptions (a0, a1 in the trap handler), but the code is small enough that someone who cares can figure it out quickly enough.

Reviewed-by: Alexander Graf <graf@xxxxxxxxxx>


Alex



Amazon Development Center Germany GmbH
Krausenstr. 38
10117 Berlin
Geschaeftsfuehrung: Christian Schlaeger, Ralf Herbrich
Eingetragen am Amtsgericht Charlottenburg unter HRB 149173 B
Sitz: Berlin
Ust-ID: DE 289 237 879