diff options
author | David S. Miller <davem@sunset.davemloft.net> | 2006-02-25 16:39:56 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-02-26 22:36:00 -0500 |
commit | 7abea9214585823f7f19d91872d7c6f8874bef9a (patch) | |
tree | e7861664ee1596ed226725005d6b41a7b0edc447 /arch/sparc64 | |
parent | 043df59eb3798c094e6ba47136f3d3b34a6791a7 (diff) |
[SPARC64]: Make cpu_present_map available earlier.
The change to kernel/sched.c's init code to use for_each_cpu()
requires that the cpu_possible_map be setup much earlier.
Set it up via setup_arch(), constrained to NR_CPUS, and later
constrain it to max_cpus in smp_prepare_cpus().
This fixes SMP booting on sparc64.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc64')
-rw-r--r-- | arch/sparc64/kernel/setup.c | 2 | ||||
-rw-r--r-- | arch/sparc64/kernel/smp.c | 28 |
2 files changed, 21 insertions, 9 deletions
diff --git a/arch/sparc64/kernel/setup.c b/arch/sparc64/kernel/setup.c index 054461e6946d..158bd31e15b7 100644 --- a/arch/sparc64/kernel/setup.c +++ b/arch/sparc64/kernel/setup.c | |||
@@ -542,6 +542,8 @@ void __init setup_arch(char **cmdline_p) | |||
542 | } | 542 | } |
543 | #endif | 543 | #endif |
544 | 544 | ||
545 | smp_setup_cpu_possible_map(); | ||
546 | |||
545 | paging_init(); | 547 | paging_init(); |
546 | } | 548 | } |
547 | 549 | ||
diff --git a/arch/sparc64/kernel/smp.c b/arch/sparc64/kernel/smp.c index 1fb6323e65a4..1f7ad8a69052 100644 --- a/arch/sparc64/kernel/smp.c +++ b/arch/sparc64/kernel/smp.c | |||
@@ -1079,18 +1079,12 @@ int setup_profiling_timer(unsigned int multiplier) | |||
1079 | return 0; | 1079 | return 0; |
1080 | } | 1080 | } |
1081 | 1081 | ||
1082 | /* Constrain the number of cpus to max_cpus. */ | ||
1082 | void __init smp_prepare_cpus(unsigned int max_cpus) | 1083 | void __init smp_prepare_cpus(unsigned int max_cpus) |
1083 | { | 1084 | { |
1084 | int instance, mid; | ||
1085 | |||
1086 | instance = 0; | ||
1087 | while (!cpu_find_by_instance(instance, NULL, &mid)) { | ||
1088 | if (mid < max_cpus) | ||
1089 | cpu_set(mid, phys_cpu_present_map); | ||
1090 | instance++; | ||
1091 | } | ||
1092 | |||
1093 | if (num_possible_cpus() > max_cpus) { | 1085 | if (num_possible_cpus() > max_cpus) { |
1086 | int instance, mid; | ||
1087 | |||
1094 | instance = 0; | 1088 | instance = 0; |
1095 | while (!cpu_find_by_instance(instance, NULL, &mid)) { | 1089 | while (!cpu_find_by_instance(instance, NULL, &mid)) { |
1096 | if (mid != boot_cpu_id) { | 1090 | if (mid != boot_cpu_id) { |
@@ -1105,6 +1099,22 @@ void __init smp_prepare_cpus(unsigned int max_cpus) | |||
1105 | smp_store_cpu_info(boot_cpu_id); | 1099 | smp_store_cpu_info(boot_cpu_id); |
1106 | } | 1100 | } |
1107 | 1101 | ||
1102 | /* Set this up early so that things like the scheduler can init | ||
1103 | * properly. We use the same cpu mask for both the present and | ||
1104 | * possible cpu map. | ||
1105 | */ | ||
1106 | void __init smp_setup_cpu_possible_map(void) | ||
1107 | { | ||
1108 | int instance, mid; | ||
1109 | |||
1110 | instance = 0; | ||
1111 | while (!cpu_find_by_instance(instance, NULL, &mid)) { | ||
1112 | if (mid < NR_CPUS) | ||
1113 | cpu_set(mid, phys_cpu_present_map); | ||
1114 | instance++; | ||
1115 | } | ||
1116 | } | ||
1117 | |||
1108 | void __devinit smp_prepare_boot_cpu(void) | 1118 | void __devinit smp_prepare_boot_cpu(void) |
1109 | { | 1119 | { |
1110 | if (hard_smp_processor_id() >= NR_CPUS) { | 1120 | if (hard_smp_processor_id() >= NR_CPUS) { |