All of lore.kernel.org
 help / color / mirror / Atom feed
From: Liu Yu <yu.liu@freescale.com>
To: agraf@suse.de
Cc: Liu Yu <yu.liu@freescale.com>, qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH] kvm-ppc: halt secondary cpus when guest reset
Date: Tue, 29 Nov 2011 14:41:18 +0800	[thread overview]
Message-ID: <1322548878-14000-1-git-send-email-yu.liu@freescale.com> (raw)

When guest reset, we need to halt secondary cpus until guest kick them.
This already works for tcg. The patch add the support for kvm.

For kvm, if use in-kernel mpic, it should not be halted.
In this case, we pause the sencondaries instead.
This has impact to handling of halt exit,
but fortunately, kvmppc doesn't use halt exit.

Signed-off-by: Liu Yu <yu.liu@freescale.com>
---
 hw/ppce500_spin.c |    1 +
 target-ppc/kvm.c  |   11 ++++++++++-
 2 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/hw/ppce500_spin.c b/hw/ppce500_spin.c
index cccd940..2b52728 100644
--- a/hw/ppce500_spin.c
+++ b/hw/ppce500_spin.c
@@ -112,6 +112,7 @@ static void spin_kick(void *data)
 
     env->halted = 0;
     env->exception_index = -1;
+    env->stopped = 0;
     qemu_cpu_kick(env);
 }
 
diff --git a/target-ppc/kvm.c b/target-ppc/kvm.c
index 429349f..ff4cfdb 100644
--- a/target-ppc/kvm.c
+++ b/target-ppc/kvm.c
@@ -504,7 +504,16 @@ void kvm_arch_post_run(CPUState *env, struct kvm_run *run)
 
 int kvm_arch_process_async_events(CPUState *env)
 {
-    return 0;
+    if (kvm_irqchip_in_kernel()) {
+        if (env->halted == 1 && env->exception_index == EXCP_HLT) {
+            env->stopped = 1;
+            return 1;
+        } else {
+            return 0;
+        }
+    }
+
+    return env->halted;
 }
 
 static int kvmppc_handle_halt(CPUState *env)
-- 
1.6.4

             reply	other threads:[~2011-11-29  8:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-29  6:41 Liu Yu [this message]
2011-12-19 13:14 ` [Qemu-devel] [PATCH] kvm-ppc: halt secondary cpus when guest reset 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=1322548878-14000-1-git-send-email-yu.liu@freescale.com \
    --to=yu.liu@freescale.com \
    --cc=agraf@suse.de \
    --cc=qemu-devel@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.