lkml.org 
[lkml]   [2019]   [Sep]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v6 10/21] RISC-V: KVM: Handle MMIO exits for VCPU
On Tue, Sep 3, 2019 at 2:28 PM Andrew Jones <drjones@redhat.com> wrote:
>
> On Thu, Aug 29, 2019 at 01:56:18PM +0000, Anup Patel wrote:
> > int kvm_riscv_vcpu_mmio_return(struct kvm_vcpu *vcpu, struct kvm_run *run)
> > {
> > - /* TODO: */
> > + u8 data8;
> > + u16 data16;
> > + u32 data32;
> > + u64 data64;
> > + ulong insn;
> > + int len, shift;
> > +
> > + insn = vcpu->arch.mmio_decode.insn;
> > +
> > + if (run->mmio.is_write)
> > + goto done;
> > +
> > + len = vcpu->arch.mmio_decode.len;
> > + shift = vcpu->arch.mmio_decode.shift;
> > +
> > + switch (len) {
> > + case 1:
> > + data8 = *((u8 *)run->mmio.data);
> > + SET_RD(insn, &vcpu->arch.guest_context,
> > + (ulong)data8 << shift >> shift);
> > + break;
> > + case 2:
> > + data16 = *((u16 *)run->mmio.data);
> > + SET_RD(insn, &vcpu->arch.guest_context,
> > + (ulong)data16 << shift >> shift);
> > + break;
> > + case 4:
> > + data32 = *((u32 *)run->mmio.data);
> > + SET_RD(insn, &vcpu->arch.guest_context,
> > + (ulong)data32 << shift >> shift);
> > + break;
> > + case 8:
> > + data64 = *((u64 *)run->mmio.data);
> > + SET_RD(insn, &vcpu->arch.guest_context,
> > + (ulong)data64 << shift >> shift);
> > + break;
> > + default:
> > + return -ENOTSUPP;
> > + };
> > +
> > +done:
> > + /* Move to next instruction */
> > + vcpu->arch.guest_context.sepc += INSN_LEN(insn);
> > +
>
> As I pointed out in the last review, just moving this instruction skip
> here is not enough. Doing so introduces the same problem that 2113c5f62b74
> ("KVM: arm/arm64: Only skip MMIO insn once") fixes for arm.

Thanks Drew, I had seen your comment previously but forgot
to address it in v6. I will address it in v7.

Regards,
Anup

\
 
 \ /
  Last update: 2019-09-03 11:26    [W:0.073 / U:29.480 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site