kvmppc: support guest shutdown - guest part
Subsystems (2)
PATCH 1/1 kvmppc: support guest shutdown - guest part
From: Christian Ehrhardt <[email protected]>
This is the guest portion of this patch, it submits a trap with the special immediate value where the native code would enter a infinite loop with irq's disabled (no native shutdown available).
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 [email protected] with these patch, but for now this patch could stay in our patch queues because it easens daily usage e.g. scripted testing. Note - since qemu defaults to reboot the guest on shutdown you might need to the -no-reboot command line option to qemu to get what is expected.
[diffstat]
kernel/setup-common.c | 4 ++++ kvm/Kconfig | 11 ++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-)
---
arch/powerpc/kernel/setup-common.c +4 -0
@@ -146,6 +146,10 @@ void machine_halt(void)#endif printk (KERN_EMERG "System Halted, OK to turn off power\n" );local_irq_disable (); +#ifdef CONFIG_KVM_PPC_GUEST +/* FIXME port to the proper hypercall API/ABI when defined */ + __asm__ __volatile__("twi 31,0,1" ); +#endif while (1 ) ; }
arch/powerpc/kvm/Kconfig +10 -1
@@ -35,7 +35,7 @@ config KVM_POWERPC bool config KVM_POWERPC_440 - tristate "KVM guest support for PowerPC 440" + tristate "KVM host support for PowerPC 440 guests" depends on KVM && 44x select KVM_POWERPC ---help---
@@ -52,5 +52,14 @@ config KVM_PPC_VIRTIO # the virtualization menu. source drivers/virtio/Kconfig + +config KVM_PPC_GUEST + bool "Paravirt guest extensions for KVM on POWERPC" + depends on 44x + ---help--- + This add support of paravirt features for KVM on POWERPC + + + endif # VIRTUALIZATION
-------------------------------------------------------------------------
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 [email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-ppc-devel
PATCH 1/1 kvmppc: support guest shutdown - host part
From: Christian Ehrhardt <[email protected]>
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 [email protected] with these patch, but for now this patch could stay in our patch queues because it easens daily usage e.g. scripted testing.
[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(+)
---
arch/powerpc/kvm/emulate.c +5 -0
@@ -229,6 +229,11 @@ int kvmppc_emulate_instruction(struct kvswitch (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 ;
arch/powerpc/kvm/powerpc.c +4 -0
@@ -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 :
include/asm-powerpc/kvm_ppc.h +1 -0
@@ -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 [email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-ppc-devel
Re: [kvm-ppc-devel] [PATCH] kvmppc: support guest shutdown - guest
In reply to [email protected]Quoted 30 lines · On Apr 7, 2008, at 8:37 AM, [email protected] wrote:
From: Christian Ehrhardt <[email protected]>
This is the guest portion of this patch, it submits a trap with the special
immediate value where the native code would enter a infinite loop with irq's
disabled (no native shutdown available).
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 [email protected] with these patch, but for now this patch could stay in
our patch queues because it easens daily usage e.g. scripted testing. Note - since qemu defaults to reboot the guest on shutdown you might need to
the -no-reboot command line option to qemu to get what is expected.Signed-off-by Christian Ehrhardt <[email protected]>[diffstat]
kernel/setup-common.c | 4 ++++ kvm/Kconfig | 11 ++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-)---
arch/powerpc/ renamed from arch/powerpc/kernel/setup-common.c +0
-0
kernel/setup-common.c
arch/powerpc/kernel/setup-common.c void machine_halt(void) · line 148
Quoted 3 lines
arch/powerpc/kernel/setup-common.c +0
-0@@ -146,6 +146,10 @@ void machine_halt(void)#endif printk (KERN_EMERG "System Halted, OK to turn off power\n" );local_irq_disable ();
hmm.. shouldn't you just be defining ppc_md.halt in your setup so it can be called in this function above this line?
Functionally I would assume this "zombies" the guest rather then completely destroys it?
This is important if I want to externally debug said state.
You may also want to consider defining ppc_md.power_off as well which would automatically and completely destroy the guest.
arch/powerpc/kernel/setup-common.c void machine_halt(void) · line 152
Quoted 4 lines
arch/powerpc/kernel/setup-common.c +4
-0+#ifdef CONFIG_KVM_PPC_GUEST +/* FIXME port to the proper hypercall API/ABI when defined */ + __asm__ __volatile__("twi 31,0,1" ); +#endif
Have you considered using mtmsr(MSR_WE) which puts you in wait with no hope of coming back, unless forced by probe.
Quoted 34 lines
arch/powerpc/kernel/setup-common.c +0
-0while (1 ) ; }arch/powerpc/kvm/Kconfig +10
-3@@ -35,7 +35,7 @@ config KVM_POWERPC bool config KVM_POWERPC_440 - tristate "KVM guest support for PowerPC 440" + tristate "KVM host support for PowerPC 440 guests" depends on KVM && 44x select KVM_POWERPC ---help---@@ -52,5 +52,14 @@ config KVM_PPC_VIRTIO # the virtualization menu. source drivers/virtio/Kconfig + +config KVM_PPC_GUEST + bool "Paravirt guest extensions for KVM on POWERPC" + depends on 44x + ---help--- + This add support of paravirt features for KVM on POWERPC + + + endif # VIRTUALIZATION ---------------------------------------------------------------------- ---This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Quoted 8 lines
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 [email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-ppc-devel
-------------------------------------------------------------------------
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 [email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-ppc-devel
Re: [kvm-ppc-devel] [PATCH] kvmppc: support guest shutdown - guest
In reply to [email protected]Quoted 27 lines · Jimi Xenidis
Quoted 25 lines · On Apr 7, 2008, at 8:37 AM, [email protected] wrote:
From: Christian Ehrhardt <[email protected]>
This is the guest portion of this patch, it submits a trap with the special
immediate value where the native code would enter a infinite loop with irq's
disabled (no native shutdown available).
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 [email protected] with these patch, but for now this patch could stay in
our patch queues because it easens daily usage e.g. scripted testing. Note - since qemu defaults to reboot the guest on shutdown you might need to
the -no-reboot command line option to qemu to get what is expected.Signed-off-by Christian Ehrhardt <[email protected]>[diffstat]
kernel/setup-common.c | 4 ++++ kvm/Kconfig | 11 ++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-)---
Quoted 11 lines
arch/powerpc/kernel/setup-common.c void machine_halt(void) · line 148
Quoted 8 lines
arch/powerpc/kernel/setup-common.c +0
-0@@ -146,6 +146,10 @@ void machine_halt(void)#endif printk (KERN_EMERG "System Halted, OK to turn off power\n" );local_irq_disable ();hmm.. shouldn't you just be defining ppc_md.halt in your setup so it can be called in this function above this line?
I'll look into that - thx Jimi
Quoted 3 lines
Functionally I would assume this "zombies" the guest rather then completely destroys it?
This is important if I want to externally debug said state.
hmmm ... I started with the demand to get it destroyed on halt.
Quoted 10 lines
You may also want to consider defining ppc_md.power_off as well which would automatically and completely destroy the guest.
arch/powerpc/kernel/setup-common.c void machine_halt(void) · line 152
Quoted 4 lines
arch/powerpc/kernel/setup-common.c +4
-0+#ifdef CONFIG_KVM_PPC_GUEST +/* FIXME port to the proper hypercall API/ABI when defined */ + __asm__ __volatile__("twi 31,0,1" ); +#endif Have you considered using
mtmsr(MSR_WE)which puts you in wait with no hope of coming back, unless forced by probe.
atm I want it dead ;-).
But you'r right - eventually we should implement the differences between halt, poweroff, ... in the final version
Quoted 42 lines
Quoted 41 lines
arch/powerpc/kernel/setup-common.c +0
-0while (1 ) ; }arch/powerpc/kvm/Kconfig +10
-2@@ -35,7 +35,7 @@ config KVM_POWERPC bool config KVM_POWERPC_440 - tristate "KVM guest support for PowerPC 440" + tristate "KVM host support for PowerPC 440 guests" depends on KVM && 44x select KVM_POWERPC ---help---@@ -52,5 +52,14 @@ config KVM_PPC_VIRTIO # the virtualization menu. source drivers/virtio/Kconfig + +config KVM_PPC_GUEST + bool "Paravirt guest extensions for KVM on POWERPC" + depends on 44x + ---help--- + This add support of paravirt features for KVM on POWERPC + + + endif # VIRTUALIZATION -------------------------------------------------------------------------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
[email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-ppc-devel
Signature · 13 lines
Grüsse / regards, Christian Ehrhardt IBM Linux Technology Center, Open Virtualization ------------------------------------------------------------------------- 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 [email protected] https://lists.sourceforge.net/lists/listinfo/kvm-ppc-devel