From: nicolas.pitre@linaro.org (Nicolas Pitre)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v4 06/15] ARM: mcpm: generic SMP secondary bringup and hotplug support
Date: Tue, 05 Feb 2013 00:22:03 -0500 [thread overview]
Message-ID: <1360041732-17936-7-git-send-email-nicolas.pitre@linaro.org> (raw)
In-Reply-To: <1360041732-17936-1-git-send-email-nicolas.pitre@linaro.org>
Now that the cluster power API is in place, we can use it for SMP secondary
bringup and CPU hotplug in a generic fashion.
Signed-off-by: Nicolas Pitre <nico@linaro.org>
Reviewed-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Reviewed-by: Will Deacon <will.deacon@arm.com>
---
arch/arm/common/Makefile | 2 +-
arch/arm/common/mcpm_platsmp.c | 86 ++++++++++++++++++++++++++++++++++++++++++
2 files changed, 87 insertions(+), 1 deletion(-)
create mode 100644 arch/arm/common/mcpm_platsmp.c
diff --git a/arch/arm/common/Makefile b/arch/arm/common/Makefile
index c901a38c59..e1c9db45de 100644
--- a/arch/arm/common/Makefile
+++ b/arch/arm/common/Makefile
@@ -13,4 +13,4 @@ obj-$(CONFIG_SHARP_PARAM) += sharpsl_param.o
obj-$(CONFIG_SHARP_SCOOP) += scoop.o
obj-$(CONFIG_PCI_HOST_ITE8152) += it8152.o
obj-$(CONFIG_ARM_TIMER_SP804) += timer-sp.o
-obj-$(CONFIG_CLUSTER_PM) += mcpm_head.o mcpm_entry.o vlock.o
+obj-$(CONFIG_CLUSTER_PM) += mcpm_head.o mcpm_entry.o mcpm_platsmp.o vlock.o
diff --git a/arch/arm/common/mcpm_platsmp.c b/arch/arm/common/mcpm_platsmp.c
new file mode 100644
index 0000000000..e81e73d0f8
--- /dev/null
+++ b/arch/arm/common/mcpm_platsmp.c
@@ -0,0 +1,86 @@
+/*
+ * linux/arch/arm/mach-vexpress/mcpm_platsmp.c
+ *
+ * Created by: Nicolas Pitre, November 2012
+ * Copyright: (C) 2012-2013 Linaro Limited
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * Code to handle secondary CPU bringup and hotplug for the cluster power API.
+ */
+
+#include <linux/init.h>
+#include <linux/smp.h>
+
+#include <asm/mcpm_entry.h>
+#include <asm/smp.h>
+#include <asm/smp_plat.h>
+#include <asm/hardware/gic.h>
+
+static void __init simple_smp_init_cpus(void)
+{
+ set_smp_cross_call(gic_raise_softirq);
+}
+
+static int __cpuinit mcpm_boot_secondary(unsigned int cpu, struct task_struct *idle)
+{
+ unsigned int mpidr, pcpu, pcluster, ret;
+ extern void secondary_startup(void);
+
+ mpidr = cpu_logical_map(cpu);
+ pcpu = MPIDR_AFFINITY_LEVEL(mpidr, 0);
+ pcluster = MPIDR_AFFINITY_LEVEL(mpidr, 1);
+ pr_debug("%s: logical CPU %d is physical CPU %d cluster %d\n",
+ __func__, cpu, pcpu, pcluster);
+
+ mcpm_set_entry_vector(pcpu, pcluster, NULL);
+ ret = mcpm_cpu_power_up(pcpu, pcluster);
+ if (ret)
+ return ret;
+ mcpm_set_entry_vector(pcpu, pcluster, secondary_startup);
+ arch_send_wakeup_ipi_mask(cpumask_of(cpu));
+ dsb_sev();
+ return 0;
+}
+
+static void __cpuinit mcpm_secondary_init(unsigned int cpu)
+{
+ mcpm_cpu_powered_up();
+ gic_secondary_init(0);
+}
+
+#ifdef CONFIG_HOTPLUG_CPU
+
+static int mcpm_cpu_disable(unsigned int cpu)
+{
+ /*
+ * We assume all CPUs may be shut down.
+ * This would be the hook to use for eventual Secure
+ * OS migration requests as described in the PSCI spec.
+ */
+ return 0;
+}
+
+static void mcpm_cpu_die(unsigned int cpu)
+{
+ unsigned int mpidr, pcpu, pcluster;
+ mpidr = read_cpuid_mpidr();
+ pcpu = MPIDR_AFFINITY_LEVEL(mpidr, 0);
+ pcluster = MPIDR_AFFINITY_LEVEL(mpidr, 1);
+ mcpm_set_entry_vector(pcpu, pcluster, NULL);
+ mcpm_cpu_power_down();
+}
+
+#endif
+
+struct smp_operations __initdata mcpm_smp_ops = {
+ .smp_init_cpus = simple_smp_init_cpus,
+ .smp_boot_secondary = mcpm_boot_secondary,
+ .smp_secondary_init = mcpm_secondary_init,
+#ifdef CONFIG_HOTPLUG_CPU
+ .cpu_disable = mcpm_cpu_disable,
+ .cpu_die = mcpm_cpu_die,
+#endif
+};
--
1.8.1.2
next prev parent reply other threads:[~2013-02-05 5:22 UTC|newest]
Thread overview: 55+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-05 5:21 [PATCH v4 00/15] multi-cluster power management Nicolas Pitre
2013-02-05 5:21 ` [PATCH v4 01/15] ARM: multi-cluster PM: secondary kernel entry code Nicolas Pitre
2013-04-23 19:19 ` Russell King - ARM Linux
2013-04-23 19:34 ` Nicolas Pitre
2013-04-23 20:09 ` Russell King - ARM Linux
2013-04-23 20:19 ` Nicolas Pitre
2013-02-05 5:21 ` [PATCH v4 02/15] ARM: mcpm: introduce the CPU/cluster power API Nicolas Pitre
2013-02-05 5:22 ` [PATCH v4 03/15] ARM: mcpm: introduce helpers for platform coherency exit/setup Nicolas Pitre
2013-04-05 23:00 ` Olof Johansson
2013-04-06 13:41 ` Nicolas Pitre
2013-04-24 9:10 ` Dave Martin
2013-02-05 5:22 ` [PATCH v4 04/15] ARM: mcpm: Add baremetal voting mutexes Nicolas Pitre
2013-02-05 5:22 ` [PATCH v4 05/15] ARM: mcpm_head.S: vlock-based first man election Nicolas Pitre
2013-02-05 5:22 ` Nicolas Pitre [this message]
2013-04-23 19:31 ` [PATCH v4 06/15] ARM: mcpm: generic SMP secondary bringup and hotplug support Russell King - ARM Linux
2013-04-23 19:36 ` Nicolas Pitre
2013-02-05 5:22 ` [PATCH v4 07/15] ARM: introduce common set_auxcr/get_auxcr functions Nicolas Pitre
2013-02-05 5:22 ` [PATCH v4 08/15] ARM: vexpress: introduce DCSCB support Nicolas Pitre
2013-02-07 18:14 ` Catalin Marinas
2013-02-07 18:56 ` Nicolas Pitre
2013-02-05 5:22 ` [PATCH v4 09/15] ARM: vexpress/dcscb: add CPU use counts to the power up/down API implementation Nicolas Pitre
2013-02-05 5:22 ` [PATCH v4 10/15] ARM: vexpress/dcscb: do not hardcode number of CPUs per cluster Nicolas Pitre
2013-02-05 5:22 ` [PATCH v4 11/15] drivers/bus: add ARM CCI support Nicolas Pitre
2013-04-23 19:38 ` Russell King - ARM Linux
2013-04-23 19:53 ` Nicolas Pitre
2013-02-05 5:22 ` [PATCH v4 12/15] ARM: CCI: ensure powerdown-time data is flushed from cache Nicolas Pitre
2013-04-23 19:40 ` Russell King - ARM Linux
2013-02-05 5:22 ` [PATCH v4 13/15] ARM: vexpress/dcscb: handle platform coherency exit/setup and CCI Nicolas Pitre
2013-02-05 5:22 ` [PATCH v4 14/15] ARM: Enable selection of SMP operations at boot time Nicolas Pitre
2013-04-05 22:43 ` Olof Johansson
2013-04-06 13:43 ` Nicolas Pitre
2013-04-09 16:30 ` Nicolas Pitre
2013-04-09 16:55 ` Jon Medhurst (Tixy)
2013-02-05 5:22 ` [PATCH v4 15/15] ARM: vexpress: Select multi-cluster SMP operation if required Nicolas Pitre
2013-02-06 16:38 ` Pawel Moll
2013-02-06 17:55 ` Nicolas Pitre
2013-04-05 22:48 ` Olof Johansson
2013-04-06 14:02 ` Nicolas Pitre
2013-04-08 9:10 ` Jon Medhurst (Tixy)
2013-04-09 5:41 ` Nicolas Pitre
2013-04-09 6:00 ` Jon Medhurst (Tixy)
2013-04-09 16:34 ` Nicolas Pitre
2013-04-09 17:28 ` Jon Medhurst (Tixy)
2013-04-23 19:42 ` Russell King - ARM Linux
2013-04-23 19:56 ` Nicolas Pitre
2013-04-23 20:04 ` [PATCH v4 00/15] multi-cluster power management Russell King - ARM Linux
2013-04-23 21:03 ` Nicolas Pitre
2013-04-23 21:46 ` Russell King - ARM Linux
2013-04-23 21:56 ` Nicolas Pitre
2013-04-23 22:44 ` Russell King - ARM Linux
2013-04-24 4:11 ` Nicolas Pitre
2013-04-24 20:25 ` Russell King - ARM Linux
2013-04-24 23:31 ` Nicolas Pitre
2013-04-24 14:25 ` Dave Martin
2013-04-23 21:11 ` Nicolas Pitre
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1360041732-17936-7-git-send-email-nicolas.pitre@linaro.org \
--to=nicolas.pitre@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).