Re: [RFC PATCH v2 10/19] RISC-V: KVM: Handle WFI exits for VCPU

2019-08-05 Thread Anup Patel
On Mon, Aug 5, 2019 at 12:44 PM Paolo Bonzini wrote: > > On 05/08/19 09:12, Anup Patel wrote: > > On Fri, Aug 2, 2019 at 2:33 PM Paolo Bonzini wrote: > >> > >> On 02/08/19 09:47, Anup Patel wrote: > >>> + if (!kvm_riscv_vcpu_has_interrupt(vcpu)) { > >> > >> This can be

Re: [RFC PATCH v2 10/19] RISC-V: KVM: Handle WFI exits for VCPU

2019-08-05 Thread Paolo Bonzini
On 05/08/19 09:12, Anup Patel wrote: > On Fri, Aug 2, 2019 at 2:33 PM Paolo Bonzini wrote: >> >> On 02/08/19 09:47, Anup Patel wrote: >>> + if (!kvm_riscv_vcpu_has_interrupt(vcpu)) { >> >> This can be kvm_arch_vcpu_runnable instead, since kvm_vcpu_block will >> check it anyway before

Re: [RFC PATCH v2 10/19] RISC-V: KVM: Handle WFI exits for VCPU

2019-08-05 Thread Anup Patel
On Fri, Aug 2, 2019 at 2:33 PM Paolo Bonzini wrote: > > On 02/08/19 09:47, Anup Patel wrote: > > + if (!kvm_riscv_vcpu_has_interrupt(vcpu)) { > > This can be kvm_arch_vcpu_runnable instead, since kvm_vcpu_block will > check it anyway before sleeping. I think we can skip this check

Re: [RFC PATCH v2 10/19] RISC-V: KVM: Handle WFI exits for VCPU

2019-08-02 Thread Paolo Bonzini
On 02/08/19 09:47, Anup Patel wrote: > + if (!kvm_riscv_vcpu_has_interrupt(vcpu)) { This can be kvm_arch_vcpu_runnable instead, since kvm_vcpu_block will check it anyway before sleeping. Paolo > + kvm_vcpu_block(vcpu); > +

[RFC PATCH v2 10/19] RISC-V: KVM: Handle WFI exits for VCPU

2019-08-02 Thread Anup Patel
We get illegal instruction trap whenever Guest/VM executes WFI instruction. This patch handles WFI trap by blocking the trapped VCPU using kvm_vcpu_block() API. The blocked VCPU will be automatically resumed whenever a VCPU interrupt is injected from user-space or from in-kernel IRQCHIP