Commit 0f7b332f9777819a39a3b325690379a7efef89d1
1 parent
43b3e18982
Exists in
master
and in
39 other branches
ARM: consolidate SMP cross call implementation
Rather than having each platform class provide a mach/smp.h header for smp_cross_call(), arrange for them to register the function with the core ARM SMP code instead. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Showing 19 changed files with 37 additions and 162 deletions Side-by-side Diff
- arch/arm/include/asm/smp.h
- arch/arm/kernel/smp.c
- arch/arm/mach-exynos4/include/mach/smp.h
- arch/arm/mach-exynos4/platsmp.c
- arch/arm/mach-msm/include/mach/smp.h
- arch/arm/mach-msm/platsmp.c
- arch/arm/mach-omap2/omap-smp.c
- arch/arm/mach-realview/include/mach/smp.h
- arch/arm/mach-realview/platsmp.c
- arch/arm/mach-shmobile/include/mach/smp.h
- arch/arm/mach-shmobile/platsmp.c
- arch/arm/mach-tegra/include/mach/smp.h
- arch/arm/mach-tegra/platsmp.c
- arch/arm/mach-ux500/include/mach/smp.h
- arch/arm/mach-ux500/platsmp.c
- arch/arm/mach-vexpress/ct-ca9x4.c
- arch/arm/mach-vexpress/include/mach/smp.h
- arch/arm/plat-omap/include/plat/smp.h
- arch/arm/plat-versatile/platsmp.c
arch/arm/include/asm/smp.h
... | ... | @@ -14,8 +14,6 @@ |
14 | 14 | #include <linux/cpumask.h> |
15 | 15 | #include <linux/thread_info.h> |
16 | 16 | |
17 | -#include <mach/smp.h> | |
18 | - | |
19 | 17 | #ifndef CONFIG_SMP |
20 | 18 | # error "<asm/smp.h> included in non-SMP build" |
21 | 19 | #endif |
22 | 20 | |
... | ... | @@ -47,9 +45,9 @@ |
47 | 45 | |
48 | 46 | |
49 | 47 | /* |
50 | - * Raise an IPI cross call on CPUs in callmap. | |
48 | + * Provide a function to raise an IPI cross call on CPUs in callmap. | |
51 | 49 | */ |
52 | -extern void smp_cross_call(const struct cpumask *mask, int ipi); | |
50 | +extern void set_smp_cross_call(void (*)(const struct cpumask *, unsigned int)); | |
53 | 51 | |
54 | 52 | /* |
55 | 53 | * Boot a secondary CPU, and assign it the specified idle task. |
arch/arm/kernel/smp.c
... | ... | @@ -376,6 +376,13 @@ |
376 | 376 | } |
377 | 377 | } |
378 | 378 | |
379 | +static void (*smp_cross_call)(const struct cpumask *, unsigned int); | |
380 | + | |
381 | +void __init set_smp_cross_call(void (*fn)(const struct cpumask *, unsigned int)) | |
382 | +{ | |
383 | + smp_cross_call = fn; | |
384 | +} | |
385 | + | |
379 | 386 | void arch_send_call_function_ipi_mask(const struct cpumask *mask) |
380 | 387 | { |
381 | 388 | smp_cross_call(mask, IPI_CALL_FUNC); |
arch/arm/mach-exynos4/include/mach/smp.h
1 | -/* linux/arch/arm/mach-exynos4/include/mach/smp.h | |
2 | - * | |
3 | - * Cloned from arch/arm/mach-realview/include/mach/smp.h | |
4 | -*/ | |
5 | - | |
6 | -#ifndef ASM_ARCH_SMP_H | |
7 | -#define ASM_ARCH_SMP_H __FILE__ | |
8 | - | |
9 | -#include <asm/hardware/gic.h> | |
10 | - | |
11 | -/* | |
12 | - * We use IRQ1 as the IPI | |
13 | - */ | |
14 | -static inline void smp_cross_call(const struct cpumask *mask, int ipi) | |
15 | -{ | |
16 | - gic_raise_softirq(mask, ipi); | |
17 | -} | |
18 | - | |
19 | -#endif |
arch/arm/mach-exynos4/platsmp.c
... | ... | @@ -22,6 +22,7 @@ |
22 | 22 | #include <linux/io.h> |
23 | 23 | |
24 | 24 | #include <asm/cacheflush.h> |
25 | +#include <asm/hardware/gic.h> | |
25 | 26 | #include <asm/smp_scu.h> |
26 | 27 | #include <asm/unified.h> |
27 | 28 | |
... | ... | @@ -104,7 +105,7 @@ |
104 | 105 | * the boot monitor to read the system wide flags register, |
105 | 106 | * and branch to the address found there. |
106 | 107 | */ |
107 | - smp_cross_call(cpumask_of(cpu), 1); | |
108 | + gic_raise_softirq(cpumask_of(cpu), 1); | |
108 | 109 | |
109 | 110 | timeout = jiffies + (1 * HZ); |
110 | 111 | while (time_before(jiffies, timeout)) { |
... | ... | @@ -147,6 +148,8 @@ |
147 | 148 | |
148 | 149 | for (i = 0; i < ncores; i++) |
149 | 150 | set_cpu_possible(i, true); |
151 | + | |
152 | + set_smp_cross_call(gic_raise_softirq); | |
150 | 153 | } |
151 | 154 | |
152 | 155 | void __init platform_smp_prepare_cpus(unsigned int max_cpus) |
arch/arm/mach-msm/include/mach/smp.h
1 | -/* Copyright (c) 2010, Code Aurora Forum. All rights reserved. | |
2 | - * | |
3 | - * This program is free software; you can redistribute it and/or modify | |
4 | - * it under the terms of the GNU General Public License version 2 and | |
5 | - * only version 2 as published by the Free Software Foundation. | |
6 | - * | |
7 | - * This program is distributed in the hope that it will be useful, | |
8 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
9 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
10 | - * GNU General Public License for more details. | |
11 | - */ | |
12 | - | |
13 | -#ifndef __ASM_ARCH_MSM_SMP_H | |
14 | -#define __ASM_ARCH_MSM_SMP_H | |
15 | - | |
16 | -#include <asm/hardware/gic.h> | |
17 | - | |
18 | -static inline void smp_cross_call(const struct cpumask *mask, int ipi) | |
19 | -{ | |
20 | - gic_raise_softirq(mask, ipi); | |
21 | -} | |
22 | - | |
23 | -#endif |
arch/arm/mach-msm/platsmp.c
... | ... | @@ -119,7 +119,7 @@ |
119 | 119 | * the boot monitor to read the system wide flags register, |
120 | 120 | * and branch to the address found there. |
121 | 121 | */ |
122 | - smp_cross_call(cpumask_of(cpu), 1); | |
122 | + gic_raise_softirq(cpumask_of(cpu), 1); | |
123 | 123 | |
124 | 124 | timeout = jiffies + (1 * HZ); |
125 | 125 | while (time_before(jiffies, timeout)) { |
... | ... | @@ -151,6 +151,8 @@ |
151 | 151 | |
152 | 152 | for (i = 0; i < NR_CPUS; i++) |
153 | 153 | set_cpu_possible(i, true); |
154 | + | |
155 | + set_smp_cross_call(gic_raise_softirq); | |
154 | 156 | } |
155 | 157 | |
156 | 158 | void __init platform_smp_prepare_cpus(unsigned int max_cpus) |
arch/arm/mach-omap2/omap-smp.c
... | ... | @@ -21,6 +21,7 @@ |
21 | 21 | #include <linux/io.h> |
22 | 22 | |
23 | 23 | #include <asm/cacheflush.h> |
24 | +#include <asm/hardware/gic.h> | |
24 | 25 | #include <asm/smp_scu.h> |
25 | 26 | #include <mach/hardware.h> |
26 | 27 | #include <mach/omap4-common.h> |
... | ... | @@ -63,7 +64,7 @@ |
63 | 64 | omap_modify_auxcoreboot0(0x200, 0xfffffdff); |
64 | 65 | flush_cache_all(); |
65 | 66 | smp_wmb(); |
66 | - smp_cross_call(cpumask_of(cpu), 1); | |
67 | + gic_raise_softirq(cpumask_of(cpu), 1); | |
67 | 68 | |
68 | 69 | /* |
69 | 70 | * Now the secondary core is starting up let it run its |
... | ... | @@ -118,6 +119,8 @@ |
118 | 119 | |
119 | 120 | for (i = 0; i < ncores; i++) |
120 | 121 | set_cpu_possible(i, true); |
122 | + | |
123 | + set_smp_cross_call(gic_raise_softirq); | |
121 | 124 | } |
122 | 125 | |
123 | 126 | void __init platform_smp_prepare_cpus(unsigned int max_cpus) |
arch/arm/mach-realview/include/mach/smp.h
arch/arm/mach-realview/platsmp.c
... | ... | @@ -14,6 +14,7 @@ |
14 | 14 | #include <linux/io.h> |
15 | 15 | |
16 | 16 | #include <mach/hardware.h> |
17 | +#include <asm/hardware/gic.h> | |
17 | 18 | #include <asm/mach-types.h> |
18 | 19 | #include <asm/smp_scu.h> |
19 | 20 | #include <asm/unified.h> |
... | ... | @@ -61,6 +62,8 @@ |
61 | 62 | |
62 | 63 | for (i = 0; i < ncores; i++) |
63 | 64 | set_cpu_possible(i, true); |
65 | + | |
66 | + set_smp_cross_call(gic_raise_softirq); | |
64 | 67 | } |
65 | 68 | |
66 | 69 | void __init platform_smp_prepare_cpus(unsigned int max_cpus) |
arch/arm/mach-shmobile/include/mach/smp.h
1 | -#ifndef __MACH_SMP_H | |
2 | -#define __MACH_SMP_H | |
3 | - | |
4 | -#include <asm/hardware/gic.h> | |
5 | - | |
6 | -/* | |
7 | - * We use IRQ1 as the IPI | |
8 | - */ | |
9 | -static inline void smp_cross_call(const struct cpumask *mask, int ipi) | |
10 | -{ | |
11 | -#if defined(CONFIG_ARM_GIC) | |
12 | - gic_raise_softirq(mask, ipi); | |
13 | -#endif | |
14 | -} | |
15 | - | |
16 | -#endif |
arch/arm/mach-shmobile/platsmp.c
... | ... | @@ -16,6 +16,7 @@ |
16 | 16 | #include <linux/device.h> |
17 | 17 | #include <linux/smp.h> |
18 | 18 | #include <linux/io.h> |
19 | +#include <asm/hardware/gic.h> | |
19 | 20 | #include <asm/localtimer.h> |
20 | 21 | #include <asm/mach-types.h> |
21 | 22 | #include <mach/common.h> |
... | ... | @@ -57,6 +58,8 @@ |
57 | 58 | |
58 | 59 | for (i = 0; i < ncores; i++) |
59 | 60 | set_cpu_possible(i, true); |
61 | + | |
62 | + set_smp_cross_call(gic_raise_softirq); | |
60 | 63 | } |
61 | 64 | |
62 | 65 | void __init platform_smp_prepare_cpus(unsigned int max_cpus) |
arch/arm/mach-tegra/include/mach/smp.h
arch/arm/mach-tegra/platsmp.c
... | ... | @@ -20,6 +20,7 @@ |
20 | 20 | #include <linux/io.h> |
21 | 21 | |
22 | 22 | #include <asm/cacheflush.h> |
23 | +#include <asm/hardware/gic.h> | |
23 | 24 | #include <mach/hardware.h> |
24 | 25 | #include <asm/mach-types.h> |
25 | 26 | #include <asm/smp_scu.h> |
... | ... | @@ -122,6 +123,8 @@ |
122 | 123 | |
123 | 124 | for (i = 0; i < ncores; i++) |
124 | 125 | cpu_set(i, cpu_possible_map); |
126 | + | |
127 | + set_smp_cross_call(gic_raise_softirq); | |
125 | 128 | } |
126 | 129 | |
127 | 130 | void __init platform_smp_prepare_cpus(unsigned int max_cpus) |
arch/arm/mach-ux500/include/mach/smp.h
1 | -/* | |
2 | - * This file is based ARM realview platform. | |
3 | - * Copyright (C) ARM Limited. | |
4 | - * | |
5 | - * This file is licensed under the terms of the GNU General Public | |
6 | - * License version 2. This program is licensed "as is" without any | |
7 | - * warranty of any kind, whether express or implied. | |
8 | - */ | |
9 | -#ifndef ASMARM_ARCH_SMP_H | |
10 | -#define ASMARM_ARCH_SMP_H | |
11 | - | |
12 | -#include <asm/hardware/gic.h> | |
13 | - | |
14 | -/* This is required to wakeup the secondary core */ | |
15 | -extern void u8500_secondary_startup(void); | |
16 | - | |
17 | -/* | |
18 | - * We use IRQ1 as the IPI | |
19 | - */ | |
20 | -static inline void smp_cross_call(const struct cpumask *mask, int ipi) | |
21 | -{ | |
22 | - gic_raise_softirq(mask, ipi); | |
23 | -} | |
24 | -#endif |
arch/arm/mach-ux500/platsmp.c
... | ... | @@ -18,6 +18,7 @@ |
18 | 18 | #include <linux/io.h> |
19 | 19 | |
20 | 20 | #include <asm/cacheflush.h> |
21 | +#include <asm/hardware/gic.h> | |
21 | 22 | #include <asm/smp_scu.h> |
22 | 23 | #include <mach/hardware.h> |
23 | 24 | #include <mach/setup.h> |
... | ... | @@ -94,7 +95,7 @@ |
94 | 95 | */ |
95 | 96 | write_pen_release(cpu); |
96 | 97 | |
97 | - smp_cross_call(cpumask_of(cpu), 1); | |
98 | + gic_raise_softirq(cpumask_of(cpu), 1); | |
98 | 99 | |
99 | 100 | timeout = jiffies + (1 * HZ); |
100 | 101 | while (time_before(jiffies, timeout)) { |
... | ... | @@ -162,6 +163,8 @@ |
162 | 163 | |
163 | 164 | for (i = 0; i < ncores; i++) |
164 | 165 | set_cpu_possible(i, true); |
166 | + | |
167 | + set_smp_cross_call(gic_raise_softirq); | |
165 | 168 | } |
166 | 169 | |
167 | 170 | void __init platform_smp_prepare_cpus(unsigned int max_cpus) |
arch/arm/mach-vexpress/ct-ca9x4.c
arch/arm/mach-vexpress/include/mach/smp.h
arch/arm/plat-omap/include/plat/smp.h
1 | -/* | |
2 | - * OMAP4 machine specific smp.h | |
3 | - * | |
4 | - * Copyright (C) 2009 Texas Instruments, Inc. | |
5 | - * | |
6 | - * Author: | |
7 | - * Santosh Shilimkar <santosh.shilimkar@ti.com> | |
8 | - * | |
9 | - * Interface functions needed for the SMP. This file is based on arm | |
10 | - * realview smp platform. | |
11 | - * Copyright (c) 2003 ARM Limited. | |
12 | - * | |
13 | - * This program is free software; you can redistribute it and/or modify | |
14 | - * it under the terms of the GNU General Public License version 2 as | |
15 | - * published by the Free Software Foundation. | |
16 | - */ | |
17 | -#ifndef OMAP_ARCH_SMP_H | |
18 | -#define OMAP_ARCH_SMP_H | |
19 | - | |
20 | -#include <asm/hardware/gic.h> | |
21 | - | |
22 | -/* | |
23 | - * We use Soft IRQ1 as the IPI | |
24 | - */ | |
25 | -static inline void smp_cross_call(const struct cpumask *mask, int ipi) | |
26 | -{ | |
27 | - gic_raise_softirq(mask, ipi); | |
28 | -} | |
29 | - | |
30 | -#endif |
arch/arm/plat-versatile/platsmp.c
... | ... | @@ -16,6 +16,7 @@ |
16 | 16 | #include <linux/smp.h> |
17 | 17 | |
18 | 18 | #include <asm/cacheflush.h> |
19 | +#include <asm/hardware/gic.h> | |
19 | 20 | |
20 | 21 | /* |
21 | 22 | * control for which core is the next to come out of the secondary |
... | ... | @@ -83,7 +84,7 @@ |
83 | 84 | * the boot monitor to read the system wide flags register, |
84 | 85 | * and branch to the address found there. |
85 | 86 | */ |
86 | - smp_cross_call(cpumask_of(cpu), 1); | |
87 | + gic_raise_softirq(cpumask_of(cpu), 1); | |
87 | 88 | |
88 | 89 | timeout = jiffies + (1 * HZ); |
89 | 90 | while (time_before(jiffies, timeout)) { |