From mboxrd@z Thu Jan 1 00:00:00 1970 From: ehrhardt@linux.vnet.ibm.com Date: Mon, 07 Apr 2008 12:37:30 +0000 Subject: [kvm-ppc-devel] [PATCH] kvmppc: support guest shutdown - host part Message-Id: <12075718533599-git-send-email-ehrhardt@linux.vnet.ibm.com> List-Id: References: <12075718522742-git-send-email-ehrhardt@linux.vnet.ibm.com> In-Reply-To: <12075718522742-git-send-email-ehrhardt@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: kvm-ppc@vger.kernel.org From: Christian Ehrhardt 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 [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