linux-sh.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 02/21] ARM: shmobile: Convert to hotplug state machine
       [not found] <20160906170457.32393-1-bigeasy@linutronix.de>
@ 2016-09-06 17:04 ` Sebastian Andrzej Siewior
  2016-09-06 18:05   ` Geert Uytterhoeven
  2016-09-06 17:04 ` [PATCH 05/21] sh: SH-X3 SMP: " Sebastian Andrzej Siewior
  1 sibling, 1 reply; 4+ messages in thread
From: Sebastian Andrzej Siewior @ 2016-09-06 17:04 UTC (permalink / raw)
  To: linux-arm-kernel

Install the callbacks via the state machine.

Cc: Simon Horman <horms@verge.net.au>
Cc: Magnus Damm <magnus.damm@gmail.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-sh@vger.kernel.org
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 arch/arm/mach-shmobile/platsmp-scu.c | 26 ++++++++------------------
 include/linux/cpuhotplug.h           |  1 +
 2 files changed, 9 insertions(+), 18 deletions(-)

diff --git a/arch/arm/mach-shmobile/platsmp-scu.c b/arch/arm/mach-shmobile/platsmp-scu.c
index 8d478f1da265..d1ecaf37d142 100644
--- a/arch/arm/mach-shmobile/platsmp-scu.c
+++ b/arch/arm/mach-shmobile/platsmp-scu.c
@@ -21,26 +21,14 @@
 static phys_addr_t shmobile_scu_base_phys;
 static void __iomem *shmobile_scu_base;
 
-static int shmobile_smp_scu_notifier_call(struct notifier_block *nfb,
-					  unsigned long action, void *hcpu)
+static int shmobile_scu_cpu_prepare(unsigned int cpu)
 {
-	unsigned int cpu = (long)hcpu;
-
-	switch (action) {
-	case CPU_UP_PREPARE:
-		/* For this particular CPU register SCU SMP boot vector */
-		shmobile_smp_hook(cpu, virt_to_phys(shmobile_boot_scu),
-				  shmobile_scu_base_phys);
-		break;
-	};
-
-	return NOTIFY_OK;
+	/* For this particular CPU register SCU SMP boot vector */
+	shmobile_smp_hook(cpu, virt_to_phys(shmobile_boot_scu),
+			  shmobile_scu_base_phys);
+	return 0;
 }
 
-static struct notifier_block shmobile_smp_scu_notifier = {
-	.notifier_call = shmobile_smp_scu_notifier_call,
-};
-
 void __init shmobile_smp_scu_prepare_cpus(phys_addr_t scu_base_phys,
 					  unsigned int max_cpus)
 {
@@ -54,7 +42,9 @@ void __init shmobile_smp_scu_prepare_cpus(phys_addr_t scu_base_phys,
 	scu_power_mode(shmobile_scu_base, SCU_PM_NORMAL);
 
 	/* Use CPU notifier for reset vector control */
-	register_cpu_notifier(&shmobile_smp_scu_notifier);
+	cpuhp_setup_state_nocalls(CPUHP_ARM_SHMOBILE_SCU_PREPARE,
+				  "arm/shmobile-scu:prepare",
+				  shmobile_scu_cpu_prepare, NULL);
 }
 
 #ifdef CONFIG_HOTPLUG_CPU
diff --git a/include/linux/cpuhotplug.h b/include/linux/cpuhotplug.h
index 0da071ff36d2..008eed0c0787 100644
--- a/include/linux/cpuhotplug.h
+++ b/include/linux/cpuhotplug.h
@@ -35,6 +35,7 @@ enum cpuhp_state {
 	CPUHP_POWERPC_PMAC_PREPARE,
 	CPUHP_POWERPC_MMU_CTX_PREPARE,
 	CPUHP_NOTIFY_PREPARE,
+	CPUHP_ARM_SHMOBILE_SCU_PREPARE,
 	CPUHP_TIMERS_DEAD,
 	CPUHP_BRINGUP_CPU,
 	CPUHP_AP_IDLE_DEAD,
-- 
2.9.3


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 05/21] sh: SH-X3 SMP: Convert to hotplug state machine
       [not found] <20160906170457.32393-1-bigeasy@linutronix.de>
  2016-09-06 17:04 ` [PATCH 02/21] ARM: shmobile: Convert to hotplug state machine Sebastian Andrzej Siewior
@ 2016-09-06 17:04 ` Sebastian Andrzej Siewior
  1 sibling, 0 replies; 4+ messages in thread
From: Sebastian Andrzej Siewior @ 2016-09-06 17:04 UTC (permalink / raw)
  To: linux-kernel
  Cc: Peter Zijlstra, Ingo Molnar, rt, tglx, Sebastian Andrzej Siewior,
	linux-sh

Install the callbacks via the state machine.

Cc: linux-sh@vger.kernel.org
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 arch/sh/kernel/cpu/sh4a/smp-shx3.c | 26 +++++---------------------
 include/linux/cpuhotplug.h         |  1 +
 2 files changed, 6 insertions(+), 21 deletions(-)

diff --git a/arch/sh/kernel/cpu/sh4a/smp-shx3.c b/arch/sh/kernel/cpu/sh4a/smp-shx3.c
index 839612c8a0a0..0d3637c494bf 100644
--- a/arch/sh/kernel/cpu/sh4a/smp-shx3.c
+++ b/arch/sh/kernel/cpu/sh4a/smp-shx3.c
@@ -122,32 +122,16 @@ static void shx3_update_boot_vector(unsigned int cpu)
 	__raw_writel(STBCR_RESET, STBCR_REG(cpu));
 }
 
-static int
-shx3_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu)
+static int shx3_cpu_prepare(unsigned int cpu)
 {
-	unsigned int cpu = (unsigned int)hcpu;
-
-	switch (action) {
-	case CPU_UP_PREPARE:
-		shx3_update_boot_vector(cpu);
-		break;
-	case CPU_ONLINE:
-		pr_info("CPU %u is now online\n", cpu);
-		break;
-	case CPU_DEAD:
-		break;
-	}
-
-	return NOTIFY_OK;
+	shx3_update_boot_vector(cpu);
+	return 0;
 }
 
-static struct notifier_block shx3_cpu_notifier = {
-	.notifier_call		= shx3_cpu_callback,
-};
-
 static int register_shx3_cpu_notifier(void)
 {
-	register_hotcpu_notifier(&shx3_cpu_notifier);
+	cpuhp_setup_state_nocalls(CPUHP_SH_SH3X_PREPARE, "sh/shx3:prepare",
+				  shx3_cpu_prepare, NULL);
 	return 0;
 }
 late_initcall(register_shx3_cpu_notifier);
diff --git a/include/linux/cpuhotplug.h b/include/linux/cpuhotplug.h
index 35859aafbbfc..8dec2a236af3 100644
--- a/include/linux/cpuhotplug.h
+++ b/include/linux/cpuhotplug.h
@@ -37,6 +37,7 @@ enum cpuhp_state {
 	CPUHP_POWERPC_MMU_CTX_PREPARE,
 	CPUHP_NOTIFY_PREPARE,
 	CPUHP_ARM_SHMOBILE_SCU_PREPARE,
+	CPUHP_SH_SH3X_PREPARE,
 	CPUHP_TIMERS_DEAD,
 	CPUHP_BRINGUP_CPU,
 	CPUHP_AP_IDLE_DEAD,
-- 
2.9.3


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 02/21] ARM: shmobile: Convert to hotplug state machine
  2016-09-06 17:04 ` [PATCH 02/21] ARM: shmobile: Convert to hotplug state machine Sebastian Andrzej Siewior
@ 2016-09-06 18:05   ` Geert Uytterhoeven
  2016-09-07 13:58     ` Sebastian Andrzej Siewior
  0 siblings, 1 reply; 4+ messages in thread
From: Geert Uytterhoeven @ 2016-09-06 18:05 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Sebastian,

CC linux-renesas-soc

On Tue, Sep 6, 2016 at 7:04 PM, Sebastian Andrzej Siewior
<bigeasy@linutronix.de> wrote:
> Install the callbacks via the state machine.

Please describe why this is desirable.

> Cc: Simon Horman <horms@verge.net.au>
> Cc: Magnus Damm <magnus.damm@gmail.com>
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linux-sh@vger.kernel.org
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> ---
>  arch/arm/mach-shmobile/platsmp-scu.c | 26 ++++++++------------------
>  include/linux/cpuhotplug.h           |  1 +
>  2 files changed, 9 insertions(+), 18 deletions(-)
>
> diff --git a/arch/arm/mach-shmobile/platsmp-scu.c b/arch/arm/mach-shmobile/platsmp-scu.c
> index 8d478f1da265..d1ecaf37d142 100644
> --- a/arch/arm/mach-shmobile/platsmp-scu.c
> +++ b/arch/arm/mach-shmobile/platsmp-scu.c
> @@ -21,26 +21,14 @@
>  static phys_addr_t shmobile_scu_base_phys;
>  static void __iomem *shmobile_scu_base;
>
> -static int shmobile_smp_scu_notifier_call(struct notifier_block *nfb,
> -                                         unsigned long action, void *hcpu)
> +static int shmobile_scu_cpu_prepare(unsigned int cpu)
>  {
> -       unsigned int cpu = (long)hcpu;
> -
> -       switch (action) {
> -       case CPU_UP_PREPARE:
> -               /* For this particular CPU register SCU SMP boot vector */
> -               shmobile_smp_hook(cpu, virt_to_phys(shmobile_boot_scu),
> -                                 shmobile_scu_base_phys);
> -               break;
> -       };
> -
> -       return NOTIFY_OK;
> +       /* For this particular CPU register SCU SMP boot vector */
> +       shmobile_smp_hook(cpu, virt_to_phys(shmobile_boot_scu),
> +                         shmobile_scu_base_phys);
> +       return 0;
>  }
>
> -static struct notifier_block shmobile_smp_scu_notifier = {
> -       .notifier_call = shmobile_smp_scu_notifier_call,
> -};
> -
>  void __init shmobile_smp_scu_prepare_cpus(phys_addr_t scu_base_phys,
>                                           unsigned int max_cpus)
>  {
> @@ -54,7 +42,9 @@ void __init shmobile_smp_scu_prepare_cpus(phys_addr_t scu_base_phys,
>         scu_power_mode(shmobile_scu_base, SCU_PM_NORMAL);
>
>         /* Use CPU notifier for reset vector control */
> -       register_cpu_notifier(&shmobile_smp_scu_notifier);
> +       cpuhp_setup_state_nocalls(CPUHP_ARM_SHMOBILE_SCU_PREPARE,
> +                                 "arm/shmobile-scu:prepare",
> +                                 shmobile_scu_cpu_prepare, NULL);
>  }
>
>  #ifdef CONFIG_HOTPLUG_CPU
> diff --git a/include/linux/cpuhotplug.h b/include/linux/cpuhotplug.h
> index 0da071ff36d2..008eed0c0787 100644
> --- a/include/linux/cpuhotplug.h
> +++ b/include/linux/cpuhotplug.h
> @@ -35,6 +35,7 @@ enum cpuhp_state {
>         CPUHP_POWERPC_PMAC_PREPARE,
>         CPUHP_POWERPC_MMU_CTX_PREPARE,
>         CPUHP_NOTIFY_PREPARE,
> +       CPUHP_ARM_SHMOBILE_SCU_PREPARE,
>         CPUHP_TIMERS_DEAD,
>         CPUHP_BRINGUP_CPU,
>         CPUHP_AP_IDLE_DEAD,

What's the rationale behind adding all these numbers and always
iterating over all
of them, even though most/all of them cannot be used at the same time
(e.g. CPUHP_SH_SH3X_PREPARE is for SuperH, while
 CPUHP_ARM_SHMOBILE_SCU_PREPARE is for ARM)?

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 02/21] ARM: shmobile: Convert to hotplug state machine
  2016-09-06 18:05   ` Geert Uytterhoeven
@ 2016-09-07 13:58     ` Sebastian Andrzej Siewior
  0 siblings, 0 replies; 4+ messages in thread
From: Sebastian Andrzej Siewior @ 2016-09-07 13:58 UTC (permalink / raw)
  To: linux-arm-kernel

On 2016-09-06 20:05:37 [+0200], Geert Uytterhoeven wrote:
> Hi Sebastian,
Hi Geert,

> Please describe why this is desirable.

We have now an old and new infrastructure in place to handle hotplug
notifications while a CPU goes up and/or down. We want to get rid of the
old infrastructure and are converting its users away. 

> > diff --git a/include/linux/cpuhotplug.h b/include/linux/cpuhotplug.h
> > index 0da071ff36d2..008eed0c0787 100644
> > --- a/include/linux/cpuhotplug.h
> > +++ b/include/linux/cpuhotplug.h
> > @@ -35,6 +35,7 @@ enum cpuhp_state {
> >         CPUHP_POWERPC_PMAC_PREPARE,
> >         CPUHP_POWERPC_MMU_CTX_PREPARE,
> >         CPUHP_NOTIFY_PREPARE,
> > +       CPUHP_ARM_SHMOBILE_SCU_PREPARE,
> >         CPUHP_TIMERS_DEAD,
> >         CPUHP_BRINGUP_CPU,
> >         CPUHP_AP_IDLE_DEAD,
> 
> What's the rationale behind adding all these numbers and always
> iterating over all
> of them, even though most/all of them cannot be used at the same time
> (e.g. CPUHP_SH_SH3X_PREPARE is for SuperH, while
>  CPUHP_ARM_SHMOBILE_SCU_PREPARE is for ARM)?

PREPARE + STARTING states require static ids. The online callback has
dynamic allocations of ids since it was assumed that this is the most
common one.
We will most likely evaluate the situation once we done and total number
of IDS are not acceptable.

> 
> Gr{oetje,eeting}s,
> 
>                         Geert
> 

Sebastian

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-09-07 13:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20160906170457.32393-1-bigeasy@linutronix.de>
2016-09-06 17:04 ` [PATCH 02/21] ARM: shmobile: Convert to hotplug state machine Sebastian Andrzej Siewior
2016-09-06 18:05   ` Geert Uytterhoeven
2016-09-07 13:58     ` Sebastian Andrzej Siewior
2016-09-06 17:04 ` [PATCH 05/21] sh: SH-X3 SMP: " Sebastian Andrzej Siewior

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).