From: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
To: xen-devel@lists.xensource.com
Cc: linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
Stefano.Stabellini@eu.citrix.com, konrad.wilk@oracle.com,
Ian.Campbell@citrix.com,
Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Subject: [PATCH v5 7/7] xen/arm: use sched_op hypercalls for machine reboot and power off
Date: Thu, 25 Apr 2013 17:57:55 +0100 [thread overview]
Message-ID: <1366909075-28775-7-git-send-email-stefano.stabellini@eu.citrix.com> (raw)
In-Reply-To: <alpine.DEB.2.02.1304251750160.4180@kaball.uk.xensource.com>
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>
---
arch/arm/xen/enlighten.c | 24 ++++++++++++++++++++++++
1 files changed, 24 insertions(+), 0 deletions(-)
diff --git a/arch/arm/xen/enlighten.c b/arch/arm/xen/enlighten.c
index 6c87d11..9a0a917 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);
--
1.7.2.5
next prev parent reply other threads:[~2013-04-25 16:57 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-25 16:57 [PATCH v5 0/7] xen/arm: move to mach-virt and support SMP Stefano Stabellini
2013-04-25 16:57 ` [PATCH v5 1/7] xen/arm: actually pass a non-NULL percpu pointer to request_percpu_irq Stefano Stabellini
2013-04-25 16:57 ` [PATCH v5 2/7] xen/arm: implement HYPERVISOR_vcpu_op Stefano Stabellini
2013-04-25 16:57 ` [PATCH v5 3/7] xen/arm: SMP support Stefano Stabellini
2013-04-25 16:57 ` [PATCH v5 4/7] xen: move the xenvm machine to mach-virt Stefano Stabellini
2013-04-25 16:57 ` [PATCH v5 5/7] xen/arm: XEN selects ARM_PSCI Stefano Stabellini
2013-04-25 16:57 ` [PATCH v5 6/7] xenvm: add a simple PSCI node and a second cpu Stefano Stabellini
2013-04-25 16:57 ` Stefano Stabellini [this message]
2013-04-26 10:41 ` [PATCH v5 0/7] xen/arm: move to mach-virt and support SMP Stefano Stabellini
2013-04-30 15:28 ` Konrad Rzeszutek Wilk
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1366909075-28775-7-git-send-email-stefano.stabellini@eu.citrix.com \
--to=stefano.stabellini@eu.citrix.com \
--cc=Ian.Campbell@citrix.com \
--cc=konrad.wilk@oracle.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).