summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorStefano Stabellini <stefano.stabellini@eu.citrix.com>2013-04-25 10:23:07 +0000
committerStefano Stabellini <stefano.stabellini@eu.citrix.com>2013-04-25 16:46:10 +0000
commit6abb749e83cf100bc4c71537e4c4e97ccdadcafe (patch)
tree7d1c64d574b9f43f0f0ecca53146009b8de7c46a /arch
parentd37a6e1687303ea0fcea89980373e3017b449963 (diff)
xen/arm: use sched_op hypercalls for machine reboot and power off
Changes in v5: - set pm_power_off and arm_pm_restart from the Xen specific intialization code. Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/xen/enlighten.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/arch/arm/xen/enlighten.c b/arch/arm/xen/enlighten.c
index 6c87d116df63..9a0a917cdeb6 100644
--- a/arch/arm/xen/enlighten.c
+++ b/arch/arm/xen/enlighten.c
@@ -10,9 +10,12 @@
#include <xen/platform_pci.h>
#include <xen/xenbus.h>
#include <xen/page.h>
+#include <xen/xen.h>
+#include <xen/interface/sched.h>
#include <xen/xen-ops.h>
#include <asm/xen/hypervisor.h>
#include <asm/xen/hypercall.h>
+#include <asm/system_misc.h>
#include <linux/interrupt.h>
#include <linux/irqreturn.h>
#include <linux/module.h>
@@ -173,6 +176,24 @@ static int __init xen_secondary_init(unsigned int cpu)
return 0;
}
+static void xen_restart(char str, const char *cmd)
+{
+ struct sched_shutdown r = { .reason = SHUTDOWN_reboot };
+ int rc;
+ rc = HYPERVISOR_sched_op(SCHEDOP_shutdown, &r);
+ if (rc)
+ BUG();
+}
+
+static void xen_power_off(void)
+{
+ struct sched_shutdown r = { .reason = SHUTDOWN_poweroff };
+ int rc;
+ rc = HYPERVISOR_sched_op(SCHEDOP_shutdown, &r);
+ if (rc)
+ BUG();
+}
+
/*
* see Documentation/devicetree/bindings/arm/xen.txt for the
* documentation of the Xen Device Tree format.
@@ -252,6 +273,9 @@ static int __init xen_guest_init(void)
if (!xen_initial_domain())
xenbus_probe(NULL);
+ pm_power_off = xen_power_off;
+ arm_pm_restart = xen_restart;
+
return 0;
}
core_initcall(xen_guest_init);