Commit 7890f794e0e6f7dce2a5f4a03ba64b0b3fe306bd

Authored by David S. Miller
1 parent 63c2a0e598

[SPARC64]: Add prom_{start,stop}cpu_cpuid().

Use prom_startcpu_cpuid() on SUN4V instead of prom_startcpu().

We should really test for "SUNW,start-cpu-by-cpuid" presence
and use it if present even on SUN4U.

Signed-off-by: David S. Miller <davem@davemloft.net>

Showing 3 changed files with 34 additions and 8 deletions Side-by-side Diff

arch/sparc64/kernel/smp.c
... ... @@ -331,15 +331,21 @@
331 331 unsigned long cookie =
332 332 (unsigned long)(&cpu_new_thread);
333 333 struct task_struct *p;
334   - int timeout, ret, cpu_node;
  334 + int timeout, ret;
335 335  
336 336 p = fork_idle(cpu);
337 337 callin_flag = 0;
338 338 cpu_new_thread = task_thread_info(p);
339 339 cpu_set(cpu, cpu_callout_map);
340 340  
341   - cpu_find_by_mid(cpu, &cpu_node);
342   - prom_startcpu(cpu_node, entry, cookie);
  341 + if (tlb_type == hypervisor) {
  342 + prom_startcpu_cpuid(cpu, entry, cookie);
  343 + } else {
  344 + int cpu_node;
  345 +
  346 + cpu_find_by_mid(cpu, &cpu_node);
  347 + prom_startcpu(cpu_node, entry, cookie);
  348 + }
343 349  
344 350 for (timeout = 0; timeout < 5000000; timeout++) {
345 351 if (callin_flag)
arch/sparc64/prom/misc.c
... ... @@ -308,9 +308,21 @@
308 308 }
309 309  
310 310 #ifdef CONFIG_SMP
311   -void prom_startcpu(int cpunode, unsigned long pc, unsigned long o0)
  311 +void prom_startcpu(int cpunode, unsigned long pc, unsigned long arg)
312 312 {
313   - p1275_cmd("SUNW,start-cpu", P1275_INOUT(3, 0), cpunode, pc, o0);
  313 + p1275_cmd("SUNW,start-cpu", P1275_INOUT(3, 0), cpunode, pc, arg);
  314 +}
  315 +
  316 +void prom_startcpu_cpuid(int cpuid, unsigned long pc, unsigned long arg)
  317 +{
  318 + p1275_cmd("SUNW,start-cpu-by-cpuid", P1275_INOUT(3, 0),
  319 + cpuid, pc, arg);
  320 +}
  321 +
  322 +void prom_stopcpu_cpuid(int cpuid)
  323 +{
  324 + p1275_cmd("SUNW,stop-cpu-by-cpuid", P1275_INOUT(1, 0),
  325 + cpuid);
314 326 }
315 327  
316 328 void prom_stopself(void)
include/asm-sparc64/oplib.h
... ... @@ -188,10 +188,18 @@
188 188  
189 189 /* Multiprocessor operations... */
190 190 #ifdef CONFIG_SMP
191   -/* Start the CPU with the given device tree node, context table, and context
192   - * at the passed program counter.
  191 +/* Start the CPU with the given device tree node at the passed program
  192 + * counter with the given arg passed in via register %o0.
193 193 */
194   -extern void prom_startcpu(int cpunode, unsigned long pc, unsigned long o0);
  194 +extern void prom_startcpu(int cpunode, unsigned long pc, unsigned long arg);
  195 +
  196 +/* Start the CPU with the given cpu ID at the passed program
  197 + * counter with the given arg passed in via register %o0.
  198 + */
  199 +extern void prom_startcpu_cpuid(int cpuid, unsigned long pc, unsigned long arg);
  200 +
  201 +/* Stop the CPU with the given cpu ID. */
  202 +extern void prom_stopcpu_cpuid(int cpuid);
195 203  
196 204 /* Stop the current CPU. */
197 205 extern void prom_stopself(void);