aboutsummaryrefslogtreecommitdiffstats
path: root/arch/i386/xen/enlighten.c
diff options
context:
space:
mode:
authorJeremy Fitzhardinge <jeremy@xensource.com>2007-07-17 21:37:07 -0400
committerJeremy Fitzhardinge <jeremy@goop.org>2007-07-18 11:47:45 -0400
commitfefa629abebe328cf6d07f99fe5796dbfc3e4981 (patch)
tree81308b3c852a0fa8344fd017ebf2a7f9f19ed042 /arch/i386/xen/enlighten.c
parent0d160211965b79de989cf2d170985abeb8da5ec6 (diff)
xen: machine operations
Make the appropriate hypercalls to halt and reboot the virtual machine. Signed-off-by: Jeremy Fitzhardinge <jeremy@xensource.com> Acked-by: Chris Wright <chrisw@sous-sol.org>
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 @@
30#include <xen/interface/xen.h> 30#include <xen/interface/xen.h>
31#include <xen/interface/physdev.h> 31#include <xen/interface/physdev.h>
32#include <xen/interface/vcpu.h> 32#include <xen/interface/vcpu.h>
33#include <xen/interface/sched.h>
33#include <xen/features.h> 34#include <xen/features.h>
34#include <xen/page.h> 35#include <xen/page.h>
35 36
@@ -43,6 +44,7 @@
43#include <asm/desc.h> 44#include <asm/desc.h>
44#include <asm/pgtable.h> 45#include <asm/pgtable.h>
45#include <asm/tlbflush.h> 46#include <asm/tlbflush.h>
47#include <asm/reboot.h>
46 48
47#include "xen-ops.h" 49#include "xen-ops.h"
48#include "mmu.h" 50#include "mmu.h"
@@ -900,6 +902,45 @@ static const struct smp_ops xen_smp_ops __initdata = {
900}; 902};
901#endif /* CONFIG_SMP */ 903#endif /* CONFIG_SMP */
902 904
905static void xen_reboot(int reason)
906{
907#ifdef CONFIG_SMP
908 smp_send_stop();
909#endif
910
911 if (HYPERVISOR_sched_op(SCHEDOP_shutdown, reason))
912 BUG();
913}
914
915static void xen_restart(char *msg)
916{
917 xen_reboot(SHUTDOWN_reboot);
918}
919
920static void xen_emergency_restart(void)
921{
922 xen_reboot(SHUTDOWN_reboot);
923}
924
925static void xen_machine_halt(void)
926{
927 xen_reboot(SHUTDOWN_poweroff);
928}
929
930static void xen_crash_shutdown(struct pt_regs *regs)
931{
932 xen_reboot(SHUTDOWN_crash);
933}
934
935static const struct machine_ops __initdata xen_machine_ops = {
936 .restart = xen_restart,
937 .halt = xen_machine_halt,
938 .power_off = xen_machine_halt,
939 .shutdown = xen_machine_halt,
940 .crash_shutdown = xen_crash_shutdown,
941 .emergency_restart = xen_emergency_restart,
942};
943
903/* First C function to be called on Xen boot */ 944/* First C function to be called on Xen boot */
904asmlinkage void __init xen_start_kernel(void) 945asmlinkage void __init xen_start_kernel(void)
905{ 946{
@@ -912,6 +953,8 @@ asmlinkage void __init xen_start_kernel(void)
912 953
913 /* Install Xen paravirt ops */ 954 /* Install Xen paravirt ops */
914 paravirt_ops = xen_paravirt_ops; 955 paravirt_ops = xen_paravirt_ops;
956 machine_ops = xen_machine_ops;
957
915#ifdef CONFIG_SMP 958#ifdef CONFIG_SMP
916 smp_ops = xen_smp_ops; 959 smp_ops = xen_smp_ops;
917#endif 960#endif