All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lee Jones <lee.jones@linaro.org>
To: lee.jones@linaro.org, linux@armlinux.org.uk,
	catalin.marinas@arm.com, will@kernel.org, mark.rutland@arm.com,
	lorenzo.pieralisi@arm.com, sstabellini@kernel.org
Cc: linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, wsa+renesas@sang-engineering.com,
	linux@roeck-us.net, treding@nvidia.com, arnd@arndb.de,
	xen-devel@lists.xenproject.org, patches@armlinux.org.uk,
	Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Subject: [PATCH 1/5] ARM: xen: Register with kernel restart handler
Date: Fri,  4 Jun 2021 15:03:53 +0100	[thread overview]
Message-ID: <20210604140357.2602028-2-lee.jones@linaro.org> (raw)
In-Reply-To: <20210604140357.2602028-1-lee.jones@linaro.org>

From: Guenter Roeck <linux@roeck-us.net>

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>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 arch/arm/xen/enlighten.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/arch/arm/xen/enlighten.c b/arch/arm/xen/enlighten.c
index 8ad576ecd0f1d..7f1c106b746f8 100644
--- a/arch/arm/xen/enlighten.c
+++ b/arch/arm/xen/enlighten.c
@@ -29,6 +29,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>
@@ -181,11 +182,18 @@ void xen_reboot(int reason)
 	BUG_ON(rc);
 }
 
-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)
 {
 	xen_reboot(SHUTDOWN_reboot);
+
+	return NOTIFY_DONE;
 }
 
+static struct notifier_block xen_restart_nb = {
+	.notifier_call = xen_restart,
+	.priority = 192,
+};
 
 static void xen_power_off(void)
 {
@@ -404,7 +412,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.31.1


WARNING: multiple messages have this Message-ID
From: Lee Jones <lee.jones@linaro.org>
To: lee.jones@linaro.org, linux@armlinux.org.uk,
	catalin.marinas@arm.com, will@kernel.org, mark.rutland@arm.com,
	lorenzo.pieralisi@arm.com, sstabellini@kernel.org
Cc: linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, wsa+renesas@sang-engineering.com,
	linux@roeck-us.net, treding@nvidia.com, arnd@arndb.de,
	xen-devel@lists.xenproject.org, patches@armlinux.org.uk,
	Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Subject: [PATCH 1/5] ARM: xen: Register with kernel restart handler
Date: Fri,  4 Jun 2021 15:03:53 +0100	[thread overview]
Message-ID: <20210604140357.2602028-2-lee.jones@linaro.org> (raw)
In-Reply-To: <20210604140357.2602028-1-lee.jones@linaro.org>

From: Guenter Roeck <linux@roeck-us.net>

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>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 arch/arm/xen/enlighten.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/arch/arm/xen/enlighten.c b/arch/arm/xen/enlighten.c
index 8ad576ecd0f1d..7f1c106b746f8 100644
--- a/arch/arm/xen/enlighten.c
+++ b/arch/arm/xen/enlighten.c
@@ -29,6 +29,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>
@@ -181,11 +182,18 @@ void xen_reboot(int reason)
 	BUG_ON(rc);
 }
 
-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)
 {
 	xen_reboot(SHUTDOWN_reboot);
+
+	return NOTIFY_DONE;
 }
 
+static struct notifier_block xen_restart_nb = {
+	.notifier_call = xen_restart,
+	.priority = 192,
+};
 
 static void xen_power_off(void)
 {
@@ -404,7 +412,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.31.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2021-06-04 14:05 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-04 14:03 [RESEND 0/5] ARM/arm64: arm_pm_restart removal Lee Jones
2021-06-04 14:03 ` Lee Jones
2021-06-04 14:03 ` Lee Jones [this message]
2021-06-04 14:03   ` [PATCH 1/5] ARM: xen: Register with kernel restart handler Lee Jones
2021-06-04 14:03 ` [PATCH 2/5] drivers: firmware: psci: " Lee Jones
2021-06-04 14:03   ` Lee Jones
2021-06-04 14:03 ` [PATCH 3/5] ARM: " Lee Jones
2021-06-04 14:03   ` Lee Jones
2021-06-04 14:03 ` [PATCH 4/5] ARM64: Remove arm_pm_restart() Lee Jones
2021-06-04 14:03   ` Lee Jones
2021-06-04 14:03 ` [PATCH 5/5] ARM: " Lee Jones
2021-06-04 14:03   ` Lee Jones
2021-10-25 23:29 ` [RESEND 0/5] ARM/arm64: arm_pm_restart removal Florian Fainelli
2021-10-25 23:29   ` Florian Fainelli
2021-10-25 23:55   ` Dmitry Osipenko
2021-10-25 23:55     ` Dmitry Osipenko
2021-10-26  1:02     ` Guenter Roeck
2021-10-26  1:02       ` Guenter Roeck
2021-10-26  1:55       ` Florian Fainelli
2021-10-26  1:55         ` Florian Fainelli

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=20210604140357.2602028-2-lee.jones@linaro.org \
    --to=lee.jones@linaro.org \
    --cc=arnd@arndb.de \
    --cc=catalin.marinas@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=linux@roeck-us.net \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=mark.rutland@arm.com \
    --cc=patches@armlinux.org.uk \
    --cc=sstabellini@kernel.org \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=treding@nvidia.com \
    --cc=will@kernel.org \
    --cc=wsa+renesas@sang-engineering.com \
    --cc=xen-devel@lists.xenproject.org \
    --subject='Re: [PATCH 1/5] ARM: xen: Register with kernel restart handler' \
    /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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.