From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alexander Graf Subject: Re: [PATCH] KVM: PPC: Fix contents of SRR1 when injecting a program exception in kvm-pr Date: Thu, 19 May 2016 11:04:13 +0200 Message-ID: <573D818D.4000802@suse.de> References: <1463647483-12148-1-git-send-email-thuth@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org, lvivier@redhat.com To: Thomas Huth , Alexander Graf , Paul Mackerras , kvm-ppc@vger.kernel.org Return-path: Received: from mx2.suse.de ([195.135.220.15]:44400 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752344AbcESJEP (ORCPT ); Thu, 19 May 2016 05:04:15 -0400 In-Reply-To: <1463647483-12148-1-git-send-email-thuth@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On 05/19/2016 10:44 AM, Thomas Huth wrote: > vcpu->arch.shadow_srr1 only contains usable values for injecting > a program exception into the guest if we entered the function > kvmppc_handle_exit_pr() with exit_nr == BOOK3S_INTERRUPT_PROGRAM. > In other cases, the shadow_srr1 bits are zero. Since we want to > pass an illegal-instruction program check to the guest, set > "flags" to SRR1_PROGILL for these other cases. > > Signed-off-by: Thomas Huth Looks good, but please add a comment that H_EMUL_ASSIST doesn't provide the flags inside the code ;) Alex > --- > arch/powerpc/kvm/book3s_pr.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/arch/powerpc/kvm/book3s_pr.c b/arch/powerpc/kvm/book3s_pr.c > index 95bceca..b12e80a 100644 > --- a/arch/powerpc/kvm/book3s_pr.c > +++ b/arch/powerpc/kvm/book3s_pr.c > @@ -1031,7 +1031,10 @@ int kvmppc_handle_exit_pr(struct kvm_run *run, struct kvm_vcpu *vcpu, > int emul; > > program_interrupt: > - flags = vcpu->arch.shadow_srr1 & 0x1f0000ull; > + if (exit_nr == BOOK3S_INTERRUPT_PROGRAM) > + flags = vcpu->arch.shadow_srr1 & 0x1f0000ull; > + else > + flags = SRR1_PROGILL; > > emul = kvmppc_get_last_inst(vcpu, INST_GENERIC, &last_inst); > if (emul != EMULATE_DONE) {