Merge tag 'trace-3.11-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt...
[deliverable/linux.git] / arch / arm / kernel / psci_smp.c
CommitLineData
05774088
SS
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License version 2 as
4 * published by the Free Software Foundation.
5 *
6 * This program is distributed in the hope that it will be useful,
7 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 * GNU General Public License for more details.
10 *
11 * Copyright (C) 2012 ARM Limited
12 *
13 * Author: Will Deacon <will.deacon@arm.com>
14 */
15
16#include <linux/init.h>
17#include <linux/irqchip/arm-gic.h>
18#include <linux/smp.h>
19#include <linux/of.h>
20
21#include <asm/psci.h>
22#include <asm/smp_plat.h>
23
24/*
25 * psci_smp assumes that the following is true about PSCI:
26 *
27 * cpu_suspend Suspend the execution on a CPU
28 * @state we don't currently describe affinity levels, so just pass 0.
29 * @entry_point the first instruction to be executed on return
30 * returns 0 success, < 0 on failure
31 *
32 * cpu_off Power down a CPU
33 * @state we don't currently describe affinity levels, so just pass 0.
34 * no return on successful call
35 *
36 * cpu_on Power up a CPU
37 * @cpuid cpuid of target CPU, as from MPIDR
38 * @entry_point the first instruction to be executed on return
39 * returns 0 success, < 0 on failure
40 *
41 * migrate Migrate the context to a different CPU
42 * @cpuid cpuid of target CPU, as from MPIDR
43 * returns 0 success, < 0 on failure
44 *
45 */
46
47extern void secondary_startup(void);
48
8bd26e3a 49static int psci_boot_secondary(unsigned int cpu, struct task_struct *idle)
05774088
SS
50{
51 if (psci_ops.cpu_on)
52 return psci_ops.cpu_on(cpu_logical_map(cpu),
53 __pa(secondary_startup));
54 return -ENODEV;
55}
56
57#ifdef CONFIG_HOTPLUG_CPU
58void __ref psci_cpu_die(unsigned int cpu)
59{
60 const struct psci_power_state ps = {
61 .type = PSCI_POWER_STATE_TYPE_POWER_DOWN,
62 };
63
64 if (psci_ops.cpu_off)
65 psci_ops.cpu_off(ps);
66
67 /* We should never return */
68 panic("psci: cpu %d failed to shutdown\n", cpu);
69}
05774088
SS
70#endif
71
72bool __init psci_smp_available(void)
73{
74 /* is cpu_on available at least? */
75 return (psci_ops.cpu_on != NULL);
76}
77
78struct smp_operations __initdata psci_smp_ops = {
79 .smp_boot_secondary = psci_boot_secondary,
fdeb94b5 80#ifdef CONFIG_HOTPLUG_CPU
05774088 81 .cpu_die = psci_cpu_die,
fdeb94b5 82#endif
05774088 83};
This page took 0.034091 seconds and 5 git commands to generate.