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
Subject: [PATCH 3/5] ARM: Register with kernel restart handler
Date: Fri,  4 Jun 2021 15:03:55 +0100	[thread overview]
Message-ID: <20210604140357.2602028-4-lee.jones@linaro.org> (raw)
In-Reply-To: <20210604140357.2602028-1-lee.jones@linaro.org>

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

By making use of the kernel restart handler, board specific restart
handlers can be prioritized amongst available mechanisms for a particular
board or system.

Select the default priority of 128 to indicate that the restart callback
in the machine description is the default restart mechanism.

Acked-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.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/kernel/setup.c | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index 1a5edf562e85e..08c5676477d70 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -1081,6 +1081,20 @@ void __init hyp_mode_check(void)
 #endif
 }
 
+static void (*__arm_pm_restart)(enum reboot_mode reboot_mode, const char *cmd);
+
+static int arm_restart(struct notifier_block *nb, unsigned long action,
+		       void *data)
+{
+	__arm_pm_restart(action, data);
+	return NOTIFY_DONE;
+}
+
+static struct notifier_block arm_restart_nb = {
+	.notifier_call = arm_restart,
+	.priority = 128,
+};
+
 void __init setup_arch(char **cmdline_p)
 {
 	const struct machine_desc *mdesc = NULL;
@@ -1149,8 +1163,10 @@ void __init setup_arch(char **cmdline_p)
 	kasan_init();
 	request_standard_resources(mdesc);
 
-	if (mdesc->restart)
-		arm_pm_restart = mdesc->restart;
+	if (mdesc->restart) {
+		__arm_pm_restart = mdesc->restart;
+		register_restart_handler(&arm_restart_nb);
+	}
 
 	unflatten_device_tree();
 
-- 
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
Subject: [PATCH 3/5] ARM: Register with kernel restart handler
Date: Fri,  4 Jun 2021 15:03:55 +0100	[thread overview]
Message-ID: <20210604140357.2602028-4-lee.jones@linaro.org> (raw)
In-Reply-To: <20210604140357.2602028-1-lee.jones@linaro.org>

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

By making use of the kernel restart handler, board specific restart
handlers can be prioritized amongst available mechanisms for a particular
board or system.

Select the default priority of 128 to indicate that the restart callback
in the machine description is the default restart mechanism.

Acked-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.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/kernel/setup.c | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index 1a5edf562e85e..08c5676477d70 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -1081,6 +1081,20 @@ void __init hyp_mode_check(void)
 #endif
 }
 
+static void (*__arm_pm_restart)(enum reboot_mode reboot_mode, const char *cmd);
+
+static int arm_restart(struct notifier_block *nb, unsigned long action,
+		       void *data)
+{
+	__arm_pm_restart(action, data);
+	return NOTIFY_DONE;
+}
+
+static struct notifier_block arm_restart_nb = {
+	.notifier_call = arm_restart,
+	.priority = 128,
+};
+
 void __init setup_arch(char **cmdline_p)
 {
 	const struct machine_desc *mdesc = NULL;
@@ -1149,8 +1163,10 @@ void __init setup_arch(char **cmdline_p)
 	kasan_init();
 	request_standard_resources(mdesc);
 
-	if (mdesc->restart)
-		arm_pm_restart = mdesc->restart;
+	if (mdesc->restart) {
+		__arm_pm_restart = mdesc->restart;
+		register_restart_handler(&arm_restart_nb);
+	}
 
 	unflatten_device_tree();
 
-- 
2.31.1


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

  parent reply	other threads:[~2021-06-04 14:04 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 ` [PATCH 1/5] ARM: xen: Register with kernel restart handler Lee Jones
2021-06-04 14:03   ` 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 ` Lee Jones [this message]
2021-06-04 14:03   ` [PATCH 3/5] ARM: " 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-4-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=treding@nvidia.com \
    --cc=will@kernel.org \
    --cc=wsa+renesas@sang-engineering.com \
    --cc=xen-devel@lists.xenproject.org \
    --subject='Re: [PATCH 3/5] ARM: 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.