Starting 2nd cpu on recent intel macbook

From: Paul Mackerras
Date: Sat Jul 25 2009 - 22:45:25 EST


I recently got my daughter a new Macbook because her current ppc-based
iBook is starting to die. On macbooks you can boot Linux either as a
"legacy" OS, where firmware provides a BIOS, or using a native EFI
boot, where everything is done through EFI and there is no BIOS. The
CPU is a Core 2 Duo (2.13GHz).

When I boot any recent kernel with a legacy boot, the kernel fails to
bring up the second core and then hangs some time later. If I boot
with "nosmp" it boots up OK. Interestingly, when booting via EFI the
second core comes up just fine, though this machine requires some
changes to the EFI code in the kernel, and you have to use efifb for
the console.

The downside of the EFI boot is that we then don't know how to control
the screen brightness, and in fact when switching from X to a text
console the backlight gets turned off and we don't know how to turn it
on. So a legacy boot is better from the point of view of video
support, but we don't get to use the second core.

I have tried to find any difference between how we poke the APIC in
the two cases, but that looks to be identical. In both cases we send
INIT IPIs to turn INIT on and then off, and then send two STARTUP
IPIs. The trampoline code is the same, and one of the first things it
does is to write 0xa5a5a5a5 to the first dword of the trampoline area.
I see that happening on the EFI boot but not the legacy boot.

So I'm wondering how much firmware gets involved in this process. It
sounds like the STARTUP IPI acts pretty directly in hardware, but only
does anything if the core is in the halted state. Does the INIT IPI
put the cpu into the halted start as well as resetting it? Or does
the INIT make the cpu start executing somewhere (where?) and then it
goes through some initialization code before executing a hlt
instruction somewhere in firmware?

Paul.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/