Commit 6becedbb authored by Glauber de Oliveira Costa's avatar Glauber de Oliveira Costa Committed by Ingo Molnar

x86: minor adjustments for do_boot_cpu

This patch provides minor adjustments for do_boot_cpus
in both architectures to allow for integration
Signed-off-by: default avatarGlauber Costa <gcosta@redhat.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent e481fcf8
...@@ -556,7 +556,7 @@ static int __cpuinit do_boot_cpu(int apicid, int cpu) ...@@ -556,7 +556,7 @@ static int __cpuinit do_boot_cpu(int apicid, int cpu)
* Returns zero if CPU booted OK, else error code from wakeup_secondary_cpu. * Returns zero if CPU booted OK, else error code from wakeup_secondary_cpu.
*/ */
{ {
unsigned long boot_error; unsigned long boot_error = 0;
int timeout; int timeout;
unsigned long start_eip; unsigned long start_eip;
unsigned short nmi_high = 0, nmi_low = 0; unsigned short nmi_high = 0, nmi_low = 0;
...@@ -566,11 +566,7 @@ static int __cpuinit do_boot_cpu(int apicid, int cpu) ...@@ -566,11 +566,7 @@ static int __cpuinit do_boot_cpu(int apicid, int cpu)
}; };
INIT_WORK(&c_idle.work, do_fork_idle); INIT_WORK(&c_idle.work, do_fork_idle);
/* alternatives_smp_switch(1);
* Save current MTRR state in case it was changed since early boot
* (e.g. by the ACPI SMI) to initialize new CPUs with MTRRs in sync:
*/
mtrr_save_state();
c_idle.idle = get_idle_for_cpu(cpu); c_idle.idle = get_idle_for_cpu(cpu);
...@@ -607,8 +603,6 @@ static int __cpuinit do_boot_cpu(int apicid, int cpu) ...@@ -607,8 +603,6 @@ static int __cpuinit do_boot_cpu(int apicid, int cpu)
/* start_eip had better be page-aligned! */ /* start_eip had better be page-aligned! */
start_eip = setup_trampoline(); start_eip = setup_trampoline();
alternatives_smp_switch(1);
/* So we see what's up */ /* So we see what's up */
printk("Booting processor %d/%d ip %lx\n", cpu, apicid, start_eip); printk("Booting processor %d/%d ip %lx\n", cpu, apicid, start_eip);
/* Stack for startup_32 can be just as for start_secondary onwards */ /* Stack for startup_32 can be just as for start_secondary onwards */
...@@ -628,6 +622,12 @@ static int __cpuinit do_boot_cpu(int apicid, int cpu) ...@@ -628,6 +622,12 @@ static int __cpuinit do_boot_cpu(int apicid, int cpu)
store_NMI_vector(&nmi_high, &nmi_low); store_NMI_vector(&nmi_high, &nmi_low);
smpboot_setup_warm_reset_vector(start_eip); smpboot_setup_warm_reset_vector(start_eip);
/*
* Be paranoid about clearing APIC errors.
*/
apic_write(APIC_ESR, 0);
apic_read(APIC_ESR);
/* /*
* Starting actual IPI sequence... * Starting actual IPI sequence...
...@@ -864,6 +864,12 @@ int __cpuinit native_cpu_up(unsigned int cpu) ...@@ -864,6 +864,12 @@ int __cpuinit native_cpu_up(unsigned int cpu)
return -EINVAL; return -EINVAL;
} }
/*
* Save current MTRR state in case it was changed since early boot
* (e.g. by the ACPI SMI) to initialize new CPUs with MTRRs in sync:
*/
mtrr_save_state();
per_cpu(cpu_state, cpu) = CPU_UP_PREPARE; per_cpu(cpu_state, cpu) = CPU_UP_PREPARE;
__smp_prepare_cpu(cpu); __smp_prepare_cpu(cpu);
......
...@@ -432,7 +432,7 @@ static void __cpuinit do_fork_idle(struct work_struct *work) ...@@ -432,7 +432,7 @@ static void __cpuinit do_fork_idle(struct work_struct *work)
*/ */
static int __cpuinit do_boot_cpu(int cpu, int apicid) static int __cpuinit do_boot_cpu(int cpu, int apicid)
{ {
unsigned long boot_error; unsigned long boot_error = 0;
int timeout; int timeout;
unsigned long start_rip; unsigned long start_rip;
struct create_idle c_idle = { struct create_idle c_idle = {
...@@ -530,11 +530,6 @@ static int __cpuinit do_boot_cpu(int cpu, int apicid) ...@@ -530,11 +530,6 @@ static int __cpuinit do_boot_cpu(int cpu, int apicid)
apic_write(APIC_ESR, 0); apic_write(APIC_ESR, 0);
apic_read(APIC_ESR); apic_read(APIC_ESR);
/*
* Status is now clean
*/
boot_error = 0;
/* /*
* Starting actual IPI sequence... * Starting actual IPI sequence...
*/ */
...@@ -564,7 +559,7 @@ static int __cpuinit do_boot_cpu(int cpu, int apicid) ...@@ -564,7 +559,7 @@ static int __cpuinit do_boot_cpu(int cpu, int apicid)
print_cpu_info(&cpu_data(cpu)); print_cpu_info(&cpu_data(cpu));
} else { } else {
boot_error = 1; boot_error = 1;
if (*((volatile unsigned char *)phys_to_virt(SMP_TRAMPOLINE_BASE)) if (*((volatile unsigned char *)trampoline_base)
== 0xA5) == 0xA5)
/* trampoline started but...? */ /* trampoline started but...? */
printk("Stuck ??\n"); printk("Stuck ??\n");
...@@ -583,10 +578,12 @@ static int __cpuinit do_boot_cpu(int cpu, int apicid) ...@@ -583,10 +578,12 @@ static int __cpuinit do_boot_cpu(int cpu, int apicid)
cpu_clear(cpu, cpu_present_map); cpu_clear(cpu, cpu_present_map);
cpu_clear(cpu, cpu_possible_map); cpu_clear(cpu, cpu_possible_map);
per_cpu(x86_cpu_to_apicid, cpu) = BAD_APICID; per_cpu(x86_cpu_to_apicid, cpu) = BAD_APICID;
return -EIO;
} }
return 0; /* mark "stuck" area as not stuck */
*((volatile unsigned long *)trampoline_base) = 0;
return boot_error;
} }
cycles_t cacheflush_time; cycles_t cacheflush_time;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment