diff options
author | Ashok Raj <ashok.raj@intel.com> | 2006-03-25 10:29:28 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-25 12:10:53 -0500 |
commit | 51f62e186b78f8743246a349b09be370c8735479 (patch) | |
tree | e8b4f95445a581c3844beafb45654cefff5c490d /arch/x86_64 | |
parent | 45948d7720e8bd0104696087c6305fdd90e3b298 (diff) |
[PATCH] x86_64: cleanup allocating logical cpu numbers in x86_64
Minor cleanup to lend better for physical CPU hotplug.
Earlier way of using num_processors as index doesnt
fit if CPUs come and go. This makes the code little bit better
to read, and helps physical hotplug use the same functions as boot.
Reserving CPU0 for BSP is too late to be done in smp_prepare_boot_cpu().
Since logical assignments from MADT is already done via
setup_arch()->acpi_boot_init()->parse lapic
Signed-off-by: Ashok Raj <ashok.raj@intel.com>
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/x86_64')
-rw-r--r-- | arch/x86_64/kernel/mpparse.c | 19 | ||||
-rw-r--r-- | arch/x86_64/kernel/setup.c | 6 |
2 files changed, 14 insertions, 11 deletions
diff --git a/arch/x86_64/kernel/mpparse.c b/arch/x86_64/kernel/mpparse.c index 9013a90b5c2e..b17cf3eba359 100644 --- a/arch/x86_64/kernel/mpparse.c +++ b/arch/x86_64/kernel/mpparse.c | |||
@@ -106,11 +106,11 @@ static int __init mpf_checksum(unsigned char *mp, int len) | |||
106 | return sum & 0xFF; | 106 | return sum & 0xFF; |
107 | } | 107 | } |
108 | 108 | ||
109 | static void __init MP_processor_info (struct mpc_config_processor *m) | 109 | static void __cpuinit MP_processor_info (struct mpc_config_processor *m) |
110 | { | 110 | { |
111 | int cpu; | 111 | int cpu; |
112 | unsigned char ver; | 112 | unsigned char ver; |
113 | static int found_bsp=0; | 113 | cpumask_t tmp_map; |
114 | 114 | ||
115 | if (!(m->mpc_cpuflag & CPU_ENABLED)) { | 115 | if (!(m->mpc_cpuflag & CPU_ENABLED)) { |
116 | disabled_cpus++; | 116 | disabled_cpus++; |
@@ -133,8 +133,10 @@ static void __init MP_processor_info (struct mpc_config_processor *m) | |||
133 | return; | 133 | return; |
134 | } | 134 | } |
135 | 135 | ||
136 | cpu = num_processors++; | 136 | num_processors++; |
137 | 137 | cpus_complement(tmp_map, cpu_present_map); | |
138 | cpu = first_cpu(tmp_map); | ||
139 | |||
138 | #if MAX_APICS < 255 | 140 | #if MAX_APICS < 255 |
139 | if ((int)m->mpc_apicid > MAX_APICS) { | 141 | if ((int)m->mpc_apicid > MAX_APICS) { |
140 | printk(KERN_ERR "Processor #%d INVALID. (Max ID: %d).\n", | 142 | printk(KERN_ERR "Processor #%d INVALID. (Max ID: %d).\n", |
@@ -160,12 +162,7 @@ static void __init MP_processor_info (struct mpc_config_processor *m) | |||
160 | * entry is BSP, and so on. | 162 | * entry is BSP, and so on. |
161 | */ | 163 | */ |
162 | cpu = 0; | 164 | cpu = 0; |
163 | 165 | } | |
164 | bios_cpu_apicid[0] = m->mpc_apicid; | ||
165 | x86_cpu_to_apicid[0] = m->mpc_apicid; | ||
166 | found_bsp = 1; | ||
167 | } else | ||
168 | cpu = num_processors - found_bsp; | ||
169 | bios_cpu_apicid[cpu] = m->mpc_apicid; | 166 | bios_cpu_apicid[cpu] = m->mpc_apicid; |
170 | x86_cpu_to_apicid[cpu] = m->mpc_apicid; | 167 | x86_cpu_to_apicid[cpu] = m->mpc_apicid; |
171 | 168 | ||
@@ -691,7 +688,7 @@ void __init mp_register_lapic_address ( | |||
691 | } | 688 | } |
692 | 689 | ||
693 | 690 | ||
694 | void __init mp_register_lapic ( | 691 | void __cpuinit mp_register_lapic ( |
695 | u8 id, | 692 | u8 id, |
696 | u8 enabled) | 693 | u8 enabled) |
697 | { | 694 | { |
diff --git a/arch/x86_64/kernel/setup.c b/arch/x86_64/kernel/setup.c index f227d0c23dc6..50cd2bbd75af 100644 --- a/arch/x86_64/kernel/setup.c +++ b/arch/x86_64/kernel/setup.c | |||
@@ -708,6 +708,12 @@ void __init setup_arch(char **cmdline_p) | |||
708 | 708 | ||
709 | check_ioapic(); | 709 | check_ioapic(); |
710 | 710 | ||
711 | /* | ||
712 | * set this early, so we dont allocate cpu0 | ||
713 | * if MADT list doesnt list BSP first | ||
714 | * mpparse.c/MP_processor_info() allocates logical cpu numbers. | ||
715 | */ | ||
716 | cpu_set(0, cpu_present_map); | ||
711 | #ifdef CONFIG_ACPI | 717 | #ifdef CONFIG_ACPI |
712 | /* | 718 | /* |
713 | * Read APIC and some other early information from ACPI tables. | 719 | * Read APIC and some other early information from ACPI tables. |