mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
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>,
	Marc Zyngier <marc.zyngier@arm.com>, <will.deacon@arm.com>,
	<arnd@arndb.de>, <rob.herring@calxeda.com>
Subject: [PATCH v4 7/7] mach-virt: support Xen hypercalls for shutdown and reboot
Date: Wed, 24 Apr 2013 20:28:15 +0100	[thread overview]
Message-ID: <1366831695-13214-7-git-send-email-stefano.stabellini@eu.citrix.com> (raw)
In-Reply-To: <alpine.DEB.2.02.1304242012590.4180@kaball.uk.xensource.com>

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
CC: Marc Zyngier <marc.zyngier@arm.com>
CC: will.deacon@arm.com
CC: arnd@arndb.de
CC: rob.herring@calxeda.com
---
 arch/arm/mach-virt/virt.c |   32 ++++++++++++++++++++++++++++++++
 1 files changed, 32 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-virt/virt.c b/arch/arm/mach-virt/virt.c
index 528c05e..ba14321 100644
--- a/arch/arm/mach-virt/virt.c
+++ b/arch/arm/mach-virt/virt.c
@@ -23,13 +23,44 @@
 #include <linux/of_platform.h>
 #include <linux/smp.h>
 
+#include <xen/xen.h>
+#include <xen/interface/sched.h>
+
 #include <asm/arch_timer.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/time.h>
+#include <asm/xen/hypercall.h>
+
+static void virt_restart(char str, const char *cmd)
+{
+#ifdef CONFIG_XEN
+	if (xen_domain()) {
+		struct sched_shutdown r = { .reason = SHUTDOWN_reboot };
+		int rc;
+		rc = HYPERVISOR_sched_op(SCHEDOP_shutdown, &r);
+		if (rc)
+			BUG();
+	}
+#endif
+}
+
+static void virt_power_off(void)
+{
+#ifdef CONFIG_XEN
+	if (xen_domain()) {
+		struct sched_shutdown r = { .reason = SHUTDOWN_poweroff };
+		int rc;
+		rc = HYPERVISOR_sched_op(SCHEDOP_shutdown, &r);
+		if (rc)
+			BUG();
+	}
+#endif
+}
 
 static void __init virt_init(void)
 {
 	of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
+	pm_power_off = virt_power_off;
 }
 
 static void __init virt_timer_init(void)
@@ -52,4 +83,5 @@ DT_MACHINE_START(VIRT, "Dummy Virtual Machine")
 	.init_machine	= virt_init,
 	.smp		= smp_ops(virt_smp_ops),
 	.dt_compat	= virt_dt_match,
+	.restart	= virt_restart,
 MACHINE_END
-- 
1.7.2.5


  parent reply	other threads:[~2013-04-24 19:44 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-24 19:25 [PATCH v4 0/7] xen/arm: move to mach-virt and support SMP Stefano Stabellini
2013-04-24 19:28 ` [PATCH v4 1/7] xen/arm: actually pass a non-NULL percpu pointer to request_percpu_irq Stefano Stabellini
2013-04-25 13:48   ` Ian Campbell
2013-04-24 19:28 ` [PATCH v4 2/7] xen/arm: SMP support Stefano Stabellini
2013-04-25 13:40   ` Ian Campbell
2013-04-25 16:48     ` Stefano Stabellini
2013-04-25 16:59       ` Ian Campbell
2013-04-25 18:45         ` Stefano Stabellini
2013-04-26  8:51           ` Ian Campbell
2013-04-26 10:27             ` Stefano Stabellini
2013-04-26 10:30               ` Ian Campbell
2013-04-26 10:33                 ` Stefano Stabellini
2013-04-24 19:28 ` [PATCH v4 3/7] xen: move the xenvm machine to mach-virt Stefano Stabellini
2013-04-24 19:28 ` [PATCH v4 4/7] xen/arm: implement HYPERVISOR_vcpu_op Stefano Stabellini
2013-04-25 13:41   ` Ian Campbell
2013-04-24 19:28 ` [PATCH v4 5/7] xen/arm: XEN selects ARM_PSCI Stefano Stabellini
2013-04-24 19:28 ` [PATCH v4 6/7] xenvm: add a simple PSCI node and a second cpu Stefano Stabellini
2013-04-24 19:28 ` Stefano Stabellini [this message]
2013-04-24 22:14   ` [PATCH v4 7/7] mach-virt: support Xen hypercalls for shutdown and reboot Stefano Stabellini
2013-04-25  8:54     ` Will Deacon
2013-04-25 10:14       ` Stefano Stabellini

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=1366831695-13214-7-git-send-email-stefano.stabellini@eu.citrix.com \
    --to=stefano.stabellini@eu.citrix.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=arnd@arndb.de \
    --cc=konrad.wilk@oracle.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marc.zyngier@arm.com \
    --cc=rob.herring@calxeda.com \
    --cc=will.deacon@arm.com \
    --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

all inboxes | Powered by JetHome®