summaryrefslogtreecommitdiff
path: root/arch/i386/xen/enlighten.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/i386/xen/enlighten.c')
-rw-r--r--arch/i386/xen/enlighten.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/arch/i386/xen/enlighten.c b/arch/i386/xen/enlighten.c
index 42756771b8eb..142e74891344 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