From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43463) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X5CHX-0002nL-T7 for qemu-devel@nongnu.org; Thu, 10 Jul 2014 07:13:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X5CHP-0000QC-Nh for qemu-devel@nongnu.org; Thu, 10 Jul 2014 07:12:55 -0400 Message-ID: <53BE752D.8040701@suse.de> Date: Thu, 10 Jul 2014 13:12:45 +0200 From: Alexander Graf MIME-Version: 1.0 References: <1404989882-17362-1-git-send-email-Bharat.Bhushan@freescale.com> <1404989882-17362-3-git-send-email-Bharat.Bhushan@freescale.com> In-Reply-To: <1404989882-17362-3-git-send-email-Bharat.Bhushan@freescale.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 2/6 v6] ppc: Add interface to inject interrupt to guest List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Bharat Bhushan Cc: maddy@linux.vnet.ibm.com, qemu-ppc@nongnu.org, qemu-devel@nongnu.org On 10.07.14 12:57, Bharat Bhushan wrote: > This patch adds interface to inject interrupt to guest. > Currently a void program check exception function added. > Follow up patch will use this interface to inject program > check exception to guest > > Signed-off-by: Bharat Bhushan > --- > v5->v6 > - replace debug with program interrupt > > target-ppc/cpu.h | 1 + > target-ppc/kvm.c | 23 +++++++++++++++++++++++ > 2 files changed, 24 insertions(+) > > diff --git a/target-ppc/cpu.h b/target-ppc/cpu.h > index b64c652..e60fc40 100644 > --- a/target-ppc/cpu.h > +++ b/target-ppc/cpu.h > @@ -2144,6 +2144,7 @@ enum { > PPC_INTERRUPT_CDOORBELL, /* Critical doorbell interrupt */ > PPC_INTERRUPT_DOORBELL, /* Doorbell interrupt */ > PPC_INTERRUPT_PERFM, /* Performance monitor interrupt */ > + PPC_INTERRUPT_PROGRAM, /* Program check exception */ > }; > > /* Processor Compatibility mask (PCR) */ > diff --git a/target-ppc/kvm.c b/target-ppc/kvm.c > index 4df23dd..673c369 100644 > --- a/target-ppc/kvm.c > +++ b/target-ppc/kvm.c > @@ -761,6 +761,25 @@ static int kvm_put_vpa(CPUState *cs) > } > #endif /* TARGET_PPC64 */ > > +static int kvmppc_inject_program_exception(CPUState *cs) > +{ > + return 0; > +} > + > +static void kvmppc_inject_exception(CPUState *cs) > +{ > + PowerPCCPU *cpu = POWERPC_CPU(cs); > + CPUPPCState *env = &cpu->env; > + > + if (env->pending_interrupts & (1 << PPC_INTERRUPT_PROGRAM)) { > + if (kvmppc_inject_program_exception(cs)) { > + fprintf(stderr, "%s: PROGRAM exception injection failed\n", __func__); > + return; > + } > + env->pending_interrupts &= ~(1 << PPC_INTERRUPT_PROGRAM); Do we really need to jump through these hoops? We could just directly call the injection, no? Alex > + } > +} > + > int kvm_arch_put_registers(CPUState *cs, int level) > { > PowerPCCPU *cpu = POWERPC_CPU(cs); > @@ -774,6 +793,10 @@ int kvm_arch_put_registers(CPUState *cs, int level) > return ret; > } > > + if (env->pending_interrupts) { > + kvmppc_inject_exception(cs); > + } > + > regs.ctr = env->ctr; > regs.lr = env->lr; > regs.xer = cpu_read_xer(env);