From: Li Shaohua <shaohua.li@intel.com>

It's a bit awkward to be calling things by hand on SMP and with an initcall
on UP.  Maybe something neater can be done there.

Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 arch/i386/kernel/cpu/common.c        |    3 +++
 arch/i386/kernel/smpboot.c           |    5 -----
 arch/i386/kernel/sysenter.c          |   10 ----------
 arch/i386/mach-voyager/voyager_smp.c |    4 ----
 include/asm-i386/processor.h         |    1 +
 include/asm-i386/smp.h               |    2 --
 6 files changed, 4 insertions(+), 21 deletions(-)

diff -puN arch/i386/kernel/cpu/common.c~sep-initializing-rework-cleanup arch/i386/kernel/cpu/common.c
--- 25/arch/i386/kernel/cpu/common.c~sep-initializing-rework-cleanup	2005-05-25 00:52:51.000000000 -0700
+++ 25-akpm/arch/i386/kernel/cpu/common.c	2005-05-25 00:52:51.000000000 -0700
@@ -432,6 +432,9 @@ void __init identify_cpu(struct cpuinfo_
 #ifdef CONFIG_X86_MCE
 	mcheck_init(c);
 #endif
+	if (c == &boot_cpu_data)
+		sysenter_setup();
+	enable_sep_cpu();
 }
 
 #ifdef CONFIG_X86_HT
diff -puN arch/i386/kernel/smpboot.c~sep-initializing-rework-cleanup arch/i386/kernel/smpboot.c
--- 25/arch/i386/kernel/smpboot.c~sep-initializing-rework-cleanup	2005-05-25 00:52:51.000000000 -0700
+++ 25-akpm/arch/i386/kernel/smpboot.c	2005-05-25 00:52:51.000000000 -0700
@@ -454,8 +454,6 @@ static void __init start_secondary(void 
 	 */
 	local_flush_tlb();
 
-	/* Note: this must be done before __cpu_up finish */
-	enable_sep_cpu();
 	cpu_set(smp_processor_id(), cpu_online_map);
 
 	/* We can take interrupts now: we're officially "up". */
@@ -940,9 +938,6 @@ static void __init smp_boot_cpus(unsigne
 	cpus_clear(cpu_core_map[0]);
 	cpu_set(0, cpu_core_map[0]);
 
-	sysenter_setup();
-	enable_sep_cpu();
-
 	/*
 	 * If we couldn't find an SMP configuration at boot time,
 	 * get out of here now!
diff -puN arch/i386/kernel/sysenter.c~sep-initializing-rework-cleanup arch/i386/kernel/sysenter.c
--- 25/arch/i386/kernel/sysenter.c~sep-initializing-rework-cleanup	2005-05-25 00:52:51.000000000 -0700
+++ 25-akpm/arch/i386/kernel/sysenter.c	2005-05-25 00:52:51.000000000 -0700
@@ -65,13 +65,3 @@ int __init sysenter_setup(void)
 
 	return 0;
 }
-
-#ifndef CONFIG_SMP
-static int __init sysenter_sep_setup(void)
-{
-	sysenter_setup();
-	enable_sep_cpu();
-	return 0;
-}
-module_init(sysenter_sep_setup);
-#endif
diff -puN arch/i386/mach-voyager/voyager_smp.c~sep-initializing-rework-cleanup arch/i386/mach-voyager/voyager_smp.c
--- 25/arch/i386/mach-voyager/voyager_smp.c~sep-initializing-rework-cleanup	2005-05-25 00:52:51.000000000 -0700
+++ 25-akpm/arch/i386/mach-voyager/voyager_smp.c	2005-05-25 00:52:51.000000000 -0700
@@ -506,7 +506,6 @@ start_secondary(void *unused)
 	while (!cpu_isset(cpuid, smp_commenced_mask))
 		rep_nop();
 	local_irq_enable();
-	enable_sep_cpu();
 
 	local_flush_tlb();
 
@@ -704,9 +703,6 @@ smp_boot_cpus(void)
 	printk("CPU%d: ", boot_cpu_id);
 	print_cpu_info(&cpu_data[boot_cpu_id]);
 
-	sysenter_setup();
-	enable_sep_cpu();
-
 	if(is_cpu_quad()) {
 		/* booting on a Quad CPU */
 		printk("VOYAGER SMP: Boot CPU is Quad\n");
diff -puN include/asm-i386/processor.h~sep-initializing-rework-cleanup include/asm-i386/processor.h
--- 25/include/asm-i386/processor.h~sep-initializing-rework-cleanup	2005-05-25 00:52:51.000000000 -0700
+++ 25-akpm/include/asm-i386/processor.h	2005-05-25 00:52:51.000000000 -0700
@@ -692,5 +692,6 @@ extern void select_idle_routine(const st
 
 extern unsigned long boot_option_idle_override;
 extern void enable_sep_cpu(void);
+extern int sysenter_setup(void);
 
 #endif /* __ASM_I386_PROCESSOR_H */
diff -puN include/asm-i386/smp.h~sep-initializing-rework-cleanup include/asm-i386/smp.h
--- 25/include/asm-i386/smp.h~sep-initializing-rework-cleanup	2005-05-25 00:52:51.000000000 -0700
+++ 25-akpm/include/asm-i386/smp.h	2005-05-25 00:52:51.000000000 -0700
@@ -37,8 +37,6 @@ extern int smp_num_siblings;
 extern cpumask_t cpu_sibling_map[];
 extern cpumask_t cpu_core_map[];
 
-extern int sysenter_setup(void);
-
 extern void smp_flush_tlb(void);
 extern void smp_message_irq(int cpl, void *dev_id, struct pt_regs *regs);
 extern void smp_invalidate_rcv(void);		/* Process an NMI */
_