qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 2/6 v6] ppc: Add interface to inject interrupt t


From: Alexander Graf
Subject: Re: [Qemu-devel] [PATCH 2/6 v6] ppc: Add interface to inject interrupt to guest
Date: Thu, 10 Jul 2014 13:12:45 +0200
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Thunderbird/24.6.0


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 <address@hidden>
---
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);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]