diff mbox

[5/6] ARM: shmobile: Add CPU notifier for CPUIdle boot vector

Message ID 53DB6284.3090506@renesas.com (mailing list archive)
State Deferred
Headers show

Commit Message

keita kobayashi Aug. 1, 2014, 9:48 a.m. UTC
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(+)

Comments

Magnus Damm Aug. 22, 2014, 10:48 a.m. UTC | #1
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
--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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