Skip to contentSkip to conversation

ARM: shmobile: Add CPU notifier for CPUIdle boot vector

PATCH In review keita kobayashi 2 participants 2 messages Aug 1, 2014 – Aug 22, 2014

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

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

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

---
 arch/arm/mach-shmobile/cpuidle.c |   24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
arch/arm/mach-shmobile/cpuidle.c +24 -0
index 19c0c98..1771dd3 100644
@@ -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
Signature · 1 line
1.7.9.5
maintainer
#1 lore raw

Hi Kobayashi-san,

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

Quoted 21 lines · keita kobayashi

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

---
 arch/arm/mach-shmobile/cpuidle.c |   24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
arch/arm/mach-shmobile/cpuidle.c +6 -0
index 19c0c98..1771dd3 100644
@@ -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) {

arch/arm/mach-shmobile/cpuidle.c line 38

Quoted 10 lines
arch/arm/mach-shmobile/cpuidle.c +10 -0
+       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