Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=fefa629abebe328cf6d07f99fe5796dbfc3e4981
Commit:     fefa629abebe328cf6d07f99fe5796dbfc3e4981
Parent:     0d160211965b79de989cf2d170985abeb8da5ec6
Author:     Jeremy Fitzhardinge <[EMAIL PROTECTED]>
AuthorDate: Tue Jul 17 18:37:07 2007 -0700
Committer:  Jeremy Fitzhardinge <[EMAIL PROTECTED]>
CommitDate: Wed Jul 18 08:47:45 2007 -0700

    xen: machine operations
    
    Make the appropriate hypercalls to halt and reboot the virtual machine.
    
    Signed-off-by: Jeremy Fitzhardinge <[EMAIL PROTECTED]>
    Acked-by: Chris Wright <[EMAIL PROTECTED]>
---
 arch/i386/xen/enlighten.c |   43 +++++++++++++++++++++++++++++++++++++++++++
 arch/i386/xen/smp.c       |    4 +---
 2 files changed, 44 insertions(+), 3 deletions(-)

diff --git a/arch/i386/xen/enlighten.c b/arch/i386/xen/enlighten.c
index 4275677..142e748 100644
--- a/arch/i386/xen/enlighten.c
+++ b/arch/i386/xen/enlighten.c
@@ -30,6 +30,7 @@
 #include <xen/interface/xen.h>
 #include <xen/interface/physdev.h>
 #include <xen/interface/vcpu.h>
+#include <xen/interface/sched.h>
 #include <xen/features.h>
 #include <xen/page.h>
 
@@ -43,6 +44,7 @@
 #include <asm/desc.h>
 #include <asm/pgtable.h>
 #include <asm/tlbflush.h>
+#include <asm/reboot.h>
 
 #include "xen-ops.h"
 #include "mmu.h"
@@ -900,6 +902,45 @@ static const struct smp_ops xen_smp_ops __initdata = {
 };
 #endif /* CONFIG_SMP */
 
+static void xen_reboot(int reason)
+{
+#ifdef CONFIG_SMP
+       smp_send_stop();
+#endif
+
+       if (HYPERVISOR_sched_op(SCHEDOP_shutdown, reason))
+               BUG();
+}
+
+static void xen_restart(char *msg)
+{
+       xen_reboot(SHUTDOWN_reboot);
+}
+
+static void xen_emergency_restart(void)
+{
+       xen_reboot(SHUTDOWN_reboot);
+}
+
+static void xen_machine_halt(void)
+{
+       xen_reboot(SHUTDOWN_poweroff);
+}
+
+static void xen_crash_shutdown(struct pt_regs *regs)
+{
+       xen_reboot(SHUTDOWN_crash);
+}
+
+static const struct machine_ops __initdata xen_machine_ops = {
+       .restart = xen_restart,
+       .halt = xen_machine_halt,
+       .power_off = xen_machine_halt,
+       .shutdown = xen_machine_halt,
+       .crash_shutdown = xen_crash_shutdown,
+       .emergency_restart = xen_emergency_restart,
+};
+
 /* First C function to be called on Xen boot */
 asmlinkage void __init xen_start_kernel(void)
 {
@@ -912,6 +953,8 @@ asmlinkage void __init xen_start_kernel(void)
 
        /* Install Xen paravirt ops */
        paravirt_ops = xen_paravirt_ops;
+       machine_ops = xen_machine_ops;
+
 #ifdef CONFIG_SMP
        smp_ops = xen_smp_ops;
 #endif
diff --git a/arch/i386/xen/smp.c b/arch/i386/xen/smp.c
index a91587f..a620918 100644
--- a/arch/i386/xen/smp.c
+++ b/arch/i386/xen/smp.c
@@ -311,9 +311,7 @@ static void stop_self(void *v)
 
 void xen_smp_send_stop(void)
 {
-       cpumask_t mask = cpu_online_map;
-       cpu_clear(smp_processor_id(), mask);
-       xen_smp_call_function_mask(mask, stop_self, NULL, 0);
+       smp_call_function(stop_self, NULL, 0, 0);
 }
 
 void xen_smp_send_reschedule(int cpu)
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to