Skip to contentSkip to conversation

ARM/ARM64: Drop arm_pm_restart

PATCH In review Guenter Roeck 3 participants 14 messages Apr 15, 2016 – Apr 19, 2016

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

v2 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.

---
v2: Rebased to v4.6-rc3
Added Reviewed-by/Acked/by/Tested-by tags
Variable name change in patch 3/6.

----------------------------------------------------------------
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(-)
#1 lore raw

PATCH v2 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.

---
v2: Rebased to v4.6-rc3, added Reviewed/by/Acked-by tags

 arch/arm/mach-prima2/rstc.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
arch/arm/mach-prima2/rstc.c +9 -2
index 7c251eb11d01..1639997c5b49 100644
@@ -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
#2 lore raw

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

In reply to Guenter Roeck

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.

---
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(-)
arch/arm/xen/enlighten.c +11 -2
index 75cd7345c654..76a1d12fd27e 100644
@@ -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
#3 lore raw

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

Quoted 10 lines · Guenter Roeck

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.

Thanks. I assume this is going to go in via Russell or Catalin's tree with the rest of your series?

Quoted 53 lines

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(-)
arch/arm/xen/enlighten.c +11 -2
index 75cd7345c654..76a1d12fd27e 100644
@@ -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
#4 lore raw

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

Quoted 7 lines · Stefano Stabellini
Quoted 6 lines · Guenter Roeck

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.

Quoted 8 lines
Quoted 4 lines

Thanks. I assume this is going to go in via Russell or Catalin's tree with the rest of your series?

I would suggest Russell, if he is willing to pick it up, since it mostly affects arm.

Guenter

Quoted 54 lines
Quoted 54 lines

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(-)
arch/arm/xen/enlighten.c +11 -2
index 75cd7345c654..76a1d12fd27e 100644
@@ -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
#5 lore raw

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

Quoted 13 lines · Guenter Roeck
Quoted 12 lines · Stefano Stabellini
Quoted 10 lines · Guenter Roeck

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.

Quoted 5 lines
Quoted 3 lines

Thanks. I assume this is going to go in via Russell or Catalin's tree with the rest of your series?

I would suggest Russell, if he is willing to pick it up, since it mostly affects arm.

I am happy with that. In that case I'll remove this patch from my queue not to have duplicates.

Quoted 56 lines
Quoted 55 lines
Quoted 55 lines

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(-)
arch/arm/xen/enlighten.c +11 -2
index 75cd7345c654..76a1d12fd27e 100644
@@ -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
#6 lore raw

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

In reply to Guenter Roeck
Quoted 13 lines · Guenter Roeck
Quoted 12 lines · Stefano Stabellini
Quoted 10 lines · Guenter Roeck

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.

Quoted 5 lines
Quoted 3 lines

Thanks. I assume this is going to go in via Russell or Catalin's tree with the rest of your series?

I would suggest Russell, if he is willing to pick it up, since it mostly affects arm.

I am happy with that. In that case I'll remove this patch from my queue not to have duplicates.

Quoted 46 lines
Quoted 46 lines
Quoted 46 lines

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(-)
arch/arm/xen/enlighten.c +10 -1
index 75cd7345c654..76a1d12fd27e 100644
@@ -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
Quoted 9 lines
arch/arm/xen/enlighten.c +1 -1
 	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

#7 lore raw

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

In reply to Stefano Stabellini
Quoted 7 lines · Stefano Stabellini
Quoted 6 lines · Guenter Roeck

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.

Quoted 8 lines
Quoted 4 lines

Thanks. I assume this is going to go in via Russell or Catalin's tree with the rest of your series?

I would suggest Russell, if he is willing to pick it up, since it mostly affects arm.

Guenter

Quoted 45 lines
Quoted 45 lines

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(-)
arch/arm/xen/enlighten.c +10 -1
index 75cd7345c654..76a1d12fd27e 100644
@@ -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 9 lines
Quoted 9 lines
arch/arm/xen/enlighten.c +1 -1
 	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

#8 lore raw

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

In reply to Guenter Roeck
Quoted 10 lines · Guenter Roeck

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.

Thanks. I assume this is going to go in via Russell or Catalin's tree with the rest of your series?

Quoted 53 lines

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(-)
arch/arm/xen/enlighten.c +11 -2
index 75cd7345c654..76a1d12fd27e 100644
@@ -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

#9 lore raw

PATCH v2 3/6 ARM: PSCI: Register with kernel restart handler

In reply to Guenter Roeck

Register 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.

---
v2: Rebased to v4.6-rc3, added Reviewed/by/Acked-by/Tested-by tags

    Variable name change: np -> nb
 drivers/firmware/psci.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/firmware/psci.c +9 -2
index 11bfee8b79a9..a0f71480f145 100644
@@ -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 *nb, 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
Acked-by on v2 3/6
#10 lore raw

Re: [PATCH v2 3/6] ARM: PSCI: Register with kernel restart handler

Quoted 7 lines · Guenter Roeck

Register 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.

I do not think you should play with notifiers priorities to paper over FW bugs, if PSCI SYSTEM_RESET is broken FW is not PSCI0.2+ compliant so it should not even be advertised as such in the DT.

This means that this priority kludge must disappear soon, what priority to assign to the PSCI reset handler remains to be seen.

Are you sending this patch series via arm-soc ? If so:

Quoted 47 lines

---
v2: Rebased to v4.6-rc3, added Reviewed/by/Acked-by/Tested-by tags

    Variable name change: np -> nb
 drivers/firmware/psci.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/firmware/psci.c +9 -2
index 11bfee8b79a9..a0f71480f145 100644
@@ -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 *nb, 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
#11 lore raw

PATCH v2 4/6 ARM: Register with kernel restart handler

In reply to Guenter Roeck

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.

---
v2: Rebased to v4.6-rc3, added Reviewed/by/Acked-by tags

 arch/arm/kernel/setup.c | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)
arch/arm/kernel/setup.c +18 -2
index a28fce0bdbbe..735e6a2ce216 100644
@@ -1004,6 +1004,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;
@@ -1046,8 +1060,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
#12 lore raw

PATCH v2 5/6 ARM64: Remove arm_pm_restart

In reply to Guenter Roeck

All users of arm_pm_restart have been converted to use the kernel restart handler.

---
v2: Rebased to v4.6-rc3, added Reviewed/by/Acked-by/Tested-by tags

 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
index 57f110bea6a8..f1d865b7d38d 100644
@@ -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
index 80624829db61..29c29984eca0 100644
@@ -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
#13 lore raw

PATCH v2 6/6 ARM: Remove arm_pm_restart

In reply to Guenter Roeck

All users of arm_pm_restart have been converted to use the kernel restart handler.

---
v2: Rebased to v4.6-rc3, added Reviewed/by/Acked-by tags

 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
index a3d61ad984af..6c952538f1e8 100644
@@ -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
index 71a2ff9ec490..4785c39ee3eb 100644
@@ -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