aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm
diff options
context:
space:
mode:
authorStefano Stabellini <stefano.stabellini@eu.citrix.com>2013-04-25 06:23:07 -0400
committerStefano Stabellini <stefano.stabellini@eu.citrix.com>2013-04-25 12:46:10 -0400
commit6abb749e83cf100bc4c71537e4c4e97ccdadcafe (patch)
tree7d1c64d574b9f43f0f0ecca53146009b8de7c46a /arch/arm
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/arm')
-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 @@
10#include <xen/platform_pci.h> 10#include <xen/platform_pci.h>
11#include <xen/xenbus.h> 11#include <xen/xenbus.h>
12#include <xen/page.h> 12#include <xen/page.h>
13#include <xen/xen.h>
14#include <xen/interface/sched.h>
13#include <xen/xen-ops.h> 15#include <xen/xen-ops.h>
14#include <asm/xen/hypervisor.h> 16#include <asm/xen/hypervisor.h>
15#include <asm/xen/hypercall.h> 17#include <asm/xen/hypercall.h>
18#include <asm/system_misc.h>
16#include <linux/interrupt.h> 19#include <linux/interrupt.h>
17#include <linux/irqreturn.h> 20#include <linux/irqreturn.h>
18#include <linux/module.h> 21#include <linux/module.h>
@@ -173,6 +176,24 @@ static int __init xen_secondary_init(unsigned int cpu)
173 return 0; 176 return 0;
174} 177}
175 178
179static void xen_restart(char str, const char *cmd)
180{
181 struct sched_shutdown r = { .reason = SHUTDOWN_reboot };
182 int rc;
183 rc = HYPERVISOR_sched_op(SCHEDOP_shutdown, &r);
184 if (rc)
185 BUG();
186}
187
188static void xen_power_off(void)
189{
190 struct sched_shutdown r = { .reason = SHUTDOWN_poweroff };
191 int rc;
192 rc = HYPERVISOR_sched_op(SCHEDOP_shutdown, &r);
193 if (rc)
194 BUG();
195}
196
176/* 197/*
177 * see Documentation/devicetree/bindings/arm/xen.txt for the 198 * see Documentation/devicetree/bindings/arm/xen.txt for the
178 * documentation of the Xen Device Tree format. 199 * documentation of the Xen Device Tree format.
@@ -252,6 +273,9 @@ static int __init xen_guest_init(void)
252 if (!xen_initial_domain()) 273 if (!xen_initial_domain())
253 xenbus_probe(NULL); 274 xenbus_probe(NULL);
254 275
276 pm_power_off = xen_power_off;
277 arm_pm_restart = xen_restart;
278
255 return 0; 279 return 0;
256} 280}
257core_initcall(xen_guest_init); 281core_initcall(xen_guest_init);