[PATCH v2 5/7] KVM: PPC: mmio: Queue interrupt at kvmppc_emulate_mmio
Alexey Kardashevskiy
aik at ozlabs.ru
Fri Jan 7 11:24:29 AEDT 2022
On 07/01/2022 07:03, Fabiano Rosas wrote:
> 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.
>
> No functional change, just separation of responsibilities.
>
> Signed-off-by: Fabiano Rosas <farosas at linux.ibm.com>
> ---
> arch/powerpc/kvm/emulate_loadstore.c | 4 +---
> arch/powerpc/kvm/powerpc.c | 2 +-
> 2 files changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/arch/powerpc/kvm/emulate_loadstore.c b/arch/powerpc/kvm/emulate_loadstore.c
> index 48272a9b9c30..ef50e8cfd988 100644
> --- a/arch/powerpc/kvm/emulate_loadstore.c
> +++ b/arch/powerpc/kvm/emulate_loadstore.c
> @@ -355,10 +355,8 @@ int kvmppc_emulate_loadstore(struct kvm_vcpu *vcpu)
> }
> }
>
> - if (emulated == EMULATE_FAIL) {
> + if (emulated == EMULATE_FAIL)
> advance = 0;
You can now drop @advance by moving the "if" few lines down.
> - kvmppc_core_queue_program(vcpu, 0);
> - }
>
> trace_kvm_ppc_instr(inst, kvmppc_get_pc(vcpu), emulated);
>
> diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c
> index 3fc8057db4b4..a2e78229d645 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;
--
Alexey
More information about the Linuxppc-dev
mailing list