diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2011-01-06 17:31:35 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2011-01-06 17:32:03 -0500 |
commit | 4ec3eb13634529c0bc7466658d84d0bbe3244aea (patch) | |
tree | b491daac2ccfc7b8ca88e171a43f66888463568a /arch/arm/mach-s5pv310/platsmp.c | |
parent | 24056f525051a9e186af28904b396320e18bf9a0 (diff) | |
parent | 15095bb0fe779c0403091bda7adce5fb3bb9ca35 (diff) |
Merge branch 'smp' into misc
Conflicts:
arch/arm/kernel/entry-armv.S
arch/arm/mm/ioremap.c
Diffstat (limited to 'arch/arm/mach-s5pv310/platsmp.c')
-rw-r--r-- | arch/arm/mach-s5pv310/platsmp.c | 66 |
1 files changed, 23 insertions, 43 deletions
diff --git a/arch/arm/mach-s5pv310/platsmp.c b/arch/arm/mach-s5pv310/platsmp.c index d357c198edee..98c04748ed84 100644 --- a/arch/arm/mach-s5pv310/platsmp.c +++ b/arch/arm/mach-s5pv310/platsmp.c | |||
@@ -22,7 +22,6 @@ | |||
22 | #include <linux/io.h> | 22 | #include <linux/io.h> |
23 | 23 | ||
24 | #include <asm/cacheflush.h> | 24 | #include <asm/cacheflush.h> |
25 | #include <asm/localtimer.h> | ||
26 | #include <asm/smp_scu.h> | 25 | #include <asm/smp_scu.h> |
27 | #include <asm/unified.h> | 26 | #include <asm/unified.h> |
28 | 27 | ||
@@ -38,6 +37,19 @@ extern void s5pv310_secondary_startup(void); | |||
38 | 37 | ||
39 | volatile int __cpuinitdata pen_release = -1; | 38 | volatile int __cpuinitdata pen_release = -1; |
40 | 39 | ||
40 | /* | ||
41 | * Write pen_release in a way that is guaranteed to be visible to all | ||
42 | * observers, irrespective of whether they're taking part in coherency | ||
43 | * or not. This is necessary for the hotplug code to work reliably. | ||
44 | */ | ||
45 | static void write_pen_release(int val) | ||
46 | { | ||
47 | pen_release = val; | ||
48 | smp_wmb(); | ||
49 | __cpuc_flush_dcache_area((void *)&pen_release, sizeof(pen_release)); | ||
50 | outer_clean_range(__pa(&pen_release), __pa(&pen_release + 1)); | ||
51 | } | ||
52 | |||
41 | static void __iomem *scu_base_addr(void) | 53 | static void __iomem *scu_base_addr(void) |
42 | { | 54 | { |
43 | return (void __iomem *)(S5P_VA_SCU); | 55 | return (void __iomem *)(S5P_VA_SCU); |
@@ -47,8 +59,6 @@ static DEFINE_SPINLOCK(boot_lock); | |||
47 | 59 | ||
48 | void __cpuinit platform_secondary_init(unsigned int cpu) | 60 | void __cpuinit platform_secondary_init(unsigned int cpu) |
49 | { | 61 | { |
50 | trace_hardirqs_off(); | ||
51 | |||
52 | /* | 62 | /* |
53 | * if any interrupts are already enabled for the primary | 63 | * if any interrupts are already enabled for the primary |
54 | * core (e.g. timer irq), then they will not have been enabled | 64 | * core (e.g. timer irq), then they will not have been enabled |
@@ -60,8 +70,7 @@ void __cpuinit platform_secondary_init(unsigned int cpu) | |||
60 | * let the primary processor know we're out of the | 70 | * let the primary processor know we're out of the |
61 | * pen, then head off into the C entry point | 71 | * pen, then head off into the C entry point |
62 | */ | 72 | */ |
63 | pen_release = -1; | 73 | write_pen_release(-1); |
64 | smp_wmb(); | ||
65 | 74 | ||
66 | /* | 75 | /* |
67 | * Synchronise with the boot thread. | 76 | * Synchronise with the boot thread. |
@@ -88,16 +97,14 @@ int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle) | |||
88 | * Note that "pen_release" is the hardware CPU ID, whereas | 97 | * Note that "pen_release" is the hardware CPU ID, whereas |
89 | * "cpu" is Linux's internal ID. | 98 | * "cpu" is Linux's internal ID. |
90 | */ | 99 | */ |
91 | pen_release = cpu; | 100 | write_pen_release(cpu); |
92 | __cpuc_flush_dcache_area((void *)&pen_release, sizeof(pen_release)); | ||
93 | outer_clean_range(__pa(&pen_release), __pa(&pen_release + 1)); | ||
94 | 101 | ||
95 | /* | 102 | /* |
96 | * Send the secondary CPU a soft interrupt, thereby causing | 103 | * Send the secondary CPU a soft interrupt, thereby causing |
97 | * the boot monitor to read the system wide flags register, | 104 | * the boot monitor to read the system wide flags register, |
98 | * and branch to the address found there. | 105 | * and branch to the address found there. |
99 | */ | 106 | */ |
100 | smp_cross_call(cpumask_of(cpu)); | 107 | smp_cross_call(cpumask_of(cpu), 1); |
101 | 108 | ||
102 | timeout = jiffies + (1 * HZ); | 109 | timeout = jiffies + (1 * HZ); |
103 | while (time_before(jiffies, timeout)) { | 110 | while (time_before(jiffies, timeout)) { |
@@ -130,13 +137,6 @@ void __init smp_init_cpus(void) | |||
130 | ncores = scu_base ? scu_get_core_count(scu_base) : 1; | 137 | ncores = scu_base ? scu_get_core_count(scu_base) : 1; |
131 | 138 | ||
132 | /* sanity check */ | 139 | /* sanity check */ |
133 | if (ncores == 0) { | ||
134 | printk(KERN_ERR | ||
135 | "S5PV310: strange CM count of 0? Default to 1\n"); | ||
136 | |||
137 | ncores = 1; | ||
138 | } | ||
139 | |||
140 | if (ncores > NR_CPUS) { | 140 | if (ncores > NR_CPUS) { |
141 | printk(KERN_WARNING | 141 | printk(KERN_WARNING |
142 | "S5PV310: no. of cores (%d) greater than configured " | 142 | "S5PV310: no. of cores (%d) greater than configured " |
@@ -149,18 +149,10 @@ void __init smp_init_cpus(void) | |||
149 | set_cpu_possible(i, true); | 149 | set_cpu_possible(i, true); |
150 | } | 150 | } |
151 | 151 | ||
152 | void __init smp_prepare_cpus(unsigned int max_cpus) | 152 | void __init platform_smp_prepare_cpus(unsigned int max_cpus) |
153 | { | 153 | { |
154 | unsigned int ncores = num_possible_cpus(); | ||
155 | unsigned int cpu = smp_processor_id(); | ||
156 | int i; | 154 | int i; |
157 | 155 | ||
158 | smp_store_cpu_info(cpu); | ||
159 | |||
160 | /* are we trying to boot more cores than exist? */ | ||
161 | if (max_cpus > ncores) | ||
162 | max_cpus = ncores; | ||
163 | |||
164 | /* | 156 | /* |
165 | * Initialise the present map, which describes the set of CPUs | 157 | * Initialise the present map, which describes the set of CPUs |
166 | * actually populated at the present time. | 158 | * actually populated at the present time. |
@@ -168,25 +160,13 @@ void __init smp_prepare_cpus(unsigned int max_cpus) | |||
168 | for (i = 0; i < max_cpus; i++) | 160 | for (i = 0; i < max_cpus; i++) |
169 | set_cpu_present(i, true); | 161 | set_cpu_present(i, true); |
170 | 162 | ||
163 | scu_enable(scu_base_addr()); | ||
164 | |||
171 | /* | 165 | /* |
172 | * Initialise the SCU if there are more than one CPU and let | 166 | * Write the address of secondary startup into the |
173 | * them know where to start. | 167 | * system-wide flags register. The boot monitor waits |
168 | * until it receives a soft interrupt, and then the | ||
169 | * secondary CPU branches to this address. | ||
174 | */ | 170 | */ |
175 | if (max_cpus > 1) { | ||
176 | /* | ||
177 | * Enable the local timer or broadcast device for the | ||
178 | * boot CPU, but only if we have more than one CPU. | ||
179 | */ | ||
180 | percpu_timer_setup(); | ||
181 | |||
182 | scu_enable(scu_base_addr()); | ||
183 | |||
184 | /* | ||
185 | * Write the address of secondary startup into the | ||
186 | * system-wide flags register. The boot monitor waits | ||
187 | * until it receives a soft interrupt, and then the | ||
188 | * secondary CPU branches to this address. | ||
189 | */ | ||
190 | __raw_writel(BSYM(virt_to_phys(s5pv310_secondary_startup)), S5P_VA_SYSRAM); | 171 | __raw_writel(BSYM(virt_to_phys(s5pv310_secondary_startup)), S5P_VA_SYSRAM); |
191 | } | ||
192 | } | 172 | } |