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


Groups > linux.kernel > #1379432 > unrolled thread

[PATCH v2 0/6] ARM/ARM64: Drop arm_pm_restart

Started byGuenter Roeck <linux@roeck-us.net>
First post2016-04-15 04:50 +0200
Last post2016-04-15 04:50 +0200
Articles 10 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [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
      Re: [PATCH v2 2/6] ARM: xen: Register with kernel restart handler Stefano Stabellini <sstabellini@kernel.org> - 2016-04-15 20:30 +0200
        Re: [PATCH v2 2/6] ARM: xen: Register with kernel restart handler Guenter Roeck <linux@roeck-us.net> - 2016-04-15 21:40 +0200
          Re: [PATCH v2 2/6] ARM: xen: Register with kernel restart handler Stefano Stabellini <sstabellini@kernel.org> - 2016-04-15 23:20 +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
      Re: [PATCH v2 3/6] ARM: PSCI: Register with kernel restart handler Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> - 2016-04-19 17: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

#1379432 — [PATCH v2 0/6] ARM/ARM64: Drop arm_pm_restart

FromGuenter Roeck <linux@roeck-us.net>
Date2016-04-15 04:50 +0200
Subject[PATCH v2 0/6] ARM/ARM64: Drop arm_pm_restart
Message-ID<ro1Zv-41K-5@gated-at.bofh.it>
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(-)

[toc] | [next] | [standalone]


#1379434 — [PATCH v2 6/6] ARM: Remove arm_pm_restart

FromGuenter Roeck <linux@roeck-us.net>
Date2016-04-15 04:50 +0200
Subject[PATCH v2 6/6] ARM: Remove arm_pm_restart
Message-ID<ro1Zw-41K-13@gated-at.bofh.it>
In reply to#1379432
All users of arm_pm_restart have been converted to use the kernel restart
handler.

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>
---
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(-)

diff --git a/arch/arm/include/asm/system_misc.h b/arch/arm/include/asm/system_misc.h
index a3d61ad984af..6c952538f1e8 100644
--- a/arch/arm/include/asm/system_misc.h
+++ b/arch/arm/include/asm/system_misc.h
@@ -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)
diff --git a/arch/arm/kernel/reboot.c b/arch/arm/kernel/reboot.c
index 71a2ff9ec490..4785c39ee3eb 100644
--- a/arch/arm/kernel/reboot.c
+++ b/arch/arm/kernel/reboot.c
@@ -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);
-- 
2.5.0

[toc] | [prev] | [next] | [standalone]


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

FromGuenter Roeck <linux@roeck-us.net>
Date2016-04-15 04:50 +0200
Subject[PATCH v2 2/6] ARM: xen: Register with kernel restart handler
Message-ID<ro1Zv-41K-9@gated-at.bofh.it>
In reply to#1379432
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

[toc] | [prev] | [next] | [standalone]


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

FromStefano Stabellini <sstabellini@kernel.org>
Date2016-04-15 20:30 +0200
SubjectRe: [PATCH v2 2/6] ARM: xen: Register with kernel restart handler
Message-ID<rogFb-7ma-9@gated-at.bofh.it>
In reply to#1379435
On Thu, 14 Apr 2016, Guenter Roeck wrote:
> 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>

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


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

[toc] | [prev] | [next] | [standalone]


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

FromGuenter Roeck <linux@roeck-us.net>
Date2016-04-15 21:40 +0200
SubjectRe: [PATCH v2 2/6] ARM: xen: Register with kernel restart handler
Message-ID<rohKW-8cQ-31@gated-at.bofh.it>
In reply to#1380089
On Fri, Apr 15, 2016 at 11:22:36AM -0700, Stefano Stabellini wrote:
> On Thu, 14 Apr 2016, Guenter Roeck wrote:
> > 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>
> 
> 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

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

[toc] | [prev] | [next] | [standalone]


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

FromStefano Stabellini <sstabellini@kernel.org>
Date2016-04-15 23:20 +0200
SubjectRe: [PATCH v2 2/6] ARM: xen: Register with kernel restart handler
Message-ID<rojjI-119-29@gated-at.bofh.it>
In reply to#1380189
On Fri, 15 Apr 2016, Guenter Roeck wrote:
> On Fri, Apr 15, 2016 at 11:22:36AM -0700, Stefano Stabellini wrote:
> > On Thu, 14 Apr 2016, Guenter Roeck wrote:
> > > 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>
> > 
> > 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.


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

[toc] | [prev] | [next] | [standalone]


#1379436 — [PATCH v2 5/6] ARM64: Remove arm_pm_restart

FromGuenter Roeck <linux@roeck-us.net>
Date2016-04-15 04:50 +0200
Subject[PATCH v2 5/6] ARM64: Remove arm_pm_restart
Message-ID<ro1Zw-41K-17@gated-at.bofh.it>
In reply to#1379432
All users of arm_pm_restart have been converted to use the kernel restart
handler.

Acked-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
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(-)

diff --git a/arch/arm64/include/asm/system_misc.h b/arch/arm64/include/asm/system_misc.h
index 57f110bea6a8..f1d865b7d38d 100644
--- a/arch/arm64/include/asm/system_misc.h
+++ b/arch/arm64/include/asm/system_misc.h
@@ -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,				\
diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c
index 80624829db61..29c29984eca0 100644
--- a/arch/arm64/kernel/process.c
+++ b/arch/arm64/kernel/process.c
@@ -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.
-- 
2.5.0

[toc] | [prev] | [next] | [standalone]


#1379439 — [PATCH v2 3/6] ARM: PSCI: Register with kernel restart handler

FromGuenter Roeck <linux@roeck-us.net>
Date2016-04-15 04:50 +0200
Subject[PATCH v2 3/6] ARM: PSCI: Register with kernel restart handler
Message-ID<ro1Zw-41K-25@gated-at.bofh.it>
In reply to#1379432
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.

Acked-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
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(-)

diff --git a/drivers/firmware/psci.c b/drivers/firmware/psci.c
index 11bfee8b79a9..a0f71480f145 100644
--- a/drivers/firmware/psci.c
+++ b/drivers/firmware/psci.c
@@ -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;
 }
-- 
2.5.0

[toc] | [prev] | [next] | [standalone]


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

FromLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Date2016-04-19 17:50 +0200
SubjectRe: [PATCH v2 3/6] ARM: PSCI: Register with kernel restart handler
Message-ID<rpG4y-Hd-19@gated-at.bofh.it>
In reply to#1379439
On Thu, Apr 14, 2016 at 07:42:34PM -0700, Guenter Roeck wrote:
> 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:

Acked-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>

> Acked-by: Arnd Bergmann <arnd@arndb.de>
> Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> ---
> 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(-)
> 
> diff --git a/drivers/firmware/psci.c b/drivers/firmware/psci.c
> index 11bfee8b79a9..a0f71480f145 100644
> --- a/drivers/firmware/psci.c
> +++ b/drivers/firmware/psci.c
> @@ -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;
>  }
> -- 
> 2.5.0
> 

[toc] | [prev] | [next] | [standalone]


#1379441 — [PATCH v2 1/6] ARM: prima2: Register with kernel restart handler

FromGuenter Roeck <linux@roeck-us.net>
Date2016-04-15 04:50 +0200
Subject[PATCH v2 1/6] ARM: prima2: Register with kernel restart handler
Message-ID<ro1Zw-41K-23@gated-at.bofh.it>
In reply to#1379432
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.

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>
---
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(-)

diff --git a/arch/arm/mach-prima2/rstc.c b/arch/arm/mach-prima2/rstc.c
index 7c251eb11d01..1639997c5b49 100644
--- a/arch/arm/mach-prima2/rstc.c
+++ b/arch/arm/mach-prima2/rstc.c
@@ -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);
-- 
2.5.0

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web