diff options
author | Mark Rutland <mark.rutland@arm.com> | 2013-10-24 15:30:19 -0400 |
---|---|---|
committer | Catalin Marinas <catalin.marinas@arm.com> | 2013-10-25 06:33:21 -0400 |
commit | 831ccf79b46e02f31cfd16c66df9d5600f635155 (patch) | |
tree | 08f653a531e0a81569176f9ed365171dd6cebde9 /arch/arm64 | |
parent | 9327e2c6bb8cb0131b38a07847cd58c78dc095e9 (diff) |
arm64: add PSCI CPU_OFF-based hotplug support
This patch adds support for using PSCI CPU_OFF calls for CPU hotplug.
With this code it is possible to hot unplug CPUs with "psci" as their
boot-method, as long as there's an appropriate cpu_off function id
specified in the psci node.
Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Diffstat (limited to 'arch/arm64')
-rw-r--r-- | arch/arm64/kernel/psci.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/arch/arm64/kernel/psci.c b/arch/arm64/kernel/psci.c index fb56b6158344..4f97db3d7363 100644 --- a/arch/arm64/kernel/psci.c +++ b/arch/arm64/kernel/psci.c | |||
@@ -256,11 +256,41 @@ static int cpu_psci_cpu_boot(unsigned int cpu) | |||
256 | return err; | 256 | return err; |
257 | } | 257 | } |
258 | 258 | ||
259 | #ifdef CONFIG_HOTPLUG_CPU | ||
260 | static int cpu_psci_cpu_disable(unsigned int cpu) | ||
261 | { | ||
262 | /* Fail early if we don't have CPU_OFF support */ | ||
263 | if (!psci_ops.cpu_off) | ||
264 | return -EOPNOTSUPP; | ||
265 | return 0; | ||
266 | } | ||
267 | |||
268 | static void cpu_psci_cpu_die(unsigned int cpu) | ||
269 | { | ||
270 | int ret; | ||
271 | /* | ||
272 | * There are no known implementations of PSCI actually using the | ||
273 | * power state field, pass a sensible default for now. | ||
274 | */ | ||
275 | struct psci_power_state state = { | ||
276 | .type = PSCI_POWER_STATE_TYPE_POWER_DOWN, | ||
277 | }; | ||
278 | |||
279 | ret = psci_ops.cpu_off(state); | ||
280 | |||
281 | pr_crit("psci: unable to power off CPU%u (%d)\n", cpu, ret); | ||
282 | } | ||
283 | #endif | ||
284 | |||
259 | const struct cpu_operations cpu_psci_ops = { | 285 | const struct cpu_operations cpu_psci_ops = { |
260 | .name = "psci", | 286 | .name = "psci", |
261 | .cpu_init = cpu_psci_cpu_init, | 287 | .cpu_init = cpu_psci_cpu_init, |
262 | .cpu_prepare = cpu_psci_cpu_prepare, | 288 | .cpu_prepare = cpu_psci_cpu_prepare, |
263 | .cpu_boot = cpu_psci_cpu_boot, | 289 | .cpu_boot = cpu_psci_cpu_boot, |
290 | #ifdef CONFIG_HOTPLUG_CPU | ||
291 | .cpu_disable = cpu_psci_cpu_disable, | ||
292 | .cpu_die = cpu_psci_cpu_die, | ||
293 | #endif | ||
264 | }; | 294 | }; |
265 | 295 | ||
266 | #endif | 296 | #endif |