From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicholas Piggin Date: Mon, 10 Jan 2022 05:29:44 +0000 Subject: Re: [PATCH v3 4/6] KVM: PPC: mmio: Queue interrupt at kvmppc_emulate_mmio Message-Id: <1641792561.xpvi87mg71.astroid@bobo.none> List-Id: References: <20220107210012.4091153-1-farosas@linux.ibm.com> <20220107210012.4091153-5-farosas@linux.ibm.com> In-Reply-To: <20220107210012.4091153-5-farosas@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Fabiano Rosas , kvm-ppc@vger.kernel.org Cc: aik@ozlabs.ru, linuxppc-dev@lists.ozlabs.org Excerpts from Fabiano Rosas's message of January 8, 2022 7:00 am: > If MMIO emulation fails, we queue a Program interrupt to the > guest. Move that line up into kvmppc_emulate_mmio, which is where we > set RESUME_GUEST/HOST. This allows the removal of the 'advance' > variable. > > No functional change, just separation of responsibilities. Looks cleaner. Reviewed-by: Nicholas Piggin > > Signed-off-by: Fabiano Rosas > --- > arch/powerpc/kvm/emulate_loadstore.c | 8 +------- > arch/powerpc/kvm/powerpc.c | 2 +- > 2 files changed, 2 insertions(+), 8 deletions(-) > > diff --git a/arch/powerpc/kvm/emulate_loadstore.c b/arch/powerpc/kvm/emulate_loadstore.c > index 48272a9b9c30..4dec920fe4c9 100644 > --- a/arch/powerpc/kvm/emulate_loadstore.c > +++ b/arch/powerpc/kvm/emulate_loadstore.c > @@ -73,7 +73,6 @@ int kvmppc_emulate_loadstore(struct kvm_vcpu *vcpu) > { > u32 inst; > enum emulation_result emulated = EMULATE_FAIL; > - int advance = 1; > struct instruction_op op; > > /* this default type might be overwritten by subcategories */ > @@ -355,15 +354,10 @@ int kvmppc_emulate_loadstore(struct kvm_vcpu *vcpu) > } > } > > - if (emulated == EMULATE_FAIL) { > - advance = 0; > - kvmppc_core_queue_program(vcpu, 0); > - } > - > trace_kvm_ppc_instr(inst, kvmppc_get_pc(vcpu), emulated); > > /* Advance past emulated instruction. */ > - if (advance) > + if (emulated != EMULATE_FAIL) > kvmppc_set_pc(vcpu, kvmppc_get_pc(vcpu) + 4); > > return emulated; > diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c > index 4d7d0d080232..6daeea4a7de1 100644 > --- a/arch/powerpc/kvm/powerpc.c > +++ b/arch/powerpc/kvm/powerpc.c > @@ -307,7 +307,7 @@ int kvmppc_emulate_mmio(struct kvm_vcpu *vcpu) > u32 last_inst; > > kvmppc_get_last_inst(vcpu, INST_GENERIC, &last_inst); > - /* XXX Deliver Program interrupt to guest. */ > + kvmppc_core_queue_program(vcpu, 0); > pr_info("%s: emulation failed (%08x)\n", __func__, last_inst); > r = RESUME_HOST; > break; > -- > 2.33.1 > >