linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 5/6] ARM: shmobile: Add CPU notifier for CPUIdle boot vector
@ 2014-08-01  9:48 keita kobayashi
  2014-08-22 10:48 ` Magnus Damm
  0 siblings, 1 reply; 2+ messages in thread
From: keita kobayashi @ 2014-08-01  9:48 UTC (permalink / raw)
  To: linux-sh, linux-pm; +Cc: horms+renesas, Magnus Damm, rjw

Add CPU notifiers for the shared mach-shmobile cpuidle code.

Signed-off-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
---
 arch/arm/mach-shmobile/cpuidle.c |   24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/arch/arm/mach-shmobile/cpuidle.c b/arch/arm/mach-shmobile/cpuidle.c
index 19c0c98..1771dd3 100644
--- a/arch/arm/mach-shmobile/cpuidle.c
+++ b/arch/arm/mach-shmobile/cpuidle.c
@@ -20,6 +20,27 @@
 #include <asm/io.h>
 #include "common.h"

+static int shmobile_cpuidle_notifier_call(struct notifier_block *nfb,
+					  unsigned long action, void *hcpu)
+{
+	unsigned int cpu = (long)hcpu;
+
+	switch (action) {
+	case CPU_ONLINE:
+	case CPU_STARTING:
+	case CPU_STARTING_FROZEN:
+		/* For this particular CPU register CPUIdle boot vector */
+		shmobile_smp_hook(cpu, virt_to_phys(cpu_resume), 0);
+		break;
+	};
+
+	return NOTIFY_OK;
+}
+
+static struct notifier_block shmobile_cpuidle_notifier = {
+	.notifier_call = shmobile_cpuidle_notifier_call,
+};
+
 static struct cpuidle_driver shmobile_cpuidle_default_driver = {
 	.name			= "shmobile_cpuidle",
 	.owner			= THIS_MODULE,
@@ -51,6 +72,9 @@ int __init shmobile_cpuidle_init(void)
 	}

 #ifdef CONFIG_ARCH_SHMOBILE_MULTI
+	/* Use CPU notifier for reset vector control */
+	register_cpu_notifier(&shmobile_cpuidle_notifier);
+
 	platform_device_register(&shmobile_cpuidle);
 	return 0;
 #else
-- 
1.7.9.5

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

* Re: [PATCH 5/6] ARM: shmobile: Add CPU notifier for CPUIdle boot vector
  2014-08-01  9:48 [PATCH 5/6] ARM: shmobile: Add CPU notifier for CPUIdle boot vector keita kobayashi
@ 2014-08-22 10:48 ` Magnus Damm
  0 siblings, 0 replies; 2+ messages in thread
From: Magnus Damm @ 2014-08-22 10:48 UTC (permalink / raw)
  To: keita kobayashi; +Cc: SH-Linux, Linux PM list, Simon Horman, Rafael J. Wysocki

Hi Kobayashi-san,

Thanks for your patches. About the use of CPU notifiers, please see my
question below:

On Fri, Aug 1, 2014 at 6:48 PM, keita kobayashi
<keita.kobayashi.ym@renesas.com> wrote:
> Add CPU notifiers for the shared mach-shmobile cpuidle code.
>
> Signed-off-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
> ---
>  arch/arm/mach-shmobile/cpuidle.c |   24 ++++++++++++++++++++++++
>  1 file changed, 24 insertions(+)
>
> diff --git a/arch/arm/mach-shmobile/cpuidle.c b/arch/arm/mach-shmobile/cpuidle.c
> index 19c0c98..1771dd3 100644
> --- a/arch/arm/mach-shmobile/cpuidle.c
> +++ b/arch/arm/mach-shmobile/cpuidle.c
> @@ -20,6 +20,27 @@
>  #include <asm/io.h>
>  #include "common.h"
>
> +static int shmobile_cpuidle_notifier_call(struct notifier_block *nfb,
> +                                         unsigned long action, void *hcpu)
> +{
> +       unsigned int cpu = (long)hcpu;
> +
> +       switch (action) {
> +       case CPU_ONLINE:
> +       case CPU_STARTING:
> +       case CPU_STARTING_FROZEN:
> +               /* For this particular CPU register CPUIdle boot vector */
> +               shmobile_smp_hook(cpu, virt_to_phys(cpu_resume), 0);
> +               break;
> +       };
> +
> +       return NOTIFY_OK;
> +}

In my earlier CPUIdle and reset vector sharing experiments it seemed
enough to install the reset vector with CPU notifier using CPU_ONLINE.

Can you please explain the reason why you also include CPU_STARTING
and CPU_STARTING_FROZEN above?

Thanks,

/ magnus

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

end of thread, other threads:[~2014-08-22 10:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-01  9:48 [PATCH 5/6] ARM: shmobile: Add CPU notifier for CPUIdle boot vector keita kobayashi
2014-08-22 10:48 ` Magnus Damm

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