ARM/ARM64: Drop arm_pm_restart
Subsystems (4)
cover ARM/ARM64: Drop arm_pm_restart
This is the final push to replace arm_pm_restart with the kernel restart handler. Finally drop arm_pm_restart after it is no longer used. The following changes since commit 541d8f4d59d79f5d37c8c726f723d42ff307db57:
----------------------------------------------------------------
Guenter Roeck (6):
ARM: prima2: Register with kernel restart handler
ARM: xen: Register with kernel restart handler
ARM: PSCI: Register with kernel restart handler
ARM: Register with kernel restart handler
ARM64: Remove arm_pm_restart
ARM: Remove arm_pm_restart
arch/arm/include/asm/system_misc.h | 1 - arch/arm/kernel/reboot.c | 6 +----- arch/arm/kernel/setup.c | 20 ++++++++++++++++++-- arch/arm/mach-prima2/rstc.c | 11 +++++++++-- arch/arm/xen/enlighten.c | 13 +++++++++++-- arch/arm64/include/asm/system_misc.h | 2 -- arch/arm64/kernel/process.c | 7 +------ drivers/firmware/psci.c | 11 +++++++++-- 8 files changed, 49 insertions(+), 22 deletions(-)
PATCH 1/6 ARM: prima2: Register with kernel restart handler
Register with kernel restart handler instead of setting arm_pm_restart directly. By doing this, the prima2 reset handler can be prioritized among other restart methods available on a particular board.
Select a high priority of 192 since the original code overwrites the default arm restart handler.
--- arch/arm/mach-prima2/rstc.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
arch/arm/mach-prima2/rstc.c +9 -2
@@ -65,11 +65,18 @@ static struct reset_controller_dev sirfsoc_reset_controller = {#define SIRFSOC_SYS_RST_BIT BIT(31) -static void sirfsoc_restart (enum reboot_mode mode,const char *cmd) +static int sirfsoc_restart (struct notifier_block *nb,unsigned long action, +void *data) {writel (SIRFSOC_SYS_RST_BIT , sirfsoc_rstc_base); +return NOTIFY_DONE ; } +static struct notifier_block sirfsoc_restart_nb = { + .notifier_call = sirfsoc_restart, + .priority =192 , +}; +static int sirfsoc_rstc_probe (struct platform_device *pdev) {struct device_node *np = pdev->dev.of_node;
@@ -80,7 +87,7 @@ static int sirfsoc_rstc_probe(struct platform_device *pdev) } sirfsoc_reset_controller.of_node = np; - arm_pm_restart = sirfsoc_restart; +register_restart_handler (&sirfsoc_restart_nb);if (IS_ENABLED (CONFIG_RESET_CONTROLLER ))reset_controller_register (&sirfsoc_reset_controller);
Signature · 1 line
2.5.0
PATCH 2/6 ARM: xen: Register with kernel restart handler
In reply to Guenter RoeckRegister 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.
--- arch/arm/xen/enlighten.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
arch/arm/xen/enlighten.c +11 -2
@@ -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);
Signature · 1 line
2.5.0
Re: [PATCH 2/6] ARM: xen: Register with kernel restart handler
Quoted 4 lines · Guenter Roeck
Register with kernel restart handler instead of setting
arm_pm_restartdirectly.Select a high priority of 192 to ensure that default restart handlers
Is there some macro for that magic value?
Quoted 60 lines
are replaced if Xen is running.
Signed-off-by Guenter Roeck <[email protected]>--- arch/arm/xen/enlighten.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)arch/arm/xen/enlighten.c +11
-2@@ -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);Signature · 7 lines
2.5.0 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [Xen-devel] [PATCH 2/6] ARM: xen: Register with kernel restart handler
Quoted 8 lines · Konrad Rzeszutek Wilk
Quoted 4 lines · Guenter Roeck
Register with kernel restart handler instead of setting
arm_pm_restartdirectly.Select a high priority of 192 to ensure that default restart handlers
Is there some macro for that magic value?
No, only guidelines in kernel/reboot.c.
Guenter
Quoted 60 lines
Quoted 60 lines
are replaced if Xen is running.
Signed-off-by Guenter Roeck <[email protected]>--- arch/arm/xen/enlighten.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)arch/arm/xen/enlighten.c +11
-2@@ -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);Signature · 7 lines
2.5.0 _______________________________________________ Xen-devel mailing list Xen-devel at lists.xen.org http://lists.xen.org/xen-devel
Re: [PATCH 2/6] ARM: xen: Register with kernel restart handler
In reply to Konrad Rzeszutek WilkQuoted 8 lines · Konrad Rzeszutek Wilk
Quoted 4 lines · Guenter Roeck
Register with kernel restart handler instead of setting
arm_pm_restartdirectly.Select a high priority of 192 to ensure that default restart handlers
Is there some macro for that magic value?
No, only guidelines in kernel/reboot.c.
Guenter
Quoted 56 lines
Quoted 56 lines
are replaced if Xen is running.
Signed-off-by Guenter Roeck <[email protected]>--- arch/arm/xen/enlighten.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)arch/arm/xen/enlighten.c +11
-2@@ -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);Signature · 1 line
2.5.0
Quoted 4 lines
Quoted 4 lines
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH 2/6] ARM: xen: Register with kernel restart handler
In reply to Guenter RoeckQuoted 7 lines · Guenter Roeck
Register with kernel restart handler instead of setting
arm_pm_restartdirectly.Select a high priority of 192 to ensure that default restart handlers are replaced if Xen is running.
Signed-off-by Guenter Roeck <[email protected]>
Quoted 51 lines
arch/arm/xen/enlighten.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)arch/arm/xen/enlighten.c +11
-2@@ -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);Signature · 1 line
2.5.0
Stefano Stabellini
maintainerRe: [PATCH 2/6] ARM: xen: Register with kernel restart handler
Quoted 10 lines · Stefano Stabellini
Quoted 7 lines · Guenter Roeck
Register with kernel restart handler instead of setting
arm_pm_restartdirectly.Select a high priority of 192 to ensure that default restart handlers are replaced if Xen is running.
Signed-off-by Guenter Roeck <[email protected]>Reviewed-by Stefano Stabellini <[email protected]>
and queued for 4.7
Quoted 53 lines
Quoted 52 lines
arch/arm/xen/enlighten.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)arch/arm/xen/enlighten.c +11
-2@@ -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);Signature · 1 line
2.5.0
Stefano Stabellini
maintainerRe: [PATCH 2/6] ARM: xen: Register with kernel restart handler
In reply to Stefano StabelliniQuoted 10 lines · Stefano Stabellini
Quoted 7 lines · Guenter Roeck
Register with kernel restart handler instead of setting
arm_pm_restartdirectly.Select a high priority of 192 to ensure that default restart handlers are replaced if Xen is running.
Signed-off-by Guenter Roeck <[email protected]>Reviewed-by Stefano Stabellini <[email protected]>
and queued for 4.7
Quoted 43 lines
Quoted 43 lines
arch/arm/xen/enlighten.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)arch/arm/xen/enlighten.c +10
-1@@ -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 ;
Quoted 10 lines
Quoted 9 lines
arch/arm/xen/enlighten.c +1
-1pm_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);Signature · 1 line
2.5.0
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH 2/6] ARM: xen: Register with kernel restart handler
In reply to Guenter RoeckQuoted 7 lines · Guenter Roeck
Register with kernel restart handler instead of setting
arm_pm_restartdirectly.Select a high priority of 192 to ensure that default restart handlers are replaced if Xen is running.
Signed-off-by Guenter Roeck <[email protected]>
Quoted 51 lines
arch/arm/xen/enlighten.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)arch/arm/xen/enlighten.c +11
-2@@ -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);Signature · 1 line
2.5.0
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
PATCH 3/6 ARM: PSCI: Register with kernel restart handler
In reply to Guenter RoeckRegister with kernel restart handler instead of setting arm_pm_restart directly. This enables support for replacing the PSCI restart handler with a different handler if necessary for a specific board.
Select a priority of 129 to indicate a higher than default priority, but keep it as low as possible since PSCI reset is known to fail on some boards.
---
It might make sense to introduce a restart-priority property for devicetree based configurations, but I am not sure if this would be acceptable.
drivers/firmware/psci.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/firmware/psci.c +9 -2
@@ -231,11 +231,18 @@ static int get_set_conduit_method(struct device_node *np)return 0 ; } -static void psci_sys_reset (enum reboot_mode reboot_mode,const char *cmd) +static int psci_sys_reset (struct notifier_block *np,unsigned long action, +void *data) {invoke_psci_fn (PSCI_0_2_FN_SYSTEM_RESET ,0 ,0 ,0 ); +return NOTIFY_DONE ; } +static struct notifier_block psci_sys_reset_nb = { + .notifier_call = psci_sys_reset, + .priority =129 , +}; +static void psci_sys_poweroff (void ) {invoke_psci_fn (PSCI_0_2_FN_SYSTEM_OFF ,0 ,0 ,0 );
@@ -461,7 +468,7 @@ static void __init psci_0_2_set_functions(void) psci_ops.migrate_info_type = psci_migrate_info_type; - arm_pm_restart = psci_sys_reset; +register_restart_handler (&psci_sys_reset_nb); pm_power_off = psci_sys_poweroff; }
Signature · 1 line
2.5.0
Re: [PATCH 3/6] ARM: PSCI: Register with kernel restart handler
Quoted 2 lines
+static int psci_sys_reset(struct
notifier_block*np, unsigned long action,
Minor: notifier_block *nb instead of *np
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160412/0167d42a/attachment.sig>
Mark Rutland
reviewerRe: [PATCH 3/6] ARM: PSCI: Register with kernel restart handler
In reply to Guenter RoeckQuoted 7 lines · Guenter Roeck
Register with kernel restart handler instead of setting
arm_pm_restartdirectly. This enables support for replacing the PSCI restart handler with a different handler if necessary for a specific board.Select a priority of 129 to indicate a higher than default priority, but keep it as low as possible since PSCI reset is known to fail on some boards.
For reference, which boards?
It's unfortunate that that a PSCI 0.2+ implementation would be lacking a working SYSTEM_RESET implementation, and it's certainly a mistake to discourage.
Quoted 6 lines
Signed-off-by Guenter Roeck <[email protected]>---
It might make sense to introduce a restart-priority property for devicetree based configurations, but I am not sure if this would be acceptable.From the DT side, I'm not keen on properties for priorities. They're
incredibly fragile and don't really encode a HW property.
A better option would be to have a property to describe how the PSCI implementation is broken (e.g. broken-system-reset), and not register the handler at all in that case.
Thanks,
Mark.
Quoted 39 lines
drivers/firmware/psci.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)drivers/firmware/psci.c +9
-2@@ -231,11 +231,18 @@ static int get_set_conduit_method(struct device_node *np)return 0 ; } -static void psci_sys_reset (enum reboot_mode reboot_mode,const char *cmd) +static int psci_sys_reset (struct notifier_block *np,unsigned long action, +void *data) {invoke_psci_fn (PSCI_0_2_FN_SYSTEM_RESET ,0 ,0 ,0 ); +return NOTIFY_DONE ; } +static struct notifier_block psci_sys_reset_nb = { + .notifier_call = psci_sys_reset, + .priority =129 , +}; +static void psci_sys_poweroff (void ) {invoke_psci_fn (PSCI_0_2_FN_SYSTEM_OFF ,0 ,0 ,0 );@@ -461,7 +468,7 @@ static void __init psci_0_2_set_functions(void) psci_ops.migrate_info_type = psci_migrate_info_type; - arm_pm_restart = psci_sys_reset; +register_restart_handler (&psci_sys_reset_nb); pm_power_off = psci_sys_poweroff; }Signature · 1 line
2.5.0
Re: [PATCH 3/6] ARM: PSCI: Register with kernel restart handler
Dear Mark,
Quoted 9 lines · On Wed, 13 Apr 2016 12:05:19 +0100 Mark Rutland wrote:
Quoted 7 lines · Guenter Roeck
Register with kernel restart handler instead of setting
arm_pm_restartdirectly. This enables support for replacing the PSCI restart handler with a different handler if necessary for a specific board.Select a priority of 129 to indicate a higher than default priority, but keep it as low as possible since PSCI reset is known to fail on some boards.
Quoted 5 lines
For reference, which boards?
It's unfortunate that that a PSCI 0.2+ implementation would be lacking a working
SYSTEM_RESETimplementation, and it's certainly a mistake to discourage.
I may understand the case: on some platforms, the only reset way is to trigger the wdt, for various reason the underly firmware isn't convenient to touch the wdt.
But I'd like 127 or lower for the default priority for the above case, because various wdt reset_handler priority is 128.
Thanks,
Jisheng
Quoted 60 lines
Quoted 5 lines
Signed-off-by Guenter Roeck <[email protected]>---
It might make sense to introduce a restart-priority property for devicetree based configurations, but I am not sure if this would be acceptable.From the DT side, I'm not keen on properties for priorities. They're incredibly fragile and don't really encode a HW property.
A better option would be to have a property to describe how the PSCI implementation is broken (e.g. broken-system-reset), and not register the handler at all in that case.
Thanks,
Mark.Quoted 39 lines
drivers/firmware/psci.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)drivers/firmware/psci.c +9
-2@@ -231,11 +231,18 @@ static int get_set_conduit_method(struct device_node *np)return 0 ; } -static void psci_sys_reset (enum reboot_mode reboot_mode,const char *cmd) +static int psci_sys_reset (struct notifier_block *np,unsigned long action, +void *data) {invoke_psci_fn (PSCI_0_2_FN_SYSTEM_RESET ,0 ,0 ,0 ); +return NOTIFY_DONE ; } +static struct notifier_block psci_sys_reset_nb = { + .notifier_call = psci_sys_reset, + .priority =129 , +}; +static void psci_sys_poweroff (void ) {invoke_psci_fn (PSCI_0_2_FN_SYSTEM_OFF ,0 ,0 ,0 );@@ -461,7 +468,7 @@ static void __init psci_0_2_set_functions(void) psci_ops.migrate_info_type = psci_migrate_info_type; - arm_pm_restart = psci_sys_reset; +register_restart_handler (&psci_sys_reset_nb); pm_power_off = psci_sys_poweroff; }Signature · 1 line
2.5.0_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Re: [PATCH 3/6] ARM: PSCI: Register with kernel restart handler
In reply to Mark RutlandQuoted 11 lines · Mark Rutland
Quoted 7 lines · Guenter Roeck
Register with kernel restart handler instead of setting
arm_pm_restartdirectly. This enables support for replacing the PSCI restart handler with a different handler if necessary for a specific board.Select a priority of 129 to indicate a higher than default priority, but keep it as low as possible since PSCI reset is known to fail on some boards.
For reference, which boards?
Salvator-X, reported by Geert Uytterhoeven. Wolfram Sang also reported that it is broken on a board he is using, but I don't recall if it is the same board.
Quoted 4 lines
It's unfortunate that that a PSCI 0.2+ implementation would be lacking a working
SYSTEM_RESETimplementation, and it's certainly a mistake to discourage.
Quoted 8 lines
Quoted 6 lines
Signed-off-by Guenter Roeck <[email protected]>---
It might make sense to introduce a restart-priority property for devicetree based configurations, but I am not sure if this would be acceptable.From the DT side, I'm not keen on properties for priorities. They're
incredibly fragile and don't really encode a HW property.
Depends. It is a convenient means to say "primary restart method" or "may be broken".
Quoted 4 lines
A better option would be to have a property to describe how the PSCI implementation is broken (e.g. broken-system-reset), and not register the handler at all in that case.
... just like this. I'll look into it.
Thanks,
Guenter
Quoted 43 lines
Thanks,
Mark.Quoted 39 lines
drivers/firmware/psci.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)drivers/firmware/psci.c +9
-3@@ -231,11 +231,18 @@ static int get_set_conduit_method(struct device_node *np)return 0 ; } -static void psci_sys_reset (enum reboot_mode reboot_mode,const char *cmd) +static int psci_sys_reset (struct notifier_block *np,unsigned long action, +void *data) {invoke_psci_fn (PSCI_0_2_FN_SYSTEM_RESET ,0 ,0 ,0 ); +return NOTIFY_DONE ; } +static struct notifier_block psci_sys_reset_nb = { + .notifier_call = psci_sys_reset, + .priority =129 , +}; +static void psci_sys_poweroff (void ) {invoke_psci_fn (PSCI_0_2_FN_SYSTEM_OFF ,0 ,0 ,0 );@@ -461,7 +468,7 @@ static void __init psci_0_2_set_functions(void) psci_ops.migrate_info_type = psci_migrate_info_type; - arm_pm_restart = psci_sys_reset; +register_restart_handler (&psci_sys_reset_nb); pm_power_off = psci_sys_poweroff; } --2.5.0
Re: [PATCH 3/6] ARM: PSCI: Register with kernel restart handler
Quoted 11 lines · Guenter Roeck
Quoted 10 lines · Mark Rutland
Quoted 8 lines · Guenter Roeck
Register with kernel restart handler instead of setting
arm_pm_restartdirectly. This enables support for replacing the PSCI restart handler with a different handler if necessary for a specific board.Select a priority of 129 to indicate a higher than default priority, but keep it as low as possible since PSCI reset is known to fail on some boards.
Quoted 5 lines
Quoted 2 lines
For reference, which boards?
Salvator-X, reported by Geert Uytterhoeven. Wolfram Sang also reported that it is broken on a board he is using, but I don't recall if it is the same board.
Yes it is.
Quoted 10 lines
Quoted 10 lines
It's unfortunate that that a PSCI 0.2+ implementation would be lacking a working
SYSTEM_RESETimplementation, and it's certainly a mistake to discourage.Quoted 5 lines
Signed-off-by Guenter Roeck <[email protected]>---
It might make sense to introduce a restart-priority property for devicetree
based configurations, but I am not sure if this would be acceptable.
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
From the DT side, I'm not keen on properties for priorities. They're
incredibly fragile and don't really encode a HW property.
Depends. It is a convenient means to say "primary restart method" or "may be broken".
The issue is supposed to be fixed in a more recent firmware, which I still have to try.
DT indeed isn't the right place to work around this. What we need is a blacklist of bad firmware versions...
Or Perfect Firmware from Day One on (like Perfect DT from Day One ;-)
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Re: [PATCH 3/6] ARM: PSCI: Register with kernel restart handler
Quoted 36 lines · Geert Uytterhoeven
Quoted 11 lines · Guenter Roeck
Quoted 10 lines · Mark Rutland
Quoted 8 lines · Guenter Roeck
Register with kernel restart handler instead of setting
arm_pm_restartdirectly. This enables support for replacing the PSCI restart handler with a different handler if necessary for a specific board.Select a priority of 129 to indicate a higher than default priority, but keep it as low as possible since PSCI reset is known to fail on some boards.
Quoted 5 lines
Quoted 2 lines
For reference, which boards?
Salvator-X, reported by Geert Uytterhoeven. Wolfram Sang also reported that it is broken on a board he is using, but I don't recall if it is the same board.
Yes it is.
Quoted 10 lines
Quoted 10 lines
It's unfortunate that that a PSCI 0.2+ implementation would be lacking a working
SYSTEM_RESETimplementation, and it's certainly a mistake to discourage.Quoted 5 lines
Signed-off-by Guenter Roeck <[email protected]>---
It might make sense to introduce a restart-priority property for devicetree
based configurations, but I am not sure if this would be acceptable.Quoted 5 lines
Quoted 3 lines
Quoted 1 line
From the DT side, I'm not keen on properties for priorities. They're
incredibly fragile and don't really encode a HW property.
Depends. It is a convenient means to say "primary restart method" or "may be broken".
Quoted 7 lines
The issue is supposed to be fixed in a more recent firmware, which I still have to try.
DT indeed isn't the right place to work around this. What we need is a blacklist of bad firmware versions...
Or Perfect Firmware from Day One on (like Perfect DT from Day One ;-)
That makes things quite tricky. Best I can think of is a series of boolean devicetree properties, such as
broken-reset-handler
last-resort-restart-handler
secondary-restart-handler
default-restart-handler
primary-restart-handler
which ends up being quite similar to the 'restart-priority' property. I'll do this as follow-up patch, though - I do not see the point holding up the series for this, and it is really a separate problem. I'll send rev2 with the various Acked-by: and Reviewed-by: tags as well as the variable rename suggested by Wolfram.
Thanks,
Guenter
Re: [PATCH 3/6] ARM: PSCI: Register with kernel restart handler
Quoted 4 lines
That makes things quite tricky. Best I can think of is a series of boolean devicetree properties, such as
Quoted 8 lines
broken-reset-handler
last-resort-restart-handler
secondary-restart-handler
default-restart-handler
primary-restart-handlerwhich ends up being quite similar to the 'restart-priority' property. I'll do this as follow-up patch, though
Please CC me on this. I wanted to tackle this problem as well today. My findings/conclusions so far:
* There is one driver bringing 'priority' directly to DT already: gpio-restart
* Watchdog priorities are board dependant
* Having the priorities clear at boot-time is safer than configuring them at run-time
* The linux scheme (0-255) shouldn't be enforced in DT
So, I wondered about a "priority" binding which just states "the higher, the more important". Then any OS can decide what to do with it. In the Linux case, this could be: sort them and give them priority 256 - position_in_sorted_list.
Opinions?
Quoted 2 lines
- I do not see the point holding up the series for this, and it is really a separate problem.
Ack.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160414/86dea876/attachment-0001.sig>
Re: [PATCH 3/6] ARM: PSCI: Register with kernel restart handler
Quoted 10 lines · Wolfram Sang
Quoted 10 lines
That makes things quite tricky. Best I can think of is a series of boolean devicetree properties, such as
broken-reset-handler
last-resort-restart-handler
secondary-restart-handler
default-restart-handler
primary-restart-handler
Quoted 4 lines
Quoted 2 lines
which ends up being quite similar to the 'restart-priority' property. I'll do this as follow-up patch, though
Please CC me on this. I wanted to tackle this problem as well today. My
Sure.
Quoted 4 lines
findings/conclusions so far:
* There is one driver bringing 'priority' directly to DT already: gpio-restart
Correct.
Quoted 5 lines
* Watchdog priorities are board dependant
* Having the priorities clear at boot-time is safer than configuring them at run-time
Correct.
Quoted 7 lines
* The linux scheme (0-255) shouldn't be enforced in DT
So, I wondered about a "priority" binding which just states "the higher, the more important". Then any OS can decide what to do with it. In the Linux case, this could be: sort them and give them priority 256 -
position_in_sorted_list.
"the higher, the more important" makes sense to me. We don't have to enforce the linux scheme, though that happens to be the same (the priority argument in the notifier block takes an int, so it would not even be necessary to adjust it unless someone specifies 0xffffffff).
Quoted 2 lines
Opinions?
I am fine either way - boolean properties or numbers, with a personal preference for numbers as more flexible. Whatever is acceptable for the community is fine with me.
Guenter
Quoted 5 lines
Quoted 2 lines
- I do not see the point holding up the series for this, and it is really a separate problem.
Ack.
Re: [PATCH 3/6] ARM: PSCI: Register with kernel restart handler
Quoted 5 lines
"the higher, the more important" makes sense to me. We don't have to enforce the linux scheme, though that happens to be the same (the priority argument in the notifier block takes an int, so it would not even be necessary to adjust it unless someone specifies
0xffffffff).
I think we should enforce the scheme internally (but not in DT, of course):
a) it is documented to be in the range 0-255
b) it should be valid to prioritize the watchdogs with 1,2,3 in DT. If we don't apply the '255 - pos_in_sorted_list' value, then the priority could be below some machine default of 128, or?
Quoted 2 lines
I am fine either way - boolean properties or numbers, with a personal preference for numbers as more flexible.
Same here. Time to go to the DT list probably.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160414/bdba3a4d/attachment-0001.sig>
PATCH 4/6 ARM: Register with kernel restart handler
In reply to Guenter RoeckBy 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.
--- arch/arm/kernel/setup.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-)
arch/arm/kernel/setup.c +18 -2
@@ -1002,6 +1002,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;
@@ -1044,8 +1058,10 @@ void __init setup_arch(char **cmdline_p)paging_init (mdesc);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 ();
Signature · 1 line
2.5.0
PATCH 5/6 ARM64: Remove arm_pm_restart
In reply to Guenter RoeckAll users of arm_pm_restart have been converted to use the kernel restart handler.
--- arch/arm64/include/asm/system_misc.h | 2 -- arch/arm64/kernel/process.c | 7 +------ 2 files changed, 1 insertion(+), 8 deletions(-)
arch/arm64/include/asm/system_misc.h +0 -2
@@ -43,8 +43,6 @@ struct mm_struct;extern void show_pte (struct mm_struct *mm,unsigned long addr);extern void __show_regs (struct pt_regs *); -extern void (*arm_pm_restart)(enum reboot_mode reboot_mode,const char *cmd); -#define show_unhandled_signals_ratelimited () \ ({ \ static DEFINE_RATELIMIT_STATE(_rs, \
arch/arm64/kernel/process.c +1 -6
@@ -66,8 +66,6 @@ EXPORT_SYMBOL(__stack_chk_guard);void (*pm_power_off)(void );EXPORT_SYMBOL_GPL (pm_power_off); -void (*arm_pm_restart)(enum reboot_mode reboot_mode,const char *cmd); -/* * This is our default idle handler. */
@@ -153,10 +151,7 @@ void machine_restart(char *cmd)efi_reboot (reboot_mode,NULL );/* Now call the architecture specific reboot code. */ -if (arm_pm_restart) -arm_pm_restart (reboot_mode, cmd); -else -do_kernel_restart (cmd); +do_kernel_restart (cmd);/* * Whoops - the architecture was unable to reboot.
Signature · 1 line
2.5.0
Re: [PATCH 5/6] ARM64: Remove arm_pm_restart
Quoted 8 lines · Guenter Roeck
All users of
arm_pm_restarthave been converted to use the kernel restart handler.Signed-off-by Guenter Roeck <[email protected]>--- arch/arm64/include/asm/system_misc.h | 2 -- arch/arm64/kernel/process.c | 7 +------ 2 files changed, 1 insertion(+), 8 deletions(-)
PATCH 6/6 ARM: Remove arm_pm_restart
In reply to Guenter RoeckAll users of arm_pm_restart have been converted to use the kernel restart handler.
--- arch/arm/include/asm/system_misc.h | 1 - arch/arm/kernel/reboot.c | 6 +----- 2 files changed, 1 insertion(+), 6 deletions(-)
arch/arm/include/asm/system_misc.h +0 -1
@@ -11,7 +11,6 @@extern void cpu_init (void );void soft_restart (unsigned long ); -extern void (*arm_pm_restart)(enum reboot_mode reboot_mode,const char *cmd);extern void (*arm_pm_idle)(void );#define UDBG_UNDEFINED (1 << 0)
arch/arm/kernel/reboot.c +1 -5
@@ -20,7 +20,6 @@ typedef void (*phys_reset_t)(unsigned long);/* * Function pointers to optional machine specific functions */ -void (*arm_pm_restart)(enum reboot_mode reboot_mode,const char *cmd);void (*pm_power_off)(void );EXPORT_SYMBOL (pm_power_off);
@@ -140,10 +139,7 @@ void machine_restart(char *cmd)local_irq_disable ();smp_send_stop (); -if (arm_pm_restart) -arm_pm_restart (reboot_mode, cmd); -else -do_kernel_restart (cmd); +do_kernel_restart (cmd);/* Give a grace period for failure to restart of 1s */ mdelay (1000 );
Signature · 1 line
2.5.0
Quoted 2 lines · Guenter Roeck
This is the final push to replace
arm_pm_restartwith the kernel restart handler. Finally droparm_pm_restartafter it is no longer used.
Nice! Will check it next week and add the reset_handler to my watchdog.
Thanks!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160408/92dd979c/attachment.sig>
Quoted 3 lines · Guenter Roeck
This is the final push to replace
arm_pm_restartwith the kernel restart handler. Finally droparm_pm_restartafter it is no longer used. The following changes since commit541d8f4d59d79f5d37c8c726f723d42ff307db57:
Looks good to me,
Quoted 4 lines · Guenter Roeck
This is the final push to replace
arm_pm_restartwith the kernel restart handler. Finally droparm_pm_restartafter it is no longer used. The following changes since commit541d8f4d59d79f5d37c8c726f723d42ff307db57:
Quoted 8 lines
----------------------------------------------------------------
Guenter Roeck (6):
ARM: prima2: Register with kernel restart handler
ARM: xen: Register with kernel restart handler
ARM: PSCI: Register with kernel restart handler
ARM: Register with kernel restart handler
ARM64: Removearm_pm_restart
ARM: Removearm_pm_restart
I double checked that all arm_pm_restart were converted, did a visual review of the patches (one nit found), and came to the same conclusions about the priority settings. Thus:
I also added a watchdog restart handler with higher priority than the PSCI handler. That now works nicely \o/
So, for patches 3+5 you could also add:
Thanks,
Wolfram
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160412/c733d531/attachment.sig>