diff options
| author | Olof Johansson <olof@lixom.net> | 2012-09-22 03:06:21 -0400 |
|---|---|---|
| committer | Olof Johansson <olof@lixom.net> | 2012-09-22 03:16:04 -0400 |
| commit | 25468fe89f88c4ceeef94526e94ae0db176f6999 (patch) | |
| tree | d70a713525281276b5063c814413bb3141e6056c /arch/arm/kernel | |
| parent | a283580c52d3aa24305985e945dfccfbcfc6f4f9 (diff) | |
| parent | 28e8e29c616f947348cc66bea684d0035c76021a (diff) | |
Merge branch 'multiplatform/smp_ops' into next/multiplatform
* multiplatform/smp_ops:
ARM: consolidate pen_release instead of having per platform definitions
ARM: smp: Make SMP operations mandatory
ARM: SoC: convert spear13xx to SMP operations
ARM: SoC: convert imx6q to SMP operations
ARM: SoC: convert highbank to SMP operations
ARM: SoC: convert shmobile SMP to SMP operations
ARM: SoC: convert ux500 to SMP operations
ARM: SoC: convert MSM to SMP operations
ARM: SoC: convert Exynos4 to SMP operations
ARM: SoC: convert Tegra to SMP operations
ARM: SoC: convert OMAP4 to SMP operations
ARM: SoC: convert VExpress/RealView to SMP operations
ARM: SoC: add per-platform SMP operations
Conflicts due to file moves or removals in:
arch/arm/mach-msm/board-msm8960.c
arch/arm/mach-msm/board-msm8x60.c
arch/arm/mach-tegra/board-harmony.c
arch/arm/mach-tegra/board-trimslice.c
Conflicts due to board file cleanup:
arch/arm/mach-tegra/board-paz00.c
Conflicts due to cpu hotplug addition:
arch/arm/mach-tegra/hotplug.c
Signed-off-by: Olof Johansson <olof@lixom.net>
Diffstat (limited to 'arch/arm/kernel')
| -rw-r--r-- | arch/arm/kernel/setup.c | 4 | ||||
| -rw-r--r-- | arch/arm/kernel/smp.c | 72 |
2 files changed, 72 insertions, 4 deletions
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c index a81dcecc7343..725f9f2a9541 100644 --- a/arch/arm/kernel/setup.c +++ b/arch/arm/kernel/setup.c | |||
| @@ -977,8 +977,10 @@ void __init setup_arch(char **cmdline_p) | |||
| 977 | unflatten_device_tree(); | 977 | unflatten_device_tree(); |
| 978 | 978 | ||
| 979 | #ifdef CONFIG_SMP | 979 | #ifdef CONFIG_SMP |
| 980 | if (is_smp()) | 980 | if (is_smp()) { |
| 981 | smp_set_ops(mdesc->smp); | ||
| 981 | smp_init_cpus(); | 982 | smp_init_cpus(); |
| 983 | } | ||
| 982 | #endif | 984 | #endif |
| 983 | reserve_crashkernel(); | 985 | reserve_crashkernel(); |
| 984 | 986 | ||
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c index ebd8ad274d76..aa4ffe6e5ecf 100644 --- a/arch/arm/kernel/smp.c +++ b/arch/arm/kernel/smp.c | |||
| @@ -19,7 +19,6 @@ | |||
| 19 | #include <linux/mm.h> | 19 | #include <linux/mm.h> |
| 20 | #include <linux/err.h> | 20 | #include <linux/err.h> |
| 21 | #include <linux/cpu.h> | 21 | #include <linux/cpu.h> |
| 22 | #include <linux/smp.h> | ||
| 23 | #include <linux/seq_file.h> | 22 | #include <linux/seq_file.h> |
| 24 | #include <linux/irq.h> | 23 | #include <linux/irq.h> |
| 25 | #include <linux/percpu.h> | 24 | #include <linux/percpu.h> |
| @@ -27,6 +26,7 @@ | |||
| 27 | #include <linux/completion.h> | 26 | #include <linux/completion.h> |
| 28 | 27 | ||
| 29 | #include <linux/atomic.h> | 28 | #include <linux/atomic.h> |
| 29 | #include <asm/smp.h> | ||
| 30 | #include <asm/cacheflush.h> | 30 | #include <asm/cacheflush.h> |
| 31 | #include <asm/cpu.h> | 31 | #include <asm/cpu.h> |
| 32 | #include <asm/cputype.h> | 32 | #include <asm/cputype.h> |
| @@ -42,6 +42,7 @@ | |||
| 42 | #include <asm/ptrace.h> | 42 | #include <asm/ptrace.h> |
| 43 | #include <asm/localtimer.h> | 43 | #include <asm/localtimer.h> |
| 44 | #include <asm/smp_plat.h> | 44 | #include <asm/smp_plat.h> |
| 45 | #include <asm/mach/arch.h> | ||
| 45 | 46 | ||
| 46 | /* | 47 | /* |
| 47 | * as from 2.5, kernels no longer have an init_tasks structure | 48 | * as from 2.5, kernels no longer have an init_tasks structure |
| @@ -50,6 +51,12 @@ | |||
| 50 | */ | 51 | */ |
| 51 | struct secondary_data secondary_data; | 52 | struct secondary_data secondary_data; |
| 52 | 53 | ||
| 54 | /* | ||
| 55 | * control for which core is the next to come out of the secondary | ||
| 56 | * boot "holding pen" | ||
| 57 | */ | ||
| 58 | volatile int __cpuinitdata pen_release = -1; | ||
| 59 | |||
| 53 | enum ipi_msg_type { | 60 | enum ipi_msg_type { |
| 54 | IPI_TIMER = 2, | 61 | IPI_TIMER = 2, |
| 55 | IPI_RESCHEDULE, | 62 | IPI_RESCHEDULE, |
| @@ -60,6 +67,14 @@ enum ipi_msg_type { | |||
| 60 | 67 | ||
| 61 | static DECLARE_COMPLETION(cpu_running); | 68 | static DECLARE_COMPLETION(cpu_running); |
| 62 | 69 | ||
| 70 | static struct smp_operations smp_ops; | ||
| 71 | |||
| 72 | void __init smp_set_ops(struct smp_operations *ops) | ||
| 73 | { | ||
| 74 | if (ops) | ||
| 75 | smp_ops = *ops; | ||
| 76 | }; | ||
| 77 | |||
| 63 | int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *idle) | 78 | int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *idle) |
| 64 | { | 79 | { |
| 65 | int ret; | 80 | int ret; |
| @@ -100,13 +115,64 @@ int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *idle) | |||
| 100 | return ret; | 115 | return ret; |
| 101 | } | 116 | } |
| 102 | 117 | ||
| 118 | /* platform specific SMP operations */ | ||
| 119 | void __init smp_init_cpus(void) | ||
| 120 | { | ||
| 121 | if (smp_ops.smp_init_cpus) | ||
| 122 | smp_ops.smp_init_cpus(); | ||
| 123 | } | ||
| 124 | |||
| 125 | static void __init platform_smp_prepare_cpus(unsigned int max_cpus) | ||
| 126 | { | ||
| 127 | if (smp_ops.smp_prepare_cpus) | ||
| 128 | smp_ops.smp_prepare_cpus(max_cpus); | ||
| 129 | } | ||
| 130 | |||
| 131 | static void __cpuinit platform_secondary_init(unsigned int cpu) | ||
| 132 | { | ||
| 133 | if (smp_ops.smp_secondary_init) | ||
| 134 | smp_ops.smp_secondary_init(cpu); | ||
| 135 | } | ||
| 136 | |||
| 137 | int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle) | ||
| 138 | { | ||
| 139 | if (smp_ops.smp_boot_secondary) | ||
| 140 | return smp_ops.smp_boot_secondary(cpu, idle); | ||
| 141 | return -ENOSYS; | ||
| 142 | } | ||
| 143 | |||
| 103 | #ifdef CONFIG_HOTPLUG_CPU | 144 | #ifdef CONFIG_HOTPLUG_CPU |
| 104 | static void percpu_timer_stop(void); | 145 | static void percpu_timer_stop(void); |
| 105 | 146 | ||
| 147 | static int platform_cpu_kill(unsigned int cpu) | ||
| 148 | { | ||
| 149 | if (smp_ops.cpu_kill) | ||
| 150 | return smp_ops.cpu_kill(cpu); | ||
| 151 | return 1; | ||
| 152 | } | ||
| 153 | |||
| 154 | static void platform_cpu_die(unsigned int cpu) | ||
| 155 | { | ||
| 156 | if (smp_ops.cpu_die) | ||
| 157 | smp_ops.cpu_die(cpu); | ||
| 158 | } | ||
| 159 | |||
| 160 | static int platform_cpu_disable(unsigned int cpu) | ||
| 161 | { | ||
| 162 | if (smp_ops.cpu_disable) | ||
| 163 | return smp_ops.cpu_disable(cpu); | ||
| 164 | |||
| 165 | /* | ||
| 166 | * By default, allow disabling all CPUs except the first one, | ||
| 167 | * since this is special on a lot of platforms, e.g. because | ||
| 168 | * of clock tick interrupts. | ||
| 169 | */ | ||
| 170 | return cpu == 0 ? -EPERM : 0; | ||
| 171 | } | ||
| 106 | /* | 172 | /* |
| 107 | * __cpu_disable runs on the processor to be shutdown. | 173 | * __cpu_disable runs on the processor to be shutdown. |
| 108 | */ | 174 | */ |
| 109 | int __cpu_disable(void) | 175 | int __cpuinit __cpu_disable(void) |
| 110 | { | 176 | { |
| 111 | unsigned int cpu = smp_processor_id(); | 177 | unsigned int cpu = smp_processor_id(); |
| 112 | int ret; | 178 | int ret; |
| @@ -149,7 +215,7 @@ static DECLARE_COMPLETION(cpu_died); | |||
| 149 | * called on the thread which is asking for a CPU to be shutdown - | 215 | * called on the thread which is asking for a CPU to be shutdown - |
| 150 | * waits until shutdown has completed, or it is timed out. | 216 | * waits until shutdown has completed, or it is timed out. |
| 151 | */ | 217 | */ |
| 152 | void __cpu_die(unsigned int cpu) | 218 | void __cpuinit __cpu_die(unsigned int cpu) |
| 153 | { | 219 | { |
| 154 | if (!wait_for_completion_timeout(&cpu_died, msecs_to_jiffies(5000))) { | 220 | if (!wait_for_completion_timeout(&cpu_died, msecs_to_jiffies(5000))) { |
| 155 | pr_err("CPU%u: cpu didn't die\n", cpu); | 221 | pr_err("CPU%u: cpu didn't die\n", cpu); |
