qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Bharat Bhushan <Bharat.Bhushan@freescale.com>
To: agraf@suse.de
Cc: Bharat Bhushan <Bharat.Bhushan@freescale.com>,
	maddy@linux.vnet.ibm.com, qemu-ppc@nongnu.org,
	qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 2/5 v3][RESEND] ppc: Add interface to inject interrupt to guest
Date: Tue, 24 Jun 2014 17:40:04 +0530	[thread overview]
Message-ID: <1403611807-7082-3-git-send-email-Bharat.Bhushan@freescale.com> (raw)
In-Reply-To: <1403611807-7082-1-git-send-email-Bharat.Bhushan@freescale.com>

This patch adds interface to inject interrupt to guest.
Currently a void debug exception function added.
Follow up patch will use this interface to inject debug
interrupt to guest

Signed-off-by: Bharat Bhushan <Bharat.Bhushan@freescale.com>
---
 target-ppc/kvm.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/target-ppc/kvm.c b/target-ppc/kvm.c
index 1f78cd1..70f77d1 100644
--- a/target-ppc/kvm.c
+++ b/target-ppc/kvm.c
@@ -759,6 +759,24 @@ static int kvm_put_vpa(CPUState *cs)
 }
 #endif /* TARGET_PPC64 */
 
+static int kvmppc_inject_debug_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_DEBUG)) {
+        if (kvmppc_inject_debug_exception(cs)) {
+            fprintf(stderr, "%s: Debug exception injection failed\n", __func__);
+        }
+        return;
+    }
+}
+
 int kvm_arch_put_registers(CPUState *cs, int level)
 {
     PowerPCCPU *cpu = POWERPC_CPU(cs);
@@ -772,6 +790,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);
-- 
1.9.0

  parent reply	other threads:[~2014-06-24 12:11 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-24 12:10 [Qemu-devel] [PATCH 0/5 v3][RESEND] ppc: Add debug stub support Bharat Bhushan
2014-06-24 12:10 ` [Qemu-devel] [PATCH 1/5 v3][RESEND] ppc: debug stub: Get trap instruction opcode from KVM Bharat Bhushan
2014-06-24 12:10 ` Bharat Bhushan [this message]
2014-06-24 12:10 ` [Qemu-devel] [PATCH 3/5 v3][RESEND] ppc: Add debug interrupt injection handler Bharat Bhushan
2014-06-24 12:10 ` [Qemu-devel] [PATCH 4/5 v3][RESEND] ppc: Add software breakpoint support Bharat Bhushan
2014-06-24 13:04   ` Alexander Graf
2014-06-24 13:11     ` Bharat.Bhushan
2014-06-24 13:20       ` Alexander Graf
2014-06-24 15:28   ` Madhavan Srinivasan
2014-06-24 17:06     ` Bharat.Bhushan
2014-06-24 17:59       ` Madhavan Srinivasan
2014-06-24 22:48         ` Alexander Graf
2014-06-24 12:10 ` [Qemu-devel] [PATCH 5/5 v3][RESEND] ppc: Add hw breakpoint watchpoint support Bharat Bhushan
2014-06-24 13:19   ` Alexander Graf
2014-06-24 14:37     ` Bharat.Bhushan
2014-06-24 14:50       ` Alexander Graf
2014-06-24 16:57         ` Bharat.Bhushan
2014-06-24 22:46           ` Alexander Graf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1403611807-7082-3-git-send-email-Bharat.Bhushan@freescale.com \
    --to=bharat.bhushan@freescale.com \
    --cc=agraf@suse.de \
    --cc=maddy@linux.vnet.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).