Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1379435

[PATCH v2 2/6] ARM: xen: Register with kernel restart handler

From Guenter Roeck <linux@roeck-us.net>
Newsgroups linux.kernel
Subject [PATCH v2 2/6] ARM: xen: Register with kernel restart handler
Date 2016-04-15 04:50 +0200
Message-ID <ro1Zv-41K-9@gated-at.bofh.it> (permalink)
References <ro1Zv-41K-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Register with kernel restart handler instead of setting arm_pm_restart
directly.

Select a high priority of 192 to ensure that default restart handlers
are replaced if Xen is running.

Acked-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
v2: Rebased to v4.6-rc3, added Reviewed/by/Acked-by tags

 arch/arm/xen/enlighten.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/arch/arm/xen/enlighten.c b/arch/arm/xen/enlighten.c
index 75cd7345c654..76a1d12fd27e 100644
--- a/arch/arm/xen/enlighten.c
+++ b/arch/arm/xen/enlighten.c
@@ -27,6 +27,7 @@
 #include <linux/cpu.h>
 #include <linux/console.h>
 #include <linux/pvclock_gtod.h>
+#include <linux/reboot.h>
 #include <linux/time64.h>
 #include <linux/timekeeping.h>
 #include <linux/timekeeper_internal.h>
@@ -193,14 +194,22 @@ after_register_vcpu_info:
 	put_cpu();
 }
 
-static void xen_restart(enum reboot_mode reboot_mode, const char *cmd)
+static int xen_restart(struct notifier_block *nb, unsigned long action,
+		       void *data)
 {
 	struct sched_shutdown r = { .reason = SHUTDOWN_reboot };
 	int rc;
 	rc = HYPERVISOR_sched_op(SCHEDOP_shutdown, &r);
 	BUG_ON(rc);
+
+	return NOTIFY_DONE;
 }
 
+static struct notifier_block xen_restart_nb = {
+	.notifier_call = xen_restart,
+	.priority = 192,
+};
+
 static void xen_power_off(void)
 {
 	struct sched_shutdown r = { .reason = SHUTDOWN_poweroff };
@@ -370,7 +379,7 @@ static int __init xen_pm_init(void)
 		return -ENODEV;
 
 	pm_power_off = xen_power_off;
-	arm_pm_restart = xen_restart;
+	register_restart_handler(&xen_restart_nb);
 	if (!xen_initial_domain()) {
 		struct timespec64 ts;
 		xen_read_wallclock(&ts);
-- 
2.5.0

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 0/6] ARM/ARM64: Drop arm_pm_restart Guenter Roeck <linux@roeck-us.net> - 2016-04-15 04:50 +0200
  [PATCH v2 6/6] ARM: Remove arm_pm_restart Guenter Roeck <linux@roeck-us.net> - 2016-04-15 04:50 +0200
  [PATCH v2 2/6] ARM: xen: Register with kernel restart handler Guenter Roeck <linux@roeck-us.net> - 2016-04-15 04:50 +0200
  [PATCH v2 5/6] ARM64: Remove arm_pm_restart Guenter Roeck <linux@roeck-us.net> - 2016-04-15 04:50 +0200
  [PATCH v2 3/6] ARM: PSCI: Register with kernel restart handler Guenter Roeck <linux@roeck-us.net> - 2016-04-15 04:50 +0200
  [PATCH v2 1/6] ARM: prima2: Register with kernel restart handler Guenter Roeck <linux@roeck-us.net> - 2016-04-15 04:50 +0200

csiph-web