aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc64/kernel
diff options
context:
space:
mode:
authorDavid S. Miller <davem@sunset.davemloft.net>2005-11-11 15:48:56 -0500
committerDavid S. Miller <davem@sunset.davemloft.net>2005-11-11 15:48:56 -0500
commit4d45cbacb8488ae3172065e4fca608079492231b (patch)
treedb8c485e2837185487aecbd46d27205dbc9e7536 /arch/sparc64/kernel
parent388f7ef720a982f49925e7b4e96f216f208f8c03 (diff)
[SPARC64]: Restore 2.4.x /proc/cpuinfo behavior for "ncpus probed" field.
Noticed by Tom 'spot' Callaway. Even on uniprocessor we always reported the number of physical cpus in the system via /proc/cpuinfo. But when this got changed to use num_possible_cpus() it always reads as "1" on uniprocessor. This change was unintentional. So scan the firmware device tree and count the number of cpu nodes, and report that, as we always did. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc64/kernel')
-rw-r--r--arch/sparc64/kernel/setup.c19
-rw-r--r--arch/sparc64/kernel/smp.c1
2 files changed, 15 insertions, 5 deletions
diff --git a/arch/sparc64/kernel/setup.c b/arch/sparc64/kernel/setup.c
index bf1849dd9c49..48180531562f 100644
--- a/arch/sparc64/kernel/setup.c
+++ b/arch/sparc64/kernel/setup.c
@@ -587,6 +587,8 @@ extern void mmu_info(struct seq_file *);
587unsigned int dcache_parity_tl1_occurred; 587unsigned int dcache_parity_tl1_occurred;
588unsigned int icache_parity_tl1_occurred; 588unsigned int icache_parity_tl1_occurred;
589 589
590static int ncpus_probed;
591
590static int show_cpuinfo(struct seq_file *m, void *__unused) 592static int show_cpuinfo(struct seq_file *m, void *__unused)
591{ 593{
592 seq_printf(m, 594 seq_printf(m,
@@ -595,8 +597,8 @@ static int show_cpuinfo(struct seq_file *m, void *__unused)
595 "promlib\t\t: Version 3 Revision %d\n" 597 "promlib\t\t: Version 3 Revision %d\n"
596 "prom\t\t: %d.%d.%d\n" 598 "prom\t\t: %d.%d.%d\n"
597 "type\t\t: sun4u\n" 599 "type\t\t: sun4u\n"
598 "ncpus probed\t: %ld\n" 600 "ncpus probed\t: %d\n"
599 "ncpus active\t: %ld\n" 601 "ncpus active\t: %d\n"
600 "D$ parity tl1\t: %u\n" 602 "D$ parity tl1\t: %u\n"
601 "I$ parity tl1\t: %u\n" 603 "I$ parity tl1\t: %u\n"
602#ifndef CONFIG_SMP 604#ifndef CONFIG_SMP
@@ -610,8 +612,8 @@ static int show_cpuinfo(struct seq_file *m, void *__unused)
610 prom_prev >> 16, 612 prom_prev >> 16,
611 (prom_prev >> 8) & 0xff, 613 (prom_prev >> 8) & 0xff,
612 prom_prev & 0xff, 614 prom_prev & 0xff,
613 (long)num_possible_cpus(), 615 ncpus_probed,
614 (long)num_online_cpus(), 616 num_online_cpus(),
615 dcache_parity_tl1_occurred, 617 dcache_parity_tl1_occurred,
616 icache_parity_tl1_occurred 618 icache_parity_tl1_occurred
617#ifndef CONFIG_SMP 619#ifndef CONFIG_SMP
@@ -677,6 +679,15 @@ static int __init topology_init(void)
677 int i, err; 679 int i, err;
678 680
679 err = -ENOMEM; 681 err = -ENOMEM;
682
683 /* Count the number of physically present processors in
684 * the machine, even on uniprocessor, so that /proc/cpuinfo
685 * output is consistent with 2.4.x
686 */
687 ncpus_probed = 0;
688 while (!cpu_find_by_instance(ncpus_probed, NULL, NULL))
689 ncpus_probed++;
690
680 for (i = 0; i < NR_CPUS; i++) { 691 for (i = 0; i < NR_CPUS; i++) {
681 if (cpu_possible(i)) { 692 if (cpu_possible(i)) {
682 struct cpu *p = kmalloc(sizeof(*p), GFP_KERNEL); 693 struct cpu *p = kmalloc(sizeof(*p), GFP_KERNEL);
diff --git a/arch/sparc64/kernel/smp.c b/arch/sparc64/kernel/smp.c
index 797a65493fb8..6efc03df51c3 100644
--- a/arch/sparc64/kernel/smp.c
+++ b/arch/sparc64/kernel/smp.c
@@ -39,7 +39,6 @@
39#include <asm/starfire.h> 39#include <asm/starfire.h>
40#include <asm/tlb.h> 40#include <asm/tlb.h>
41 41
42extern int linux_num_cpus;
43extern void calibrate_delay(void); 42extern void calibrate_delay(void);
44 43
45/* Please don't make this stuff initdata!!! --DaveM */ 44/* Please don't make this stuff initdata!!! --DaveM */