All of lore.kernel.org
 help / color / mirror / Atom feed
From: ehrhardt@linux.vnet.ibm.com
To: kvm-ppc@vger.kernel.org
Subject: [kvm-ppc-devel] [PATCH] kvmppc: support guest shutdown - host part
Date: Mon, 07 Apr 2008 12:37:30 +0000	[thread overview]
Message-ID: <12075718533599-git-send-email-ehrhardt@linux.vnet.ibm.com> (raw)
In-Reply-To: <12075718522742-git-send-email-ehrhardt@linux.vnet.ibm.com>

From: Christian Ehrhardt <ehrhardt@linux.vnet.ibm.com>

This is the host portion of this patch, it detects a trap with the special
immediate value and then exits with the kvm exit_reason for shutdown.
This is only a interim solution until the hypercall abi/api is fully
defined. Then we will recode it in according to that specification.
I would wait for these final hypercall variant before we go to
linuxppc-dev@ozlabs.org with these patch, but for now this patch could stay in
our patch queues because it easens daily usage e.g. scripted testing.

Signed-off-by: Christian Ehrhardt <ehrhardt@linux.vnet.ibm.com>

[diffstat]
 arch/powerpc/kvm/emulate.c    |    5 +++++
 arch/powerpc/kvm/powerpc.c    |    4 ++++
 include/asm-powerpc/kvm_ppc.h |    1 +
 3 files changed, 10 insertions(+)
---

diff --git a/arch/powerpc/kvm/emulate.c b/arch/powerpc/kvm/emulate.c
--- a/arch/powerpc/kvm/emulate.c
+++ b/arch/powerpc/kvm/emulate.c
@@ -229,6 +229,11 @@ int kvmppc_emulate_instruction(struct kv
 
 	switch (get_op(inst)) {
 	case 3:                                                 /* trap */
+		if (get_d(inst) = 1) {
+			/* FIXME port to final hypercall API when defined */
+			printk(KERN_INFO"Guest requested shutdown\n");
+			return EMULATE_SHUTDOWN;
+		}
 		printk("trap!\n");
 		kvmppc_queue_exception(vcpu, BOOKE_INTERRUPT_PROGRAM);
 		advance = 0;
diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c
--- a/arch/powerpc/kvm/powerpc.c
+++ b/arch/powerpc/kvm/powerpc.c
@@ -354,6 +354,10 @@ int kvmppc_handle_exit(struct kvm_run *r
 			 * report it to userspace. */
 			run->hw.hardware_exit_reason = ~0ULL << 32;
 			run->hw.hardware_exit_reason |= vcpu->arch.last_inst;
+			r = RESUME_HOST;
+			break;
+		case EMULATE_SHUTDOWN:
+			run->exit_reason = KVM_EXIT_SHUTDOWN;
 			r = RESUME_HOST;
 			break;
 		default:
diff --git a/include/asm-powerpc/kvm_ppc.h b/include/asm-powerpc/kvm_ppc.h
--- a/include/asm-powerpc/kvm_ppc.h
+++ b/include/asm-powerpc/kvm_ppc.h
@@ -39,6 +39,7 @@ enum emulation_result {
 	EMULATE_DO_MMIO,      /* kvm_run filled with MMIO request */
 	EMULATE_DO_DCR,       /* kvm_run filled with DCR request */
 	EMULATE_FAIL,         /* can't emulate this instruction */
+	EMULATE_SHUTDOWN,     /* shutdown guest requested (no kvm_run data) */
 };
 
 extern const unsigned char exception_priority[];

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Register now and save $200. Hurry, offer ends at 11:59 p.m., 
Monday, April 7! Use priority code J8TLD2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
kvm-ppc-devel mailing list
kvm-ppc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-ppc-devel

  reply	other threads:[~2008-04-07 12:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-07 12:37 [kvm-ppc-devel] [PATCH] kvmppc: support guest shutdown - guest part ehrhardt
2008-04-07 12:37 ` ehrhardt [this message]
2008-04-07 14:13 ` [kvm-ppc-devel] [PATCH] kvmppc: support guest shutdown - guest Jimi Xenidis
2008-04-07 15:23 ` Christian Ehrhardt

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=12075718533599-git-send-email-ehrhardt@linux.vnet.ibm.com \
    --to=ehrhardt@linux.vnet.ibm.com \
    --cc=kvm-ppc@vger.kernel.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.