Skip to content

Commit

Permalink
powerpc: kill useless SMT code in prom_hold_cpus
Browse files Browse the repository at this point in the history
This piece of code is broken for >2 threads, and possibly in some
other subtle ways (such as comparing a value obtained from an
"ibm,ppc-interrupt-server#s" property to a value obtained from a
"reg" property) and doesn't seem to have any useful purpose in the
first place other than a dubious warning in case NR_CPUS is too
small, which probably isn't the right place to do so.

Signed-off-by: Nathan Lynch <ntl@pobox.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
  • Loading branch information
nathanlynch authored and ozbenh committed Jul 28, 2008
1 parent ff8dc76 commit 7d2f607
Showing 1 changed file with 3 additions and 36 deletions.
39 changes: 3 additions & 36 deletions arch/powerpc/kernel/prom_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,6 @@ static int __initdata mem_reserve_cnt;
static cell_t __initdata regbuf[1024];


#define MAX_CPU_THREADS 2

/*
* Error results ... some OF calls will return "-1" on error, some
* will return 0, some will return either. To simplify, here are
Expand Down Expand Up @@ -1339,10 +1337,6 @@ static void __init prom_hold_cpus(void)
unsigned int reg;
phandle node;
char type[64];
int cpuid = 0;
unsigned int interrupt_server[MAX_CPU_THREADS];
unsigned int cpu_threads, hw_cpu_num;
int propsize;
struct prom_t *_prom = &RELOC(prom);
unsigned long *spinloop
= (void *) LOW_ADDR(__secondary_hold_spinloop);
Expand Down Expand Up @@ -1386,7 +1380,6 @@ static void __init prom_hold_cpus(void)
reg = -1;
prom_getprop(node, "reg", &reg, sizeof(reg));

prom_debug("\ncpuid = 0x%x\n", cpuid);
prom_debug("cpu hw idx = 0x%x\n", reg);

/* Init the acknowledge var which will be reset by
Expand All @@ -1395,28 +1388,9 @@ static void __init prom_hold_cpus(void)
*/
*acknowledge = (unsigned long)-1;

propsize = prom_getprop(node, "ibm,ppc-interrupt-server#s",
&interrupt_server,
sizeof(interrupt_server));
if (propsize < 0) {
/* no property. old hardware has no SMT */
cpu_threads = 1;
interrupt_server[0] = reg; /* fake it with phys id */
} else {
/* We have a threaded processor */
cpu_threads = propsize / sizeof(u32);
if (cpu_threads > MAX_CPU_THREADS) {
prom_printf("SMT: too many threads!\n"
"SMT: found %x, max is %x\n",
cpu_threads, MAX_CPU_THREADS);
cpu_threads = 1; /* ToDo: panic? */
}
}

hw_cpu_num = interrupt_server[0];
if (hw_cpu_num != _prom->cpu) {
if (reg != _prom->cpu) {
/* Primary Thread of non-boot cpu */
prom_printf("%x : starting cpu hw idx %x... ", cpuid, reg);
prom_printf("starting cpu hw idx %x... ", reg);
call_prom("start-cpu", 3, 0, node,
secondary_hold, reg);

Expand All @@ -1431,17 +1405,10 @@ static void __init prom_hold_cpus(void)
}
#ifdef CONFIG_SMP
else
prom_printf("%x : boot cpu %x\n", cpuid, reg);
prom_printf("boot cpu hw idx %x\n", reg);
#endif /* CONFIG_SMP */

/* Reserve cpu #s for secondary threads. They start later. */
cpuid += cpu_threads;
}

if (cpuid > NR_CPUS)
prom_printf("WARNING: maximum CPUs (" __stringify(NR_CPUS)
") exceeded: ignoring extras\n");

prom_debug("prom_hold_cpus: end...\n");
}

Expand Down

0 comments on commit 7d2f607

Please sign in to comment.